Alright I need help.
You see this?
[code]TalkToPerson(v, col, LANGUAGE.advert .." "..ply:Nick().. " (ADMIN) ", col2, text, ply)[/code]
I want the word (ADMIN) to be color of "Color(20, 150, 20, 255)".
I cant figure it out for the life of meh.
we'd have to see what TalkToPerson is.
[QUOTE=PortalGod;24773336]we'd have to see what TalkToPerson is.[/QUOTE]
Its from DarkRP. Basically prints to chat.
col
and
col2
are variable colors btw.
This is just a wild guess
[lua]
TalkToPerson(v, col, LANGUAGE.advert .." "..ply:Nick(),Color(20, 150, 20, 255), " (ADMIN) ", col2, text, ply)
[/lua]
Assuming it uses [b][url=http://wiki.garrysmod.com/?title=Chat.AddText]Chat.AddText [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[QUOTE=ralle105;24775850]This is just a wild guess
[lua]
TalkToPerson(v, col, LANGUAGE.advert .." "..ply:Nick(),Color(20, 150, 20, 255), " (ADMIN) ", col2, text, ply)
[/lua]
Assuming it uses [b][url=http://wiki.garrysmod.com/?title=Chat.AddText]Chat.AddText [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b][/QUOTE]
It makes the word admin green, but it wont print the text.
[QUOTE=Bubka3;24775893]It makes the word admin green, but it wont print the text.[/QUOTE]
Then post the function source for us or we can't help you.
[QUOTE=ralle105;24776021]Then post the function source for us or we can't help you.[/QUOTE]
Im currently editing DarkRP, and this is my second day scripting. I do not know were to find the function.
[QUOTE=Bubka3;24776031]Im currently editing DarkRP, and this is my second day scripting. I do not know were to find the function.[/QUOTE]
Open every file and make a search for
[code]
function TalkToPerson
[/code]
[QUOTE=ralle105;24776093]Open every file and make a search for
[code]
function TalkToPerson
[/code][/QUOTE]
Yea. I just noticed that.
Here you go :)
[code]
function TalkToPerson(receiver, col1, text1, col2, text2, sender)
umsg.Start("DarkRP_Chat", receiver)
umsg.Short(col1.r)
umsg.Short(col1.g)
umsg.Short(col1.b)
umsg.String(text1)
if sender then
umsg.Entity(sender)
end
if col2 and text2 then
umsg.Short(col2.r)
umsg.Short(col2.g)
umsg.Short(col2.b)
umsg.String(text2)
end
umsg.End()
end
[/code]
Thanks for your help :D
[QUOTE=Bubka3;24776113]Yea. I just noticed that.
Here you go :)
[code]
function TalkToPerson(receiver, col1, text1, col2, text2, sender)
umsg.Start("DarkRP_Chat", receiver)
umsg.Short(col1.r)
umsg.Short(col1.g)
umsg.Short(col1.b)
umsg.String(text1)
if sender then
umsg.Entity(sender)
end
if col2 and text2 then
umsg.Short(col2.r)
umsg.Short(col2.g)
umsg.Short(col2.b)
umsg.String(text2)
end
umsg.End()
end
[/code]
Thanks for your help :D[/QUOTE]
Aight, now do a search for
[code]
üsermessage.Hook("DarkRP_Chat"
[/code]
In the client files and post the source of the function that is hooked.
[QUOTE=ralle105;24777054]Aight, now do a search for
[code]
üsermessage.Hook("DarkRP_Chat"
[/code]
In the client files and post the source of the function that is hooked.[/QUOTE]
[code]
local function AddToChat(msg)
local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local name = msg:ReadString()
local ply = msg:ReadEntity()
local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local text = msg:ReadString()
if text and text ~= "" then
chat.AddText(col1, name, col2, ": "..text)
if ValidEntity(ply) then
hook.Call("OnPlayerChat", GM, ply, text, false, ply:Alive())
end
else
chat.AddText(col1, name)
hook.Call("ChatText", GM, "0", name, name, "none")
end
chat.PlaySound()
end
usermessage.Hook("DarkRP_Chat", AddToChat)
[/code]
server-side
[lua]
function TalkToPersonAdmin(receiver, col1, text1, col2, text2, sender)
umsg.Start("DarkRP_Chat_ADMIN", receiver)
umsg.Short(col1.r)
umsg.Short(col1.g)
umsg.Short(col1.b)
umsg.String(text1)
if sender then
umsg.Entity(sender)
end
if col2 and text2 then
umsg.Short(col2.r)
umsg.Short(col2.g)
umsg.Short(col2.b)
umsg.String(text2)
end
umsg.End()
end
[/lua]
client-side
[lua]
local function AddToChatADMIN(msg)
local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local name = msg:ReadString()
local ply = msg:ReadEntity()
local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local text = msg:ReadString()
if text and text ~= "" then
chat.AddText(col1, name,Color(20, 150, 20, 255)," (ADMIN) ", col2, ": "..text)
if ValidEntity(ply) then
hook.Call("OnPlayerChat", GM, ply, text, false, ply:Alive())
end
else
chat.AddText(col1, name,Color(20, 150, 20, 255)," (ADMIN) ")
hook.Call("ChatText", GM, "0", name, name, "none")
end
chat.PlaySound()
end
usermessage.Hook("DarkRP_Chat_ADMIN", AddToChatADMIN)
[/lua]
It works, thanks man. It saved me a shit-ton of time.
Sorry, you need to Log In to post a reply to this thread.