How let jump three times
#1

Hi i made this script that let him jump one time, bat i need make it let hum jump it three times. How need make it?
Код:
	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();
				}
			}
		}
	}
Reply
#2

Create a variable to store how many times a player jumps for instance.

Код:
new jumplimit[MAX_PLAYERS] = 0;
Then, whenever the player jumps just do.

Код:
jumplimit[playerid]++;
To stop them jumping over three times, you can then do:

Код:
if (jumplimit[playerid] > 2)
{
    //Whatever you want here//
}
To reset the limiter, just do:

Код:
jumplimit[playerid] = 0;
Reply
#3

Quote:
Originally Posted by LEOTorres
Посмотреть сообщение
Create a variable to store how many times a player jumps for instance.

Код:
new jumplimit[MAX_PLAYERS] = 0;
Then, whenever the player jumps just do.

Код:
jumplimit[playerid]++;
To stop them jumping over three times, you can then do:

Код:
if (jumplimit[playerid] > 2)
{
    //Whatever you want here//
}
To reset the limiter, just do:

Код:
jumplimit[playerid] = 0;
Well i did what you say and i can't even jump now
Reply
#4

Quote:
Originally Posted by henkas
Посмотреть сообщение
Well i did what you say and i can't even jump now
Make sure you do it in this manner:
Код:
if (jumplimit[playerid] > 2)
{
    //Insert code to prevent jumping
}
else
{
    jumplimit[playerid]++;
}
Or alternatively:

Код:
if (jumplimit[playerid] > 2)
{
    //Insert code to prevent jumping
    return 1;
}

jumplimit[playerid]++;
Reply
#5

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]++;
    }
	}
	}
	}
	}
Reply
#6

Quote:
Originally Posted by henkas
Посмотреть сообщение
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 you are wanting to allow that ability to occur, you would place it in the else statement.

Anything within:
Код:
if (jumplimit[playerid] > 3)
{
}
is what will be triggered if the player exceeds the limit.
Reply
#7

Quote:
Originally Posted by LEOTorres
Посмотреть сообщение
If you are wanting to allow that ability to occur, you would place it in the else statement.

Anything within:
Код:
if (jumplimit[playerid] > 3)
{
}
is what will be triggered if the player exceeds the limit.
Well i don't get what are you saying...
Reply
#8

Quote:
Originally Posted by henkas
Посмотреть сообщение
Well i don't get what are you saying...
Let me know if this works:

Код:
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]++;
				}
			}
		}
	}
}
Reply
#9

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

Quote:
Originally Posted by henkas
Посмотреть сообщение
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.
Try this:

Код:
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]++;

			}
		}
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)