Message auto / FAdmin

  • Initiateur de la discussion Valfunde
  • Date de début
  • Initiateur de la discussion
Valfunde

Valfunde

Helpeur Divin
Messages
3 800
Score réaction
1 235
Points
450
Coucou, j'ai 2 questions :
Comment supprimer les messages FAdmin du type :
[FAdmin] you set the team of you to SUPERADMIN EN SERVICE

Et aussi comment mettre des messages auto dans le chat ?

Merci de votre aide ! :)
 
Diablos26

Diablos26

Psychopathe
Messages
951
Score réaction
326
Points
315
Problèmes réglés :)
 
Jean Foret

Jean Foret

Psychopathe
Messages
850
Score réaction
190
Points
220
et comment l'as tu réglé ? :)
 
  • Initiateur de la discussion
Valfunde

Valfunde

Helpeur Divin
Messages
3 800
Score réaction
1 235
Points
450
Alors, pour les FAdmins messages, Diablos a éfféctué un PATCH, j'ai plus le lien, il le mettra tout a l'heure je pense
Et pour les messages autos, tu va dans data>ulx>advert .txt
et regarde juste un exemple de message qui va s'afficher au milieu de l'ecran:
Code:
{ "text" "Vous êtes en train de jouer sur %host%. Amusez vous bien :" "red" "99" "green" "112" "blue" "255" "time_on_screen" "10" "time" "300"
}
Et la un exemple de message qui va s'afficher dans le chat :
Code:
{ "text" "Si vous avez un problemes ou une question, contactez le staff" "red" "0" "green" "119" "blue" "27" "time" "300"
}
Voila, en espérant t'avoir aidé ^_^
 
Jean Foret

Jean Foret

Psychopathe
Messages
850
Score réaction
190
Points
220
merci !
 
LABOEME

LABOEME

Geek
Messages
69
Score réaction
1
Points
65
Valfunde à dit:
Coucou, j'ai 2 questions :
Comment supprimer les messages FAdmin du type :
[FAdmin] you set the team of you to SUPERADMIN EN SERVICE

Et aussi comment mettre des messages auto dans le chat ?

Merci de votre aide ! :)
local showChat = CreateClientConVar("FAdmin_ShowChatNotifications", 1, true, false)

local HUDNote_c = 0
local HUDNote_i = 1
local HUDNotes = {}

--Notify ripped off the Sandbox notify, changed to my likings
function FAdmin.Messages.AddMessage(MsgType, Message)
local tab = {}
tab.text = Message
tab.recv = SysTime()
tab.velx = 0
tab.vely = -5
surface.SetFont("GModNotify")
local w, h = surface.GetTextSize( Message )
tab.x = ScrW() / 2 + w * 0.5 + (ScrW() / 20)
tab.y = ScrH()
tab.a = 255
local MsgTypeNames = {"ERROR", "NOTIFY", "QUESTION", "GOOD", "BAD"}
if not MsgTypeNames[MsgType] then return end
tab.col = FAdmin.Messages.MsgTypes[MsgTypeNames[MsgType]].COLOR

table.insert( HUDNotes, tab )

HUDNote_c = HUDNote_c + 1
HUDNote_i = HUDNote_i + 1

LocalPlayer():EmitSound("npc/turret_floor/click1.wav", 30, 100)
end

usermessage.Hook("FAdmin_SendMessage", function(u) FAdmin.Messages.AddMessage(u:ReadShort(), u:ReadString()) end)


local function DrawNotice(k, v, i)
local H = ScrH() / 1024
local x = v.x - 75 * H
local y = v.y - 27
surface.SetFont("GModNotify")
local w, h = surface.GetTextSize(v.text)
h = h + 16
local col = v.col

draw.RoundedBox(4, x - w - h + 24, y - 8, w + h - 16, h, col)
-- Draw Icon
surface.SetDrawColor(255, 255, 255, v.a)

draw.DrawNonParsedSimpleText(v.text, "GModNotify", x + 1, y + 1, Color(0, 0, 0, v.a * 0.8), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x - 1, y - 1, Color(0, 0, 0, v.a * 0.5), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x + 1, y - 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x - 1, y + 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x, y, Color(255, 255, 255, v.a), TEXT_ALIGN_RIGHT)
local ideal_y = ScrH() - (HUDNote_c - i) * h
local ideal_x = ScrW() / 2 + w * 0.5 + (ScrW() / 20)
local timeleft = 6 - (SysTime() - v.recv)

-- Cartoon style about to go thing
if (timeleft < 0.8) then
ideal_x = ScrW() / 2 + w * 0.5 + 200
end

-- Gone!
if (timeleft < 0.5) then
ideal_y = ScrH() + 50
end

local spd = RealFrameTime() * 15
v.y = v.y + v.vely * spd
v.x = v.x + v.velx * spd
local dist = ideal_y - v.y
v.vely = v.vely + dist * spd * 1

if (math.abs(dist) < 2 and math.abs(v.vely) < 0.1) then
v.vely = 0
end

dist = ideal_x - v.x
v.velx = v.velx + dist * spd * 1

if math.abs(dist) < 2 and math.abs(v.velx) < 0.1 then
v.velx = 0
end

-- Friction.. kind of FPS independant.
v.velx = v.velx * (0.95 - RealFrameTime() * 8)
v.vely = v.vely * (0.95 - RealFrameTime() * 8)
end

local function HUDPaint()
if not HUDNotes then return end
local i = 0

for k, v in pairs(HUDNotes) do
if v ~= 0 then
i = i + 1
DrawNotice(k, v, i)
end
end

for k, v in pairs(HUDNotes) do
if v ~= 0 and v.recv + 6 < SysTime() then
HUDNotes[k] = 0
HUDNote_c = HUDNote_c - 1

if HUDNote_c == 0 then
HUDNotes = {}
end
end
end
end
hook.Add("HUDPaint", "FAdmin_MessagePaint", HUDPaint)

local function ConsoleMessage(um)
MsgC(Color(255, 0, 0, 255), "(FAdmin) ", Color(200, 0, 200, 255), um:ReadString() .. "\n")
end
usermessage.Hook("FAdmin_ConsoleMessage", ConsoleMessage)


local red = Color(255, 0, 0)
local white = Color(190, 190, 190)
local brown = Color(102, 51, 0)
local blue = Color(102, 0, 255)

-- Inserts the instigator into a notification message
local function insertInstigator(res, instigator, _)
table.insert(res, brown)
table.insert(res, FAdmin.PlayerName(instigator))
end

-- Inserts the targets into the notification message
local function insertTargets(res, _, targets)
table.insert(res, blue)
table.insert(res, FAdmin.TargetsToString(targets))
end

local modMessage = {
instigator = insertInstigator,
you = function(res) table.insert(res, brown) table.insert(res, "you") end,
targets = insertTargets,
}

local function receiveNotification()
local id = net.ReadUInt(16)
local notification = FAdmin.Notifications[id]
local instigator = net.ReadEntity()

local targets = {}

if notification.hasTarget then
local targetCount = net.ReadUInt(8)
for i = 1, targetCount do
table.insert(targets, net.ReadEntity())
end
end

local extraInfo = notification.readExtraInfo and notification.readExtraInfo()


end
net.Receive("FAdmin_Notification", receiveNotification)

Voici le dernier patch FAdmin de @Diablos26
 
  • J'aime
Réactions: MrGeekoo
  • Initiateur de la discussion
Valfunde

Valfunde

Helpeur Divin
Messages
3 800
Score réaction
1 235
Points
450
Ok merci :)
 
Diablos26

Diablos26

Psychopathe
Messages
951
Score réaction
326
Points
315
Merci, ça m'épargne le travail de rechercher ça. Ceci dit t'as pas indiqué le fichier où il faut mettre le code. Donc je fais un copier-coller de mon message :
Code:
local showChat = CreateClientConVar("FAdmin_ShowChatNotifications", 1, true, false)
local HUDNote_c = 0
local HUDNote_i = 1
local HUDNotes = {}
--Notify ripped off the Sandbox notify, changed to my likings
function FAdmin.Messages.AddMessage(MsgType, Message) local tab = {} tab.text = Message tab.recv = SysTime() tab.velx = 0 tab.vely = -5 surface.SetFont("GModNotify") local w, h = surface.GetTextSize( Message ) tab.x = ScrW() / 2 + w * 0.5 + (ScrW() / 20) tab.y = ScrH() tab.a = 255 local MsgTypeNames = {"ERROR", "NOTIFY", "QUESTION", "GOOD", "BAD"} if not MsgTypeNames[MsgType] then return end tab.col = FAdmin.Messages.MsgTypes[MsgTypeNames[MsgType]].COLOR table.insert( HUDNotes, tab ) HUDNote_c = HUDNote_c + 1 HUDNote_i = HUDNote_i + 1 LocalPlayer():EmitSound("npc/turret_floor/click1.wav", 30, 100)
end
usermessage.Hook("FAdmin_SendMessage", function(u) FAdmin.Messages.AddMessage(u:ReadShort(), u:ReadString()) end)
local function DrawNotice(k, v, i) local H = ScrH() / 1024 local x = v.x - 75 * H local y = v.y - 27 surface.SetFont("GModNotify") local w, h = surface.GetTextSize(v.text) h = h + 16 local col = v.col draw.RoundedBox(4, x - w - h + 24, y - 8, w + h - 16, h, col) -- Draw Icon surface.SetDrawColor(255, 255, 255, v.a) draw.DrawNonParsedSimpleText(v.text, "GModNotify", x + 1, y + 1, Color(0, 0, 0, v.a * 0.8), TEXT_ALIGN_RIGHT) draw.DrawNonParsedSimpleText(v.text, "GModNotify", x - 1, y - 1, Color(0, 0, 0, v.a * 0.5), TEXT_ALIGN_RIGHT) draw.DrawNonParsedSimpleText(v.text, "GModNotify", x + 1, y - 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT) draw.DrawNonParsedSimpleText(v.text, "GModNotify", x - 1, y + 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT) draw.DrawNonParsedSimpleText(v.text, "GModNotify", x, y, Color(255, 255, 255, v.a), TEXT_ALIGN_RIGHT) local ideal_y = ScrH() - (HUDNote_c - i) * h local ideal_x = ScrW() / 2 + w * 0.5 + (ScrW() / 20) local timeleft = 6 - (SysTime() - v.recv) -- Cartoon style about to go thing if (timeleft < 0.8) then ideal_x = ScrW() / 2 + w * 0.5 + 200 end -- Gone! if (timeleft < 0.5) then ideal_y = ScrH() + 50 end local spd = RealFrameTime() * 15 v.y = v.y + v.vely * spd v.x = v.x + v.velx * spd local dist = ideal_y - v.y v.vely = v.vely + dist * spd * 1 if (math.abs(dist) < 2 and math.abs(v.vely) < 0.1) then v.vely = 0 end dist = ideal_x - v.x v.velx = v.velx + dist * spd * 1 if math.abs(dist) < 2 and math.abs(v.velx) < 0.1 then v.velx = 0 end -- Friction.. kind of FPS independant. v.velx = v.velx * (0.95 - RealFrameTime() * 8) v.vely = v.vely * (0.95 - RealFrameTime() * 8)
end
local function HUDPaint() if not HUDNotes then return end local i = 0 for k, v in pairs(HUDNotes) do if v ~= 0 then i = i + 1 DrawNotice(k, v, i) end end for k, v in pairs(HUDNotes) do if v ~= 0 and v.recv + 6 < SysTime() then HUDNotes[k] = 0 HUDNote_c = HUDNote_c - 1 if HUDNote_c == 0 then HUDNotes = {} end end end
end
hook.Add("HUDPaint", "FAdmin_MessagePaint", HUDPaint)
local function ConsoleMessage(um) MsgC(Color(255, 0, 0, 255), "(FAdmin) ", Color(200, 0, 200, 255), um:ReadString() .. "\n")
end
usermessage.Hook("FAdmin_ConsoleMessage", ConsoleMessage)
local red = Color(255, 0, 0)
local white = Color(190, 190, 190)
local brown = Color(102, 51, 0)
local blue = Color(102, 0, 255)
-- Inserts the instigator into a notification message
local function insertInstigator(res, instigator, _) table.insert(res, brown) table.insert(res, FAdmin.PlayerName(instigator))
end
-- Inserts the targets into the notification message
local function insertTargets(res, _, targets) table.insert(res, blue) table.insert(res, FAdmin.TargetsToString(targets))
end
local modMessage = { instigator = insertInstigator, you = function(res) table.insert(res, brown) table.insert(res, "you") end, targets = insertTargets,
}
local function receiveNotification() local id = net.ReadUInt(16) local notification = FAdmin.Notifications[id] local instigator = net.ReadEntity() local targets = {} if notification.hasTarget then local targetCount = net.ReadUInt(8) for i = 1, targetCount do table.insert(targets, net.ReadEntity()) end end local extraInfo = notification.readExtraInfo and notification.readExtraInfo()
end
net.Receive("FAdmin_Notification", receiveNotification)
Dans gamemodes->darkrp->gamemode->modules->fadmin->fadmin->messaging->cl_init.lua (vous supprimez tout le contenu du fichier pour remplacer par ce qui est au-dessus).
 
  • J'aime
Réactions: MrGeekoo
  • Initiateur de la discussion
Valfunde

Valfunde

Helpeur Divin
Messages
3 800
Score réaction
1 235
Points
450
@MrGeekoo
 
MrGeekoo

MrGeekoo

Geek suprême
Messages
460
Score réaction
42
Points
130
Merci !
LABOEME à dit:
local showChat = CreateClientConVar("FAdmin_ShowChatNotifications", 1, true, false)

local HUDNote_c = 0
local HUDNote_i = 1
local HUDNotes = {}

--Notify ripped off the Sandbox notify, changed to my likings
function FAdmin.Messages.AddMessage(MsgType, Message)
local tab = {}
tab.text = Message
tab.recv = SysTime()
tab.velx = 0
tab.vely = -5
surface.SetFont("GModNotify")
local w, h = surface.GetTextSize( Message )
tab.x = ScrW() / 2 + w * 0.5 + (ScrW() / 20)
tab.y = ScrH()
tab.a = 255
local MsgTypeNames = {"ERROR", "NOTIFY", "QUESTION", "GOOD", "BAD"}
if not MsgTypeNames[MsgType] then return end
tab.col = FAdmin.Messages.MsgTypes[MsgTypeNames[MsgType]].COLOR

table.insert( HUDNotes, tab )

HUDNote_c = HUDNote_c + 1
HUDNote_i = HUDNote_i + 1

LocalPlayer():EmitSound("npc/turret_floor/click1.wav", 30, 100)
end

usermessage.Hook("FAdmin_SendMessage", function(u) FAdmin.Messages.AddMessage(u:ReadShort(), u:ReadString()) end)


local function DrawNotice(k, v, i)
local H = ScrH() / 1024
local x = v.x - 75 * H
local y = v.y - 27
surface.SetFont("GModNotify")
local w, h = surface.GetTextSize(v.text)
h = h + 16
local col = v.col

draw.RoundedBox(4, x - w - h + 24, y - 8, w + h - 16, h, col)
-- Draw Icon
surface.SetDrawColor(255, 255, 255, v.a)

draw.DrawNonParsedSimpleText(v.text, "GModNotify", x + 1, y + 1, Color(0, 0, 0, v.a * 0.8), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x - 1, y - 1, Color(0, 0, 0, v.a * 0.5), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x + 1, y - 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x - 1, y + 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT)
draw.DrawNonParsedSimpleText(v.text, "GModNotify", x, y, Color(255, 255, 255, v.a), TEXT_ALIGN_RIGHT)
local ideal_y = ScrH() - (HUDNote_c - i) * h
local ideal_x = ScrW() / 2 + w * 0.5 + (ScrW() / 20)
local timeleft = 6 - (SysTime() - v.recv)

-- Cartoon style about to go thing
if (timeleft < 0.8) then
ideal_x = ScrW() / 2 + w * 0.5 + 200
end

-- Gone!
if (timeleft < 0.5) then
ideal_y = ScrH() + 50
end

local spd = RealFrameTime() * 15
v.y = v.y + v.vely * spd
v.x = v.x + v.velx * spd
local dist = ideal_y - v.y
v.vely = v.vely + dist * spd * 1

if (math.abs(dist) < 2 and math.abs(v.vely) < 0.1) then
v.vely = 0
end

dist = ideal_x - v.x
v.velx = v.velx + dist * spd * 1

if math.abs(dist) < 2 and math.abs(v.velx) < 0.1 then
v.velx = 0
end

-- Friction.. kind of FPS independant.
v.velx = v.velx * (0.95 - RealFrameTime() * 8)
v.vely = v.vely * (0.95 - RealFrameTime() * 8)
end

local function HUDPaint()
if not HUDNotes then return end
local i = 0

for k, v in pairs(HUDNotes) do
if v ~= 0 then
i = i + 1
DrawNotice(k, v, i)
end
end

for k, v in pairs(HUDNotes) do
if v ~= 0 and v.recv + 6 < SysTime() then
HUDNotes[k] = 0
HUDNote_c = HUDNote_c - 1

if HUDNote_c == 0 then
HUDNotes = {}
end
end
end
end
hook.Add("HUDPaint", "FAdmin_MessagePaint", HUDPaint)

local function ConsoleMessage(um)
MsgC(Color(255, 0, 0, 255), "(FAdmin) ", Color(200, 0, 200, 255), um:ReadString() .. "\n")
end
usermessage.Hook("FAdmin_ConsoleMessage", ConsoleMessage)


local red = Color(255, 0, 0)
local white = Color(190, 190, 190)
local brown = Color(102, 51, 0)
local blue = Color(102, 0, 255)

-- Inserts the instigator into a notification message
local function insertInstigator(res, instigator, _)
table.insert(res, brown)
table.insert(res, FAdmin.PlayerName(instigator))
end

-- Inserts the targets into the notification message
local function insertTargets(res, _, targets)
table.insert(res, blue)
table.insert(res, FAdmin.TargetsToString(targets))
end

local modMessage = {
instigator = insertInstigator,
you = function(res) table.insert(res, brown) table.insert(res, "you") end,
targets = insertTargets,
}

local function receiveNotification()
local id = net.ReadUInt(16)
local notification = FAdmin.Notifications[id]
local instigator = net.ReadEntity()

local targets = {}

if notification.hasTarget then
local targetCount = net.ReadUInt(8)
for i = 1, targetCount do
table.insert(targets, net.ReadEntity())
end
end

local extraInfo = notification.readExtraInfo and notification.readExtraInfo()


end
net.Receive("FAdmin_Notification", receiveNotification)

Voici le dernier patch FAdmin de @Diablos26
 
  • Initiateur de la discussion
Valfunde

Valfunde

Helpeur Divin
Messages
3 800
Score réaction
1 235
Points
450
@EviLKniGht62 le dernier message de diablos ^_^
 
  • J'aime
Réactions: EviLKniGht62
  • Banni
EviLKniGht62

EviLKniGht62

Psychopathe
Messages
2 133
Score réaction
203
Points
280
A oui pas mal ^^
 
  • J'aime
Réactions: Valfunde
Regnam

Regnam

Geek suprême
Messages
702
Score réaction
66
Points
130
Valfunde à dit:
Alors, pour les FAdmins messages, Diablos a éfféctué un PATCH, j'ai plus le lien, il le mettra tout a l'heure je pense
Et pour les messages autos, tu va dans data>ulx>advert .txt
et regarde juste un exemple de message qui va s'afficher au milieu de l'ecran:
Code:
{ "text" "Vous êtes en train de jouer sur %host%. Amusez vous bien :" "red" "99" "green" "112" "blue" "255" "time_on_screen" "10" "time" "300"
}
Et la un exemple de message qui va s'afficher dans le chat :
Code:
{ "text" "Si vous avez un problemes ou une question, contactez le staff" "red" "0" "green" "119" "blue" "27" "time" "300"
}
Voila, en espérant t'avoir aidé ^_^
Juste ça pouvait marcher non? https://prntscr.com/bsbnll
 
  • Initiateur de la discussion
Valfunde

Valfunde

Helpeur Divin
Messages
3 800
Score réaction
1 235
Points
450
Oui , mais c'est simplement une façon differentes d'add des messages :p
 
Regnam

Regnam

Geek suprême
Messages
702
Score réaction
66
Points
130
Valfunde à dit:
Oui , mais c'est simplement une façon differentes d'add des messages :p
Ouais mais c'est plus facile IG je penses :p
 
Discord d'entraide
Rejoignz-nous sur Discord