Hello, I am trying to fix a problem with the detective pointshop code. Whenever you buy it, it doesn't give me body armor. What line of code would I have to add to make it equip? I've tried something like ply:Give("EQUIP_ARMOR") but with no success. Here's the code:
[CODE]ITEM.Name = 'Detective'
ITEM.Price = 800
ITEM.Material = 'VGUI/ttt/sprite_traitor.vmt'
ITEM.OneUse = true
function ITEM:OnEquip(ply, modifications)
hook.Add("TTTBeginRound", ply:UniqueID() .. "_detective", function()
if ply:GetRoleString() != "detective" then
ply:SetRole(ROLE_DETECTIVE)
ply:AddCredits(GetConVarNumber("ttt_credits_starting"))
end
if SERVER then
ply:PS_TakeItem(self.ID)
end
hook.Remove("TTTBeginRound", ply:UniqueID() .. "_detective")
end)
end
function ITEM:OnHolster(ply)
hook.Remove("TTTBeginRound", ply:UniqueID() .. "_detective")
end
function ITEM:OnSell(ply)
hook.Remove("TTTBeginRound", ply:UniqueID() .. "_detective")
end
[/CODE]
Sorry, you need to Log In to post a reply to this thread.