General > Developers Corner
"Grabbing" the ulib groups
Bite That Apple:
Hi, I'm somewhat fairly new to lua, so sorry if what I'm asking makes me sound dumb, and or doesn't make sense..
--- Code: ---local Tags =
{
--Group --Tag --Color
{"admin", "[ADMIN] ", Color(0, 0, 255, 255) },
{"superadmin", "[SUPERADMIN] ", Color(255, 0, 0, 255) },
{"owner", "[", Color(255, 255, 255, 255), "Owner", "] ", Color(255, 255, 255, 255) }
}
hook.Add("OnPlayerChat", "Tags", function(ply, strText)
for k,v in pairs(Tags) do
if ply:IsUserGroup(v[1]) then
local nickteamcolor = team.GetColor(ply:Team())
local nickteam = team.GetName(ply:Team())
chat.AddText(v[3], v[2], nickteamcolor, nickteam, v[6], v[5], nickteamcolor, ply:Nick(), color_white, ": ", Color(255, 255, 255, 255), strText)
return true
end
end
end )
--- End code ---
You can assume what this going to do, but what to make it basically fully automatic so people don't have to add things to the {table} so it works properly, Anyways. I wanted to know the (or if one does exist) or a way so I can get this here -> ply:IsUserGroup(v[1]) to grab all ulib groups?
Any suggestions, help, tutorial, and or wiki would be much appreciated.
** also, sorry if this is in the incorrect section, if so please just move it :)**
JamminR:
The Ulib groups table is stored in ucl.groups (or, ULib.ucl.groups)
And please, though our forum 'allows' it, please, please, please shrink your signature image. :)
Bite That Apple:
I've changed my signature to something about 10x smaller now, I hope it's okay.
Anyways, thank you I'm going to mess around now see if I can get it to work and than get back to this if it worked or not. :)
JamminR:
You'll need to parse the table of course. :) for pairs is your friend.
I'll leave that to you to figure out.
As for the signature, my easily distracted vision impaired eyes thank you!
Bite That Apple:
Didn't seem to understand what you all meant, but it is 4:19AM, so I shall go to bed and hopefully understand a bit more. I do thank you for your reply.
Navigation
[0] Message Index
[#] Next page
Go to full version