SA-MP Forums Archive
Help with the jump ability - 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: Help with the jump ability (/showthread.php?tid=596644)



Help with the jump ability - D1am0nd - 20.12.2015

Hello, I am currently trying to change the jump feature of one class.

Basically, I have a timer of 6 seconds, like when you press a key for a high jump and to use it again, must wait 6 seconds. But I want to be able to use jump like three times and then there would be a timer of 6 seconds to do a high jump.

Here is the code:

PHP код:
if(PRESSED(KEY_JUMP))
     {
         if(
team[playerid] == TEAM_TEST)
         {
              if(
pInfo[playerid][pTESTClass] == TEST)
              {
                  if(
gettime() - Abilitys[playerid][HighJump]) return GameTextForPlayer(playerid,"~w~ Still recovering",1000,5);
                  {
                    new 
Float:x,Float:y,Float:z;
                    
GetPlayerVelocity(playerid,Float:x,Float:y,Float:z);
                    
SetPlayerVelocity(playerid,Float:x*3.0,Float:y*3.0,Float:z+1.01.0);
                    
Abilitys[playerid][HighJump] = gettime();
                }
            }
        }
    } 



Re: Help with the jump ability - zPain - 20.12.2015

PHP код:
if(PRESSED(KEY_JUMP))
{
    if(
team[playerid] == TEAM_TEST)
    {
        if(
pInfo[playerid][pTestClass] == TEST)
        {
            if((
gettime() - Abilitys[playerid][HighJump]) > 6)
            {
                new 
Float:xFloat:yFloat:z;
                
GetPlayerVelocity(playeridxyz);
                
SetPlayerVelocity(playerid, (3.0), (3.0), (1.0));
                
Abilitys[playerid][HighJump] = gettime();
            }
        }
    }