• Trying to change the Jump Pack lua addon
    0 replies, posted
Okay what I am trying do is add a bit of coding to the think function that would basically differentiate between a quick press and a long press. That way I can still have a bunny hop, but if I hold down the jump key then it sets the gravity to .25 until i let go, when i let off the key it will then use some sort of two or three second counter that keeps it at .25 before it resets the gravity back to 1. That way I have a little bit of a buffer zone between the two settings. Is that possible? This is what I have now which enables the bunny hop. [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) 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:SetGravity(0.25) else ply:SetGravity(1) end end end[/CODE]
Sorry, you need to Log In to post a reply to this thread.