Race checkpoint help
#1

Код:
  if (strcmp(cmd, "/setatv", true)==0)
	{
		if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "KORISTITE: /setatv [IgracevID/DioImena]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pEventMember] == 1)
			{
				if(IsPlayerConnected(giveplayerid))
				{
					SetPlayerRaceCheckpoint(playerid, 0, -1903.8059,-2425.9177,31.2977, -1707.7430,-2301.0586,44.7366, 10);
       		Status[giveplayerid] = 1;
					GetPlayerName(playerid, sendername, sizeof(sendername));
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					format(string, sizeof(string), "ATV ORGANIZATOR %s je pozvao %s na ATV Race!", sendername, giveplayer);
					SendClientMessageToAll(COLOR_LIGHTRED, string);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, " Niste autorizirani za koristenje ove komande !");
			}
		}
		return 1;
	}
Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
	if (IsPlayerInCheckpoint(playerid))
 	{
		if(Status[playerid] == 1)
 		{
  		DisablePlayerRaceCheckpoint(playerid);
   		SetPlayerRaceCheckpoint(playerid, 0, -1707.7430,-2301.0586,44.7366, -1687.8019,-2110.9001,37.9219, 10);
    	Status[playerid] = 2;
    }
    if(Status[playerid] == 2)
    {
    	DisablePlayerRaceCheckpoint(playerid);
     	SetPlayerRaceCheckpoint(playerid, 0, -1687.8019,-2110.9001,37.9219, -1938.1582,-2082.5066,64.6393, 10);
     	Status[playerid] = 3;
    }
    if(Status[playerid] == 3)
    {
    	DisablePlayerRaceCheckpoint(playerid);
     	SetPlayerRaceCheckpoint(playerid, 0, -1938.1582,-2082.5066,64.6393, -1910.4208,-1933.2887,82.1451, 10); //so it looks down
     	Status[playerid] = 4;
    	}
    if(Status[playerid] == 4)
    {
 		  DisablePlayerRaceCheckpoint(playerid);
    	SetPlayerRaceCheckpoint(playerid, 0, -1910.4208,-1933.2887,82.1451, -1649.9202,-1901.3309,90.0945, 10); //so it looks down
     	Status[playerid] = 5;
    	}
    if(Status[playerid] == 5)
    {
   		DisablePlayerRaceCheckpoint(playerid);
	 		SetPlayerRaceCheckpoint(playerid, 0, -1649.9202,-1901.3309,90.0945, -1504.0736,-1789.0613,53.7451, 10); //so it looks down
 		 	Status[playerid] = 6;
   	}
    	if(Status[playerid] == 6)
    	{
   		DisablePlayerRaceCheckpoint(playerid);
   	 	SetPlayerRaceCheckpoint(playerid, 0, -1504.0736,-1789.0613,53.7451, -1385.3934,-2037.6733,2.8500, 10); //so it looks down
      Status[playerid] = 7;
    }
    if(Status[playerid] == 7)
    {
   	  DisablePlayerRaceCheckpoint(playerid);
	  	SetPlayerRaceCheckpoint(playerid, 0, -1385.3934,-2037.6733,2.8500, -1339.0548,-2178.6096,21.0252, 10); //so it looks down
      Status[playerid] = 8;
    }
    if(Status[playerid] == 8)
    {
  	 		DisablePlayerRaceCheckpoint(playerid);
 		 	SetPlayerRaceCheckpoint(playerid, 0, -1339.0548,-2178.6096,21.0252, -1546.3350,-2154.8752,7.9989, 10); //so it looks down
  	 		Status[playerid] = 9;
    }
    if(Status[playerid] == 9)
    {
  	 		DisablePlayerRaceCheckpoint(playerid);
 		 	SetPlayerRaceCheckpoint(playerid, 0, -1546.3350,-2154.8752,7.9989, -1676.7329,-2241.9336,35.1836, 10); //so it looks down
  	 	Status[playerid] = 10;
    }
    if(Status[playerid] == 10)
    {
   		DisablePlayerRaceCheckpoint(playerid);
		 	SetPlayerRaceCheckpoint(playerid, 0, -1676.7329,-2241.9336,35.1836, -1908.9034,-2427.6821,30.8202, 10); //so it looks down
 	 		Status[playerid] = 11;
 	 	}
   	if(Status[playerid] == 11)
   	{
  	 		DisablePlayerRaceCheckpoint(playerid);
   		SetPlayerRaceCheckpoint(playerid, 1, -1908.9034,-2427.6821,30.8202, -1908.9034,-2427.6821,30.8202, 10); //so it looks down
    	Status[playerid] = 12;
    }
    	if(Status[playerid] == 12)
    	{
    	new string[128];
		 	new name[MAX_PLAYER_NAME];
   		DisablePlayerRaceCheckpoint(playerid);
	   	Status[playerid] = 0;
  		 	GetPlayerName(playerid, name, sizeof(name));
		 	format(string, sizeof(string), "ATV Race : %s je upravo zavrsio ATV Race. ", name);
   		SendClientMessageToAll(COLOR_LIGHTRED, string);
    	}
  }
  return 1;
}
I defined status,sets me to first checkpoint,but it won't switch forward(to next checkpoint)
What am i doing wrong??Can someone help me??
PS.When i am compiling gamemode,i don't have any errors or warnings...
Reply
#2

Someone plizz help me i need this...
Reply
#3

Why do you check if (IsPlayerInCheckpoint(playerid)) ? And does you checkpoint disappear when you enter it?
Reply
#4

Quote:
Originally Posted by MadeMan
Why do you check if (IsPlayerInCheckpoint(playerid)) ? And does you checkpoint disappear when you enter it?
Nope,it just stays where it is,i readed somewhere that it needs to be there...
Could you help me or redifine my code to work please??
Reply
#5

I would remove the IsPlayerInCheckpoint, but I'm not sure this will fix it.
Reply
#6

Quote:
Originally Posted by MadeMan
I would remove the IsPlayerInCheckpoint, but I'm not sure this will fix it.
It won't help EVEN a bit...
Can someone give me deam toturial for making races with Race Checkpoints??Thanks...
Reply
#7

Quote:
Originally Posted by shithead
Quote:
Originally Posted by MadeMan
I would remove the IsPlayerInCheckpoint, but I'm not sure this will fix it.
It won't help EVEN a bit...
Can someone give me deam toturial for making races with Race Checkpoints??Thanks...
Did u even try it? You shoul'dnt really need to check if the player is in a checkpoint since the OnPlayerEnterRaceCheckpoint callback is called when the player enters the race checkpoint.

You're on the right tracks i think, never worked with race checkpoints before. If you look carefully, you'll realise the correct function for race checkpoints is IsPlayerInRaceCheckpoint not IsPlayerInCheckpoint which is for normal checkpoints. Try that.
Reply
#8

Also add 'return 1;' at the end of the status switch, this keeps it from going on to the next 'if' statement. Also the 'IsPlayerInCheckpoint' is completely useless in that function, since the only way to call OnPlayerEnterCheckoint is to be in a checkpoint... right?
Reply
#9

Quote:
Originally Posted by Joe Staff
Also add 'return 1;' at the end of the status switch, this keeps it from going on to the next 'if' statement. Also the 'IsPlayerInCheckpoint' is completely useless in that function, since the only way to call OnPlayerEnterCheckoint is to be in a checkpoint... right?
I added it,but that doesn't matter the problem of checkpoint staying when you enter in it...
Reply
#10

Well like Hustler said, Are you using Race Checkpoints? I guess they're different.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)