28.08.2011, 06:59
As long as you don't have any other scripts using checkpoints the variables should be fine alone. There's no need to keep up with what checkpoint they are on and check if they are in range. Either or but not both. Try this out.
I'm pretty sure it wasn't working because you set JobCP equal to 2 then you don't return so it just checks the next statement to see if it's equal to 2 and it is.
pawn Код:
new string[128]; // Not used
new string2[128]; // Not used
new name[MAX_PLAYER_NAME]; // Not used
if(Works[playerid])
{
switch(JobCP[playerid])
{
case 1:
{
SendClientMessage(playerid,0xFFFFFFFF,"Take it to the checkpoint.");
JobCP[playerid] = 2;
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,2172.4146,-2255.5405,13.3041,1.5); // THIS ONE IS NOT BEING SET
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
SetPlayerAttachedObject(playerid, 1 , 2060, 1,0.11,0.36,0.0,0.0,90.0);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
return 1;
}
case 2:
{
SendClientMessage(playerid,0xFFFFFFFF,"Go back to the previous checkpoint.");
JobAmmount[playerid] ++;
format(string,sizeof(string),"Carried: {228B22}%d",JobAmmount[playerid]);
SendClientMessage(playerid,0xFFFFFFFF,string);
if(IsPlayerAttachedObjectSlotUsed(playerid,1))
RemovePlayerAttachedObject(playerid,1);
JobCP[playerid] = 1;
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,1,0);
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,2230.3528,-2286.1353,14.3751,1.5);
return 1;
}
}
}