28.08.2011, 06:45
Well I want when a dialog key is pressed, a checkpoint appears. I made that, and the checkpoint appeared. Then when I pick it up, it shows me the message, and the object attaches, but the next checkpoint doesn't appear. I used variables for that, why didn't it work?
This is the code under OnDialogResponse
And under OnPlayerEnterCheckpoint
If someone helps and it works, I'll give reputation of course)
This is the code under OnDialogResponse
pawn Код:
if(Works[playerid] == true) return SendClientMessage(playerid,0xFFFFFFFF,"You took the job already.");
OldSkin[playerid] = GetPlayerSkin(playerid);
Works[playerid] = true; JobAmmount[playerid] = 0; JobCP[playerid] = 1;
SetPlayerCheckpoint(playerid,2230.3528,-2286.1353,14.3751,1.5);
pawn Код:
new string[128]; // Not used
new string2[128]; // Not used
new name[MAX_PLAYER_NAME]; // Not used
if(Works[playerid])
{
if(JobCP[playerid] == 1 && IsPlayerInRangeOfPoint(playerid,2.0,2230.3528,-2286.1353,14.3751))
{
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);
}
if(JobCP[playerid] == 2 && IsPlayerInRangeOfPoint(playerid,2.0,2172.4146,-2255.5405,13.3041))
{
SendClientMessage(playerid,0xFFFFFFFF,"Go back to the previous checkpoint.");
JobAmmount[playerid] ++;
format(string,sizeof(string),"Carried: {228B22}%d",JobAmmount[playerid]);
SendClientMessage(playerid,0xFFFFFFFF,string);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,1,0);
if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
JobCP[playerid] = 1;
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,2230.3528,-2286.1353,14.3751,1.5);
}
}