• Making certain tools donator-exclusive
    1 replies, posted
I've set up a "donator" group in my 'users.txt' file. I've got a certain tool that I want to make donator-exclusive, but I'm not sure how. I looked around the Garry's Mod wiki and found Player.IsUserGroup but I'm not sure how to check this on a certain player. The example on the wiki initialises 'player' by using 'players.GetAll()[1]' (the first player), but I'm not sure how to check a specific player. I came across the 'Player.GetByID' function on the wiki but I'm still not sure how to utilise this and the other function to check if a player is in the 'donator' group. Help would be appreciated, Thanks
[lua]function UseTool( player, traceline, toolmode ) if( toolmode == "omgdonatortool" or toolmode == "killeverythingtool" )then return player:IsUserGroup("donator"); --or "return:player:IsDonator();" if the example below is added. end end hook.Add( "CanTool", "HerpDerpToolCheck", UseTool )[/lua] Or incorporate this [lua] local meta = FindMetaTable( "Player" ); function meta:IsDonator() return self:IsUserGroup("donator"); end [/lua]
Sorry, you need to Log In to post a reply to this thread.