Hello.
I have a jump pack on my server, currently when you have it equiped it will let you fly non stop.
I want it to have a cooldown, lets say you can "fly" for 5 seconds and then you need to wait 10/20 secs till you can fly again.
Basically nerf it a bit.
Here is the code for it:
[code]ITEM.Name = 'Jump Pack'
ITEM.Price = 50000
ITEM.Model = 'models/xqm/jetengine.mdl'
ITEM.Bone = 'ValveBiped.Bip01_Spine2'
ITEM.EffectEnabled = true
ITEM.SoundEnabled = false
ITEM.VelocityMultiplier = 10
function ITEM:OnEquip(ply, modifications)
ply:PS_AddClientsideModel(self.ID)
ply:SetGravity(0.4)
end
function ITEM:OnHolster(ply)
ply:PS_RemoveClientsideModel(self.ID)
ply:SetGravity(1)
end
function ITEM:ModifyClientsideModel(ply, model, pos, ang)
model:SetModelScale(0.5, 0)
pos = pos + (ang:Right() * 7) + (ang:Forward() * 6)
return model, pos, ang
end
function ITEM:Think(ply, modifications)
if SERVER then
if ply:KeyDown(IN_JUMP) then
ply:SetVelocity(ply:GetUp() * self.VelocityMultiplier)
end
end
end
[/code]
And I have another issue with it:
When you touch a ladder you can not fly any longer, why? :I
Thank you for reading!
You could use[CODE] timer.Simple(interval, function, argument)[/CODE] to set the Player's gravity, see [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index93f1.html"]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index93f1.html[/URL]
It mainly only works with low gravity.
Sorry, you need to Log In to post a reply to this thread.