SA-MP Forums Archive
Any way to disable player jumping if anything? - 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: Any way to disable player jumping if anything? (/showthread.php?tid=542098)



Any way to disable player jumping if anything? - [LvZ]Free - 16.10.2014

I currently have a function witch does blah blah.. and i need to way if this fuction is active, like uhm lets say the player under the effect of animation to disable jumping. (but i need the animation run anyways)


Re: Any way to disable player jumping if anything? - austin070 - 16.10.2014

The only way to do it is to reset the special action on the jump key (KEY_JUMP). This will stop you from sprinting if you press jump while you're sprinting, however.


Re: Any way to disable player jumping if anything? - Abagail - 16.10.2014

You can do something like this,

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_JUMP)
    {
         if(Disabled[playerid])
         {
            new Float: pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            ClearAnimations(playerid);
            return 1;
        }
   }
return 1;
}
Note it would clear the running animation, - how-ever you could apply a running animation in place using ApplyAnimation for a few seconds.