SA-MP Forums Archive
Jumping to many times... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Jumping to many times... (/showthread.php?tid=298283)



Jumping to many times... - Joshb93 - 20.11.2011

Hello, Im scripting a thing where if you jump to many times in a row, you fall over.. but i cant seem to get it right.. can someone please help me? Like show me how i would set it up correctly?

Thanks,

Josh


Re: Jumping to many times... - Calgon - 20.11.2011

Create a variable and plus 1 to it each time someone uses KEY_JUMP in OnPlayerKeyStateChange, then when it finally reaches the amount of times, apply an animation like the fall_over one to the player.


Re: Jumping to many times... - Joshb93 - 20.11.2011

I did create the variable.. i used PlayerPressedJump, then when i put for when they press it, i put PlayerPressJump++ Is this wrong??


Re: Jumping to many times... - [L3th4l] - 20.11.2011

pawn Код:
new
    PlayerPressedJump[MAX_PLAYERS];

OnKeyStateChange(....)
{
    if(newkeys & KEY_JUMP)
    {
        PlayerPressedJump[playerid] ++;

        if(PlayerPressedJump[playerid] == 5) // change 5 to whatever number of jumps you want
        {
            SetAnimation(an animation of falling down or whatever);
            PlayerPressedJump[playerid] = 0; // Reset the variable
        }
    }
}



Re: Jumping to many times... - Joshb93 - 20.11.2011

OMG! I see where i was messing up.. i wasnt resetting the varialbe PlayerPressedJump[playerid] = 0;

They would fall over, but couldnt get back up..