17.08.2018, 17:19
I'm trying to store load name and load pay in pvars since i can't use them in different stocks:
This is the 1st stock where i set pvars:
And this is the 2nd where i retrieve them using getpvar:
Problem is: DeliverPay shows correct ammount of money earned, truckloadname pvar no. It shows: Kinder_Clans delivered 66 and earned "money ammount".
Why?
This is the 1st stock where i set pvars:
pawn Код:
stock StartTruckerJob(playerid)
{
MissionStatus[playerid] = 1;
Player[playerid][Delivering] = true;
new MisRand = random(sizeof(TruckerDeliveries));
new Float:x, Float:y, Float:z;
x = TruckerDeliveries[MisRand][LoadX];
y = TruckerDeliveries[MisRand][LoadY];
z = TruckerDeliveries[MisRand][LoadZ];
unx[playerid] = TruckerDeliveries[MisRand][UnloadX];
uny[playerid] = TruckerDeliveries[MisRand][UnloadY];
unz[playerid] = TruckerDeliveries[MisRand][UnloadZ];
iPay[playerid] = TruckerDeliveries[MisRand][Pay];
SetPlayerCheckpoint(playerid, x, y, z, 7);
SendClientMessage(playerid, -1, "* Trucker job "GREEN"started. "WHITE"Type "RED"/stopwork "WHITE"to stop delivering items.");
new String[125];
format(String, sizeof(String), "* Deliver "ORANGE_RED"%s "WHITE"| Earnings: "GREEN"%s", TruckerDeliveries[MisRand][LoadName], formatInt(TruckerDeliveries[MisRand][Pay]));
SendClientMessage(playerid, -1, String);
SetPVarInt(playerid, "TruckLoadName", TruckerDeliveries[MisRand][LoadName]);
SetPVarInt(playerid, "DeliverPay", TruckerDeliveries[MisRand][Pay]);
return 1;
}
pawn Код:
stock UnLoadTruck(playerid)
{
TogglePlayerControllable(playerid,1);
Player[playerid][Delivering] = false;
DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, iPay[playerid]);
SetMoneyInfo(playerid, iPay[playerid], true, 2000);
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
Player[playerid][Deliveries] ++;
Player[playerid][EarnedFromDeliveries] += iPay[playerid];
SendNearbyMessage(playerid, 30.0, -1, "* "ORANGE_RED"%s (%d) "WHITE"delivered "ORANGE_RED"%d "WHITE"and earned "GREEN"%s.", ReturnPlayerName(playerid), playerid, GetPVarInt(playerid, "TruckLoadName"), GetPVarInt(playerid, "formatInt(DeliverPay)"));
new string[100];
format(string, sizeof(string), "Delivery completed. Earned ~g~%s.", formatInt(iPay[playerid]));
ShowPlayerFooter(playerid, string);
MissionStatus[playerid] = 0;
return 1;
}
Why?