Jumping to many times...
#1

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
Reply
#2

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.
Reply
#3

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

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
        }
    }
}
Reply
#5

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)