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.
ITEM.Name = 'Jump Pack' ITEM.Price = 50000 ITEM.Model = 'models/xqm/jetengine.mdl' ITEM.Bone = 'ValveBiped.Bip01_Spine2' ITEM.EffectEnabled = true ITEM.SoundEnabled = false function ITEM:OnEquip(ply, modifications) ply:PS_AddClientsideModel(self.ID) ply:SetGravity(1) 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) end end end
i was thinking of putting
if ply:KeyDown(IN_JUMP) then ((start timer here)) if ((timer value)) < 1 then ply:SetGravity(1) end if ((timer value)) > 1 then ply:SetGravity(.25) timer.Simple(3, function(ply) ply:SetGravity(1) end ) ((this would theoretically give the user a buffer time to reactivate the jump pack so they don't immediately fall to their death)) end end
or something like that… maybe… i don’t know. I am just a beginner at this coding stuff :[
Also, it would be cool if someone could tell me how to set it so that once I move someone into the user group they automatically get a jump pack, that would be fantastic.