0

Basically I am trying to use ULX in Garrys mod and have a file check if the user is VIP or staff that it will give them a weapon as soon as it notices the weapon being weapon_physgun. This would need to check over and over so when a player joins or a player donates and gets switched to VIP it will give them the custom weapon.

At this time I have no code.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Avery Johnson
  • 11
  • 1
  • 4

2 Answers2

2

Can't you also check ULX with ply:GetUserGroup()?

Anyway, here's how I would do it:

function checkranks(ply)
    if (ply:GetUserGroup() == "yourgroup") then
        ply:Give("weapon")
    end
end

If you would like to do it on the player's first spawn, then do:

hook.Add( "PlayerInitalSpawn", "Check Ranks", checkranks)
Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Birdboat
  • 46
  • 7
1

In ULX, you must check the user's usergroup via table.

Here's an example/What it should be:

function checkULX(ply)
    if table.HasValue({"superadmin", "admin"}, ply:GetNWString("usergroup")) then
        ply:Give("crowbar")
    end
end

This would give the player a crowbar if they are in the ULX group "superadmin" or "admin" when the function is called.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Imperial Knight
  • 51
  • 2
  • 2
  • 7