• Jumping Delay
    2 replies, posted
Hi Guys, I need to add a 0.3 second delay between jumping with a player. Do any of you know how I could accomplish this. I want it to happen after the first jump, so jumping in the future cannot be done until this 0.3 timer is up. I would really appreciate any help. Something like [code] timer.Simple(0.3, function() playing jumping code which does someting? xD end) [/code] Thanks, Duby
I would advise storing a variable on the player telling the server when the next time they can jump is - I would do this with something like 'CurTime()' and blocking the command the [URL="http://wiki.garrysmod.com/page/GM/StartCommand"]StartCommand Hook[/URL] For example: [CODE]function LimitPlayerJumping( ply ) if( ( ply.LastJump or 0 ) > CurTime() )then -- Check if the delay is over (you should also check if they are jumping here) -- Code here to stop the player jumping. ply.LastJump = CurTime() + delay -- Set the variable 'LastJump' for the player running the function to the current time plus a delay end end[/CODE]
hmmm this should be a good start for what I need, cheers :)
Sorry, you need to Log In to post a reply to this thread.