• Simple Table Question
    3 replies, posted
hello, i'm trying to figure out how I can make it so if I have a table full of user groups (admingroups = {"user", "admin", "staff"}) and want to make an if statement to check if a player is in one of those usergroups then continue else don't. i did [CODE]if ply:IsUserGroup( admingroups ) then[/CODE] but it didnt work. i then tried doing: [CODE] usergroup = table.foreach( admingroups, function( value ) ply:IsUserGroup( value ) end )[/CODE] and [CODE]if usergroup then [/CODE] but it still did not work.
This is a very handy [URL="https://dl.dropboxusercontent.com/u/26074909/tutoring/_gm_specific_darkrp/darkrp_customcheck_isvip_via_list_or_group_or_admin_check.lua.html"]guide[/URL] made by Acecool that depicts whether or not someone is apart of a table for a custom job in DarkRP. The concept might be a little different but the execution is the same. Take a look at it
[code] local admingroups = { "admin", "superadmin", "owner" } if (table.HasValue(admingroups, ply:GetUserGroup())) then --do stuff end [/code] Make sure ply is defined or use LocalPlayer().
lolcats post worked. thank you for the help.
Sorry, you need to Log In to post a reply to this thread.