Hello! I know what your thinking "Ugh another kid trying to code a fail dark rp server".
I recently just finished my server today i added custom printers custom weapons etc. I'm not a pro with lua and know only the basics. I was wondering how can i make something like when someone talks in OOC it says (Donator) jpnumber1: Hey guys! or (Superadmin) jpnumber1 Hey guys! I'm not best at lua so sorry if your face palming right now but i could just use some help this is. That's what this section is for isn't it?
[HTML]if ply:IsValid() and ply:IsPlayer() and ply:IsSuperAdmin() then
rank_str = "Superadmin"
rank_col = Color( 255, 0, 0 ) -- red for example
bracket_col = Color( 153, 50, 204 ) -- purplish
elseif ply:IsValid() and ply:IsPlayer() and ply:IsDonator() then
rank_str = "Donator"
rank_col = Color( 0, 255, 0 ) -- green
bracket_col = Color( 218, 165, 32 ) -- orangish
else
rank_str = ""
rank_col = Color( 255, 255, 255 )
end[/HTML]
[QUOTE='[RYD3R];36883725'][HTML]if ply:IsValid() and ply:IsPlayer() and ply:IsSuperAdmin() then
rank_str = "Superadmin"
rank_col = Color( 255, 0, 0 ) -- red for example
bracket_col = Color( 153, 50, 204 ) -- purplish
elseif ply:IsValid() and ply:IsPlayer() and ply:IsDonator() then
rank_str = "Donator"
rank_col = Color( 0, 255, 0 ) -- green
bracket_col = Color( 218, 165, 32 ) -- orangish
else
rank_str = ""
rank_col = Color( 255, 255, 255 )
end[/HTML][/QUOTE]
None of that code will work unless you're planning on adding on to it.
A quick way of making chat tags in darkrp would be editing line 475 (or somewhere near it) of cl_init.lua where it says "chat.AddText(col1, name, col2, ": "..text)"
Replace it with:
[lua]
if ply:IsSuperAdmin() then
chat.AddText(Color(0, 255, 0), "(Superadmin) ", col1, name, col2, ": "..text)
elseif ply:IsUserGroup("donator") then
chat.AddText(Color(230, 180, 30), "(Donator) ", col1, name, col2, ": "..text)
else
chat.AddText(col1, name, col2, ": "..text)
end
[/lua]
If you use ulx create a group called "donator" for it to work for donators.
If you use another admin mod you're going to have to do some editing for it to work for donators.
[QUOTE=Derek_SM;36890446]None of that code will work unless you're planning on adding on to it.
A quick way of making chat tags in darkrp would be editing line 475 (or somewhere near it) of cl_init.lua where it says "chat.AddText(col1, name, col2, ": "..text)"
Replace it with:
[lua]
if ply:IsSuperAdmin() then
chat.AddText(Color(0, 255, 0), "(Superadmin) ", col1, name, col2, ": "..text)
elseif ply:IsUserGroup("donator") then
chat.AddText(Color(230, 180, 30), "(Donator) ", col1, name, col2, ": "..text)
else
chat.AddText(col1, name, col2, ": "..text)
end
[/lua]
If you use ulx create a group called "donator" for it to work for donators.
If you use another admin mod you're going to have to do some editing for it to work for donators.[/QUOTE]
Thanks it worked but I was wondering can you make work in only OOC and can you add a (Admin) one to? I'm afraid i'll fuck it up it. it would be great if u did.
This should add the Admin tag aswell. Has for the OOC thing I have no idea.
[lua]
if ply:IsSuperAdmin() then
chat.AddText(Color(0, 255, 0), "(Superadmin) ", col1, name, col2, ": "..text)
elseif ply:IsAdmin() then
chat.AddText(Color(255, 0, 30), "(Admin) ", col1, name, col2, ": "..text)
elseif ply:IsUserGroup("donater") then
chat.AddText(Color(230, 180, 30), "(Donater) ", col1, name, col2, ": "..text)
else
chat.AddText(col1, name, col2, ": "..text)
end
[/lua]
Sorry, you need to Log In to post a reply to this thread.