I’m trying to create a gamemode, but there’s a problem whenever people pickup gravity guns, stunsticks or crowbars. If they already have the gun they are trying to pickup from ground, they can still pick it up and there are limited amount of guns on the map, so anyone could steal all the guns and leave rest without.
I’ve tried this piece of code:
function GM:PlayerCanPickupWeapon(ply,wep) if ply:HasWeapon("weapon_physcannon")== true then if wep:GetClass() == "weapon_physcannon" then return false else return true end end return true end
Unfortunatly this still allows players to pickup more gravity guns if they already have one. Any help here? What am I doing wrong?
EDIT: Realized my derp, I had that in shared.lua instead of init.lua. But now I’d like to make them also respawn… hmm let’s see.
EDIT2: I’d kind of like to make it apply to any weapon, the respawn code would be nice to handle it.