Anti-weapon spawning script

I’m asking for a script that disallows the spawning of weapons by players, no matter what user group they are in, maybe a feature that allows certain users to spawn guns, but no one else except the user(s) allowed by the superadmin. Can anyone make it for me?



Note: Please read the ULX commands list. This is all completely possible with ULX. Please Google or search before making request.

I can make you a script really quick that will only let certain steamIDs spawn guns if that is what you want


Well he didnt deliver, here you go. :v:
[lua]local whitelist = {“STEAM_0:0:19321794”, “STEAM_0:0:SomeOtherGuy”}

function WeaponSpawn(ply)
return table.HasValue(whitelist, ply:SteamID())
hook.Add(“PlayerGiveSWEP”, “WeaponGiving”, WeaponSpawn)
hook.Add(“PlayerSpawnSWEP”, “WeaponSpawning”, WeaponSpawn)

And yes that is my SteamID in the table along with a non existant one.

As a rule of thumb, you shouldn’t return true, because that will prevent other hooks from running. It could also be optimized a bit more, to make it run faster.
local whitelist = {
[“STEAM_0:0:19321794”] = true,
[“STEAM_0:0:87654321”] = true,
[“STEAM_0:0:12345678”] = true

local function spawn(ply)
if(whitelist[ply:SteamID()]) then
return true;

hook.Add(“PlayerGiveSWEP”, “Weapon giving”, spawn);
hook.Add(“PlayerSpawnSWEP”, “Weapon spawning”, spawn);

In yours i could still spawn a gun because you dont return false (and yes i have tested your script), i returned false so it actually became an anti weapon spawning script and returned true so incase he installs something that does return false (which would make your script work) whitelisted players would still be able to spawn weapons.

Correct me if i am wrong