19.05.2016, 21:11
if I complete either of these jobs and then go and attempt to complete the other, it will call the wrong checkpoint, it will call the opposite on, i.e Truck will call Pizza if on truck job etc. Could anyone explain why?
pawn Код:
if(checkpointid == TruckCheck[playerid][2])
{
new vehicleid = GetPlayerVehicleID(playerid);
TogglePlayerDynamicCP(playerid,TruckCheck[playerid][2], 0);
RemovePlayerMapIcon(playerid, 0);
RemovePlayerFromVehicle(playerid);
new Float: hth;
new totalamount, danger, damageamount;
GetVehicleHealth(vehicleid, health);
new calc = HaulSelected[playerid] * RandomEx(250, 500);
totalamount += calc;
if(HaulSelected[playerid] == 4)
{
danger = RandomEx(150, 400);
totalamount += danger;
}
if(hth < 950)
{
damageamount = RandomEx(50, 150);
totalamount -= damageamount;
}
format(string, sizeof(string), "_______________Trucking Job_______________");
SendClientMessage(playerid, COLOUR_YELLOW, string);
format(string, sizeof(string), "Route Length: "COL_GREEN"%s", GetRoute(HaulSelected[playerid]));
SendClientMessage(playerid, COLOUR_WHITE, string);
if(hth < 950)
{
format(string, sizeof(string), "As you have incurred damage on the vehicle, there is a penalty of $%s", AddCommas(damageamount));
SendClientMessage(playerid, COLOUR_RED, string);
}
if(HaulSelected[playerid] == 4)
{
format(string, sizeof(string), "You are also entitled to "COL_RED"danger pay"COL_WHITE" as you have been transporting dangerous goods.");
SendClientMessage(playerid, COLOUR_WHITE, string);
format(string, sizeof(string), "Danger Payment: "COL_RED"$%d", danger);
SendClientMessage(playerid, COLOUR_WHITE, string);
}
format(string, sizeof(string), "Payment: "COL_GREEN"$%s", AddCommas(totalamount));
SendClientMessage(playerid, COLOUR_WHITE, string);
PlayerMoney[playerid] += totalamount;
GivePlayerMoney(playerid, totalamount);
SetVehicleToRespawn(vehicleid);
TruckCooldown[playerid] = 60;
MySQL_SetInteger(PlayerSQLID[playerid], "TruckCooldown" , 60, "accounts");
}
pawn Код:
else if(checkpointid == PizzaCheck[playerid][1])
{
format(string, sizeof(string), "Pizza Delivery Job: "COL_WHITE"Well done! You have earned a total of "COL_GREEN"$%s on this job.", AddCommas(PizzaTips[playerid]));
SendClientMessage(playerid, COLOUR_REALRED, string);
DestroyDynamicCP(PizzaCheck[playerid][1]);
RemovePlayerMapIcon(playerid, 0);
PlayerMoney[playerid] += PizzaTips[playerid];
GivePlayerMoney(playerid, PizzaTips[playerid]);
SetVehicleToRespawn(PizzaBikeID[playerid]);
PizzaCooldown[playerid] = 60;
PizzaJob[playerid] = 0;
PizzaBikeID[playerid] = -1;
PizzaAmount[playerid] = 0;
PizzaTips[playerid] = 0;
RemovePlayerFromVehicle(playerid);
new skin = GetPlayerSkinEx(playerid);
SetPlayerSkin(playerid, skin);
MySQL_SetInteger(PlayerSQLID[playerid], "PizzaCooldown" , 60, "accounts");
for(new x = 0; x < 3; x++)
{
DestroyDynamicCP(PizzaCheck[playerid][x]);
}
}