Hey guy’s I’ve been trying, The key word trying…, To code a swep And I’m wondering If there is a way to make it so that It is the only weapon that you can have, Like if you have it equipped you cannot pick up or purchase anyother t weapons or weapons on the ground. Also If I didn’t mention this is a TTT server yet that hardly matters with this matter, except for the T store. Any help is greatly Appreciated!
If this is on a server, and you’re running ULX, you can use the plugin URS.
That would work for a group but not for a certain weapon, I’m thinking like on the weapons code. If you can do that I don’t see how…
[editline]7th November 2013[/editline]
You can prevent them changing weapons by returning false in the SWEP Holster hook
That should prevent them changing away from the weapon.
If you want to fully prevent them from picking up other weapons, you would need to add hook for PlayerCanPickupWeapon and in that hook check whether their current weapon is your special one, if so return false to prevent pickup.
In an autorun serverside lua file:
[lua]local function PreventWeaponPickups(ply,wep)
if not IsValid(ply) then return end
local curWep = ply:GetActiveWeapon() --get the players current weapon
if not IsValid(curWep) then return end
local wepClass = curWep:GetClass() --get the weapons class
if wepClass==“YOUR_SPECIAL_WEAPON” then --check if their current weapon class matches your special weapons class
return false --prevent them from picking up new weapons
hook.Add(“PlayerCanPickupWeapon”, “My pickup hook”, PreventWeaponPickups)[/lua]
As for preventing purchasing new stuff, I don’t know I’ve never coded for TTT.
This is exactly what I was looking for! thank you both very much!