SA-MP Forums Archive
Help needed. Don`t understand why the checkpoint is not working?! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help needed. Don`t understand why the checkpoint is not working?! (/showthread.php?tid=140646)



Help needed. Don`t understand why the checkpoint is not working?! - sobolanux - 09.04.2010

Okay, I`m working on a little Garbage Truck Driving job and I wonder why when I enter the checkpoint, I don`t get 10 dollars, the check. it`s not destroyed and the next one it`s not appearing .. The code is here

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(GetVehicleModel(vehicleid) == 408)
	{
	  SendClientMessage(playerid, COLOR_GOLD, "A marker should appear on your GPS with the first location! Go get the junk!");
		SetPlayerCheckpoint(playerid, 2286.6111, 2337.5051, 10.6719, 5);
		if(IsPlayerInCheckpoint(playerid))
		{
 			SendClientMessage(playerid, COLOR_GOLD, "Good! You have just earned 10$! Continue your job until this city is clean.");
			GivePlayerMoney(playerid, 10);
			DisablePlayerCheckpoint(playerid);
 			SetPlayerCheckpoint(playerid, 2524.8174, 2318.0769, 10.6719, 5);
 			if(IsPlayerInCheckpoint(playerid))
  			{
  			SendClientMessage(playerid, COLOR_GOLD, "Checkpoint reached, proceed to the next one!");
		    GivePlayerMoney(playerid, 10);
		    DisablePlayerCheckpoint(playerid);
		    return 1;
			}
		return 1;
		}
	return 1;
	}
else SendClientMessage(playerid, COLOR_GOLD, "You must use a Garbage Truck! Go get one!");
return 1;
}



Re: Help needed. Don`t understand why the checkpoint is not working?! - Sascha - 10.04.2010

i actually dont see a mistake..
I would try to delete the if(IsPlayerInCheckpoint) and add that atublic OnPlayerEnterCheckpoint


Re: Help needed. Don`t understand why the checkpoint is not working?! - sobolanux - 10.04.2010

ok. thanks for advice xD


Re: Help needed. Don`t understand why the checkpoint is not working?! - Hiddos - 10.04.2010

You're only checking if the player is in the checkpoint when he enters the vehicle. That's why nothing happens. Use OnPlayerEnterCheckpoint() to check if a player is in a checkpoint