Made a dandy little perma wep for PointShop...
[code]
ITEM.Name = 'PERMA TEST'
ITEM.Price = 0
ITEM.Model = 'models/weapons/w_pist_deagle.mdl'
ITEM.WeaponClass = 'weapon_zm_revolver_perm'
ITEM.SingleUse = false
ITEM.AllowedUserGroups = { "owner" }
function ITEM:OnEquip(ply)
if ply:IsSpec() then
return
end
local allWeps = ply:GetWeapons() -- get all the weapons the player has
ply:ChatPrint(#ply:GetWeapons())
for k, v in pairs( allWeps ) do -- loop through them
ply:ChatPrint(v:GetClass())
ply:ChatPrint(v:GetSlot())
if v:GetSlot() == 1 then
ply:ChatPrint("WEAPON FOUND IN SLOT 2")
ply:ChatPrint(v:GetClass())
ply:StripWeapon(v:GetClass())
end
end
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end
function ITEM:OnHolster(ply)
ply:StripWeapon(self.WeaponClass)
end
[/code]
Whenever the slot check happens, all the weapons return 0. Any reason for this?
Any help would be appreciated!
[QUOTE=Moat;51687470]In TTT, the Slot variable for weapons is only available on the client. However, there is the Kind variable that is shared and practically does the same thing. Here's a list of them for reference:
[code]
Kinds of Weapons (Can only carry one of each)
WEAPON_MELEE = 1
WEAPON_PISTOL = 2
WEAPON_HEAVY = 3
WEAPON_NADE = 4
WEAPON_CARRY = 5
WEAPON_EQUIP1 = 6
WEAPON_EQUIP2 = 7
WEAPON_ROLE = 8
[/code][/QUOTE]
AH! Thank you so much!
Sorry, you need to Log In to post a reply to this thread.