Hello. I am having a problem with adding ChatTags to DarkRP after the up-date. I have this code in my "cl_init.lua" but It dosn't work anymore. Any ideas?
Code: [lua]local function AddToChat(msg)
local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local name = msg:ReadString()
local ply = msg:ReadEntity()
if name == "" then name = ply.DarkRPVars.rpname end
local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local text = msg:ReadString()
local rank_str, rank_col, bracket_col
if ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("owner") then
rank_str = "Owner"
rank_col = Color( 205, 92, 92 )
bracket_col = Color( 50, 205, 50)
elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("headadmin") then
rank_str = "HeadAdmin"
rank_col = Color( 0, 0, 160 )
bracket_col = Color( 50, 205, 50 )
elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("moderator") then
rank_str = "Mod"
rank_col = Color( 51, 204, 255 )
bracket_col = Color( 50, 205, 50 )
elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("respected") then
rank_str = "Respected"
rank_col = Color( 51, 204, 255 )
bracket_col = Color( 50, 205, 50 )
elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("superadmin") then
rank_str = "SA"
rank_col = Color( 255, 69, 0 )
bracket_col = Color( 50, 205, 50 )
elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("admin") then
rank_str = "Admin"
rank_col = Color( 128, 255, 0 )
bracket_col = Color( 50, 205, 50 )
elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("vip") then
rank_str = "VIP"
rank_col = Color( 51, 204, 255 )
bracket_col = Color( 50, 205, 50 )
else
rank_str = ""
rank_col = Color( 255, 255, 255 )
end
if text and text ~= "" then
chat.AddText(col1, name, bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", col2, ": "..text)
if ValidEntity(ply) then
hook.Call("OnPlayerChat", nil, ply, text, false, ply:Alive())
end
else
chat.AddText(col1, name)
hook.Call("ChatText", nil, "0", name, name, "none")
end
chat.PlaySound()
end
usermessage.Hook( "DarkRP_Chat", AddToChat )
-- To add more custom groups use this format
-- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("GroupName") then
-- rank_str = "Tags"
-- rank_col = Color( 128, 255, 0 ) RED-GREEN-BLUE
-- bracket_col = Color( 50, 205, 50 ) RED-GREEN-BLUE[/lua]
All help is welcome.
[lua] tags
[QUOTE=ms333;40141921][lua] tags[/QUOTE]
I know this will make me sound dumb, but what do you mean?
[QUOTE=Sgt. Sicknezz;40145814]I know this will make me sound dumb, but what do you mean?[/QUOTE]
Instead of your [code] tags
[ lua ]at the beginning and [ /lua ] at the end with out the spaces between the ["remove space lua]
There you go.
Okay, One Bump.
ValidEntity is replaced with IsValid in Gmod 13
Okay so that should be the only problem?
Let me check.
Edit:
Well that didn't fix it...
Maybe its the hooks? Were may I find a list of the GMod 13 RP hooks?
That could be it.
Since: [url]http://wiki.darkrp.com/index.php/DarkRP:Hooks[/url]
I don't think it's done in that way anymore.
Well okay. Thank you for all the help!
Time to see what I can do, lol.
Sorry, you need to Log In to post a reply to this thread.