SA-MP Forums Archive
Super jump and fall damage, help please :) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Super jump and fall damage, help please :) (/showthread.php?tid=229262)



Super jump and fall damage, help please :) - Randomai - 21.02.2011

Making zombie server, and i want zombies can make single super jump by pressing their jump-key.i want that they wont take fall damage.any ideas how to do that?


this is code for jump, but if i press jump whole time, i can fly.


Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_JUMP) {
        new
            Float: vX,
            Float: vY,
            Float: vZ;
        GetPlayerVelocity(playerid, vX, vY, vZ);
        SetPlayerVelocity(playerid, vX, vY,  1);
    }
    return 1;
}
and need help with fall damage


Re: Super jump and fall damage, help please :) - jameskmonger - 21.02.2011

Before jump: GetPlayerHealth
5 seconds or so after jump: SetPlayerHealth


Re: Super jump and fall damage, help please :) - Randomai - 21.02.2011

i get the idea, but how to do it?


Re: Super jump and fall damage, help please :) - jameskmonger - 21.02.2011

When they jump, get their health and set a boolean indicating they have just jumped. In OnPlayerUpdate, check if the boolean is true and if it is AND their health is lower than what it used to be, set their health to what it used to be and set the justjumped boolean to false.


Re: Super jump and fall damage, help please :) - Randomai - 21.02.2011

so hard .Is there any command like:


Код:
{
if(PlayerTeam[playerid] == 1)
SetPlayerFallDamage(playerid, 0)
}

anohter question, how to make zombie run faster?this is my code for jump, so how to make it for sprint?
Код:
{
    if(PlayerTeam[playerid] == 1)
	if(newkeys & KEY_JUMP) {
        new
            Float: vX,
            Float: vY,
            Float: vZ;
        GetPlayerVelocity(playerid, vX, vY, vZ);
        SetPlayerVelocity(playerid,0.0,0.0,0.2);
    }
    return 1;
}