And I need $16 by tomorrow for my next car payment. But the world doesn’t just give us things, does it? You’re gonna have to work instead of just telling people what you “need”. Thankfully there are friendly and helpful people all over the place, so here’s what you need.
Take a look at what Winter posted:
if ( ply:IsAdmin() ) then
– do stuff
Reading that, what do you think passes that statement? If you said “players that are admin,” then you’re correct! That statement will only pass players that are admin. However, that’s not what you quite need. So, moving forward from that, Garry’s Mod doesn’t have a function that simply detects if a user is VIP as it does for admin and superadmin. So we’re gonna have to come up with our own check to allow that statement to pass VIP’s as well.
Player:GetUserGroup is a function that returns a player’s usergroup. This is how we’ll be able to check the group of the player. So if you’d like to check if the player’s usergroup is VIP, you’d simply do the following:
ply:GetUserGroup() == “vip”
If you’d like more than just VIP’s and admins to pass that statement, instead of just adding a bunch of “or usergroup” statements, you could simplify it by putting all of the usergroups you’d like into a local table. Afterwards, using
table.HasValue you’ll be able to simply check if the player’s usergroup is one in the table.
If you have no idea what the fuck any of the above is:
Click this if you don’t want to learn and would just like to be given the code
Have a beautiful day.