All i need is a lua chat tag, examples
[Owner] kim: Hey all
the "rank" has to be coloured. The ranks that i need: Donor, Admin, Super admin, DEV, Owner
- Im paying! - we'll find out the amount on steam.
[QUOTE=.\\Shadow};35444119][lua]
if SERVER then
AddCSLuaFile( "tags.lua" )
end
local cWhite = Color( 255, 255, 255 )
local cBlack = Color( 0, 0, 0 )
local cRed = Color( 255, 0, 0 )
local cGreen = Color( 0, 255, 0 )
local cBlue = Color( 0, 0, 255 )
local cLightBlue = Color( 0, 255, 255 )
local CTags = {}
-- CTags[Number] = { "Tag of group", "group-name", Color( of, the, tag ) }
CTags[1] = { "Super Admin", "superadmin", cRed }
CTags[2] = { "Admin", "admin", cGreen }
CTags[3] = { "Donor", "donor", cBlue }
CTags[4] = { "Guest", "user", cWhite }
CTags[5] = { "Dev", "dev", cBlack }
CTags[6] = { "Owner", "owner", cLightBlue }
local function ChatTags( a, b, c, d )
local C = {}
if d then
table.insert( C, Color( 255, 30, 40 ) )
table.insert( C, "*DEAD* " )
end
if c then
table.insert( C, Color( 30, 160, 40 ) )
table.insert( C, "(TEAM) " )
end
if a:IsValid() then
for _,v in pairs( CTags ) do
if a:IsUserGroup( v[2] ) then
table.insert( C, cWhite )
table.insert( C, "[" )
table.insert( C, v[3] )
table.insert( C, v[1] )
table.insert( C, cWhite )
table.insert( C, "] " )
end
end
table.insert( C, team.GetColor( a:Team() ) )
table.insert( C, a:Nick() )
else
table.insert( C, "Console" )
end
table.insert( C, Color( 255, 255, 255 ) )
table.insert( C, ": "..b )
chat.AddText( unpack( C ) )
return true
end
hook.Add( "OnPlayerChat", "___ChatTags", ChatTags )
[/lua]
Save in lua/autorun/ as tags.lua[/QUOTE]
it doesn't work. when im typing, im typing as "Dead" and all who's typing is typing in my name?
I can fix it for you add me warhero3971
[QUOTE=mutiik;35470248]it doesn't work. when im typing, im typing as "Dead" and all who's typing is typing in my name?[/QUOTE]
Change line 51 to:
[lua]
table.insert( C, a:GetName() )
[/lua]
then remove (delete) line 52 and see if that works. My power supply recently broke and I'm stuck using a laptop for the time being, so I can't test if it'll work, but that's the only reason I could think of it not working. You are placing this in the autorun file of the server, not just your game directory, right?
Maybe if OP can state what admin mod he is using, we could help him.
[QUOTE=Hyper Iguana;35479023]Maybe if OP can state what admin mod he is using, we could help him.[/QUOTE]
IsUserGroup works for most of the admin mods; having a script be admin-mod specific is just dumb.
[QUOTE=.\\Shadow};35479233]IsUserGroup works for most of the admin mods; having a script be admin-mod specific is just dumb.[/QUOTE]
isn't it easier to just use IsAdmin and IsSuperAdmin versus IsUserGroup? My own admin mod has IsMember/VIP/Mod/Admin/SuperAdmin/Owner since IsUserGroup users NWVars, and I use PNWVars
[QUOTE=Banana Lord.;35481502]isn't it easier to just use IsAdmin and IsSuperAdmin versus IsUserGroup? My own admin mod has IsMember/VIP/Mod/Admin/SuperAdmin/Owner since IsUserGroup users NWVars, and I use PNWVars[/QUOTE]
Why not something like this?
[lua]
meta.OldUGroup=meta.IsUserGroup
function meta:IsUserGroup(ug)
return self:GetRank()==ug or self:OldUGroup(ug)
end
[/lua]
That's how I did it in my admin mod, anyways. I would use IsUserGroup for this, as there's more flexibility.
i place it the right place, it doesn't work :( can someone give me a working one
[editline]9th April 2012[/editline]
and i use ULX admin mod with FAadmin from DarkRP
ULX uses pl:GetUserGroup() == "Rank"
Sorry, you need to Log In to post a reply to this thread.