if(PRESSED(KEY_WALK))
{
if(teams[playerid] == TEAM_BLUE)
{
if(pInfo[playerid][pBlueClass] == Test)
{
if(gettime() - 6 < Abilitys[playerid][Time]) 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,Float:y*1.0,Float:z+0.8* 1.2);
Abilitys[playerid][Time] = gettime();
}
}
}
}
new jumplimit[MAX_PLAYERS] = 0;
jumplimit[playerid]++;
if (jumplimit[playerid] > 2)
{
//Whatever you want here//
}
jumplimit[playerid] = 0;
|
Create a variable to store how many times a player jumps for instance.
Код:
new jumplimit[MAX_PLAYERS] = 0; Код:
jumplimit[playerid]++; Код:
if (jumplimit[playerid] > 2)
{
//Whatever you want here//
}
Код:
jumplimit[playerid] = 0; |
if (jumplimit[playerid] > 2)
{
//Insert code to prevent jumping
}
else
{
jumplimit[playerid]++;
}
if (jumplimit[playerid] > 2)
{
//Insert code to prevent jumping
return 1;
}
jumplimit[playerid]++;
if(PRESSED(KEY_WALK))
{
if(teams[playerid] == TEAM_HUMAN)
{
if(pInfo[playerid][pHumanClass] == ROCKETMAN)
{
if(gettime() - 6 < Abilitys[playerid][RocketmanJump]) return GameTextForPlayer(playerid,"~w~ Still recovering",1000,5);
{
if (jumplimit[playerid] > 3)
{
jumplimit[playerid]++;
new Float:x,Float:y,Float:z;
GetPlayerVelocity(playerid,Float:x,Float:y,Float:z);
SetPlayerVelocity(playerid,Float:x,Float:y*1.0,Float:z+0.8* 1.2);
Abilitys[playerid][RocketmanJump] = gettime();
}
else
{
jumplimit[playerid]++;
}
}
}
}
}
|
Hmm now jumping bat just one time not three times. So its didn't work
Код:
if(PRESSED(KEY_WALK))
{
if(teams[playerid] == TEAM_HUMAN)
{
if(pInfo[playerid][pHumanClass] == ROCKETMAN)
{
if(gettime() - 6 < Abilitys[playerid][RocketmanJump]) return GameTextForPlayer(playerid,"~w~ Still recovering",1000,5);
{
if (jumplimit[playerid] > 3)
{
jumplimit[playerid]++;
new Float:x,Float:y,Float:z;
GetPlayerVelocity(playerid,Float:x,Float:y,Float:z);
SetPlayerVelocity(playerid,Float:x,Float:y*1.0,Float:z+0.8* 1.2);
Abilitys[playerid][RocketmanJump] = gettime();
}
else
{
jumplimit[playerid]++;
}
}
}
}
}
|
if (jumplimit[playerid] > 3)
{
}
|
If you are wanting to allow that ability to occur, you would place it in the else statement.
Anything within: Код:
if (jumplimit[playerid] > 3)
{
}
|
new jumplimit[MAX_PLAYERS] = 0;
if(PRESSED(KEY_WALK))
{
if(teams[playerid] == TEAM_HUMAN)
{
if(pInfo[playerid][pHumanClass] == ROCKETMAN)
{
if(gettime() - 6 < Abilitys[playerid][RocketmanJump]) return GameTextForPlayer(playerid,"~w~ Still recovering",1000,5);
{
if (jumplimit[playerid] > 3)
{
SendClientMessage (playerid, -1, "You have already jumped beyond the limit!");
}
else
{
new Float:x,Float:y,Float:z;
GetPlayerVelocity(playerid,Float:x,Float:y,Float:z);
SetPlayerVelocity(playerid,Float:x,Float:y*1.0,Float:z+0.8* 1.2);
Abilitys[playerid][RocketmanJump] = gettime();
jumplimit[playerid]++;
}
}
}
}
}
|
Well all this time i was talking about jump three times at the same time because now its, i jump and still recovering time passed i jump again and still recovering i made it three times and then limit is reached. So it should be like this, i jump three times at same times then its say still recovering, after recovering again i can jump three times. I hope you understand it now. It was my fault, i didn't explain it good.
|
new jumplimit[MAX_PLAYERS] = 0;
if(PRESSED(KEY_WALK))
{
if(teams[playerid] == TEAM_HUMAN)
{
if(pInfo[playerid][pHumanClass] == ROCKETMAN)
{
if(gettime() - 6 < Abilitys[playerid][RocketmanJump]) 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,Float:y*1.0,Float:z+0.8* 1.2);
if (jumplimit[playerid] > 3)
{
Abilitys[playerid][RocketmanJump] = gettime();
jumplimit[playerid] = -1;
}
jumplimit[playerid]++;
}
}
}
}