• Checking Values with Arrays
    2 replies, posted
I have been unable to figure it out for a while so i decided to come here. If i want to check a users group with a table of specified groups how would i do that? Or checking someones team with a table of teams. Thanks for the help.
You'll have to explain more. Do you want to find if a users group is in a table of allowed groups? [lua]local allowedGroups = {"admin","superadmin"} if table.HasValue(allowedGroups,ply:GetUserGroup()) then MsgN(ply:Nick().." is in an allowed group!") end[/lua] Or teams? [lua]local allowedTeams= {1,2,3} -- This is what the team integer is defined as (the first value of team.SetUp, ie team.SetUp( 1, "Hello", Color(255,255,255,255) ) ) if table.HasValue(allowedTeams,ply:Team()) then MsgN(ply:Nick().." is in an allowed team!") end[/lua]
That's exactly what i was looking for, thanks a lot!
Sorry, you need to Log In to post a reply to this thread.