Help making pointshop item only equipable once per ttt round
6 replies, posted
We are starting a new category of pointshop items in ttt called perks, one will give you short jump boosts and a few will upgrade certain detective or traitor items.
What can I add to limit the players to one respec per round? Otherwise point rich players will just buy all of the perks and switch between several powers throughout the round.
Here is one example of the code I want to edit..
[CODE]
ITEM.Name = 'Jet Pack'
ITEM.Price = 10000
ITEM.Model = 'models/xqm/jetengine.mdl'
ITEM.Bone = 'ValveBiped.Bip01_Spine2'
ITEM.Material = 'trails/smoke.vmt'
ITEM.AllowedUserGroups = { "operator", "admin", "superadmin", "subscriber", "superscriber", "goatking", "2d", "raincoat", "custom", "hegemon", "member", "sponsor", "testmod"}
function ITEM:OnEquip(ply, modifications)
ply.RocketTrail = util.SpriteTrail(ply, 0, modifications.color, false, 15, 1, 4, 0.125, self.Material)
ply:PS_AddClientsideModel(self.ID)
end
function ITEM:OnHolster(ply)
SafeRemoveEntity(ply.RocketTrail)
ply:PS_RemoveClientsideModel(self.ID)
end
function ITEM:ModifyClientsideModel(ply, model, pos, ang)
model:SetModelScale(0.3, 0)
pos = pos + (ang:Right() * 7) + (ang:Forward() * 6)
return model, pos, ang
end
function ITEM:OnModify(ply, modifications)
SafeRemoveEntity(ply.RocketTrail)
self:OnEquip(ply, modifications)
end
function ITEM:Think(ply, modifications)
if ply:KeyDown(IN_JUMP) then
ply:SetVelocity(ply:GetUp() * 14)
end
if ply:KeyPressed(IN_USE) then
ply:SetVelocity(ply:GetUp() * 275)
end
end[/CODE]
First of all, those spaces are utterly useless and bug the crap out of me.
Second, set a variable that only resets on TTTBeginRound
[QUOTE=Nookyava;43840089]First of all, those spaces are utterly useless and bug the crap out of me.[/QUOTE]
they separate my ideas
[QUOTE=Nookyava;43840089]Second, set a variable that only resets on TTTBeginRound[/QUOTE]
I don't know how to do that. I imagine hooks are involved but beyond that I'm lost.
[lua]hook.Add("TTTBeginRound", "reset.ourvariable", function()
for _, plys in ipairs(player.GetAll()) do
plys.CanChange = true
end
end)[/lua]
Then just call CanChange whenever they try to equip a new one.
[QUOTE=Nookyava;43840688][lua]hook.Add("TTTBeginRound", "reset.ourvariable", function()
for _, plys in ipairs(player.GetAll()) do
plys.CanChange = true
end
end)[/lua]
Then just call CanChange whenever they try to equip a new one.[/QUOTE]
Where do I put that hook?
Google the hook.
Ah, very good! Thanks so much it works perfectly!
Sorry, you need to Log In to post a reply to this thread.