23.11.2012, 10:21
Ok, I have a problem When i enter my first checkpoint the code works perfectly but when i go to the second checkpoint it fucks up and dosn't load the next or disable heres the code.
pawn Код:
//top of the script
new Float:RandomTruckSpawn[][3] =
{
// Positions, (X, Y, Z)
{1362.2135,-1658.5692,13.4981},
{2167.5745,-2274.1719,13.4780},
{2726.4849,-2001.0597,13.5520}
};
//checkpoints
public OnPlayerEnterCheckpoint(playerid)
{
new rand = random(sizeof(RandomTruckSpawn));
if(IsPlayerInRangeOfPoint(playerid, 2.0, 797.7545,-610.6182,16.4326))
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, RandomTruckSpawn[rand][0], RandomTruckSpawn[rand][1],RandomTruckSpawn[rand][2], 3.0);
}
if(IsPlayerInRangeOfPoint(playerid, 2.0, RandomTruckSpawn[rand][0], RandomTruckSpawn[rand][1],RandomTruckSpawn[rand][2]))
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 2470.6523,-2089.7607,13.6471, 3.0);
PlayerInfo[playerid][pCheckPoint] = 3;
}
if(IsPlayerInRangeOfPoint(playerid, 2.0, 2470.6523,-2089.7607,13.6471))
{
new string[128];
new string1[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 797.7545, -610.6182, 16.4326, 3.0);
PlayerInfo[playerid][pCheckPoint] = 0;
PlayerInfo[playerid][pCheck] = PlayerInfo[playerid][pCheck] +500;
format(string, sizeof(string), "You now have a total of %d in cheques. Go cash them at the bank.", PlayerInfo[playerid][pCheck]);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "Congratz, Job complete Head to the checkpoint to Redo your Route.");
format(string1,sizeof(string1),"%s now has a total of %d in cheques.", name, PlayerInfo[playerid][pCheck]);
SendMessageToHDutyAdmins(COLOR_ORANGE, string1);
}
return 1;
}