Hello!
I'm working in a TTT server and I have a questioN.
Can I deny the drop weapon in the pointshop?
[QUOTE]ITEM.Name = 'USP40'
ITEM.Price = 250
ITEM.Model = 'models/weapons/w_fire_zir.mdl'
ITEM.WeaponClass = 'weapon_usp40'
ITEM.SingleUse = falseITEM.AllowedUserGroups = {"boss", "superadmin", "admin", "moderador+", "vip"}
function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end
function ITEM:OnEquip(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
function ITEM:OnHolster(ply)
ply:StripWeapon(self.WeaponClass)
end
local function PlayerLoadout ( ply )
ply:Give(self.WeaponClass)
endLoadout ( ply )
ply:Give(self.WeaponClass)
end[/QUOTE]
PD: Bad English, sorry.
If you meant dropping in game, you would need separate hooks to prevent a player from dropping a weapon.
Look into TTT's code and see where they run a check to drop weapon, usually in a serverside lua file. I do not write for TTT so I do not know which hook it is, but there should be some sort of documentary somewhere.
How do you mean deny weapon drop.
If you don't want the weapon to be able to be removed from the player until they die, then do this:
[CODE]SWEP.AllowDrop = false[/CODE]
If you want to make it so that the player can get rid of it, but then it is no longer able to be picked up, do this:
[CODE]function SWEP:OnDrop()
self:Remove()
end[/CODE]
The functionaitly for these is found in [URL="https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/terrortown/entities/weapons/weapon_tttbase.lua"]TTT weapon base[/URL]
If you mean make it so that through the use of the pointshop, you would probably need to edit the pointshop itself.
Sorry, you need to Log In to post a reply to this thread.