30.03.2013, 13:33
Hello and thank you for taking a look at the topic. I have scripted a pizza boy job and facing some issues which I cannot fix and I need your help. The problem is when the player starts the job the pickup is shown on the minimap, but when he goes at it, the pickup dissapears without showing the next or giving the player cash. Codes used:
Command:
OnPlayerEnterCheckpoint:
IsPizzaBike stock:
Command:
pawn Код:
CMD:startdelivery(playerid, params[])
{
new vid = GetPlayerVehicleID(playerid);
if(!IsPlayerLoggedIn(playerid)) return SCM(playerid, COLOR_GREY, "You need to be logged in to use commands.");
if(!IsPizzaBike(vid)) return SCM(playerid, COLOR_GREY, "You are not in a Pizza Boy bike.");
if(!IsPlayerInRangeOfPoint(playerid, 2, 2099.4939,-1784.9034,13.3983)) return SCM(playerid, COLOR_GREY, "You cannot start a delivery here.");
if(PlayerInfo[playerid][pJob] != JOB_PBOY && PlayerInfo[playerid][pVJob] != JOB_PBOY) return SCM(playerid, COLOR_GREY, "You are not a pizza boy.");
if(Deliverying[playerid]) return SCM(playerid, COLOR_GREY, "You are already deliverying pizza.");
else
{
Deliverying[playerid] = 1;
new randomp = random(sizeof(DelCp));
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, DelCp[randomp][0], DelCp[randomp][1], DelCp[randomp][2], 4);
SCM(playerid, COLOR_WHITE, "You have started deliverying pizza.");
}
return 1;
}
pawn Код:
if(Deliverying[playerid])
{
new vid = GetPlayerVehicleID(playerid);
if(IsPizzaBike(vid))
{
new cash = (random(35-10)+10);
Deliverying[playerid] += 1;
DisablePlayerCheckpoint(playerid);
GiveMoney(playerid, cash*5);
new randomss = random(sizeof(DelCp));
SetPlayerCheckpoint(playerid, DelCp[randomss][0], DelCp[randomss][1], DelCp[randomss][2], 4);
if(Deliverying[playerid] == 6)
{
SCM(playerid, COLOR_WHITE, "You have successfully finished your delivery.");
DisablePlayerCheckpoint(playerid);
Deliverying[playerid] = 0;
}
}
else
{
SCM(playerid, COLOR_GREY, "This is a not a pizza bike. (Route canceled)");
DisablePlayerCheckpoint(playerid);
Deliverying[playerid] = 0;
}
}
pawn Код:
stock IsPizzaBike(vehicleid)
{
for(new i = 0; i < sizeof(pbike); i++)
{
if(vehicleid == pbike[i]) return 1;
}
return 0;
}