Thx you very much. It almost works.
I will tell you whats wrong. but this time not with truck loads, but flights.
Код:
enum flightInfo
{
Float:X1,
Float:Y1,
Float:Z1,
From[128],
Flnr[128],
Float:X2,
Float:Y2,
Float:Z2,
To[128],
Money,
Score,
}
new Float:Flight[][flightInfo] =
{
{-1551.1635,-57.9203,14.1440,"San Fierro International Airport","SV-2208",1388.7333,1462.3113,10.8203,"Las Venturas Airport",1000,1},
{-1551.1635,-57.9203,14.1440,"San Fierro International Airport","SS-2210",2049.6538,-2494.1746,13.5469,"Los Santos Airport",2000,1},
{-1551.1635,-57.9203,14.1440,"San Fierro International Airport","SM-2213",401.9291,2509.9182,16.4844,"Verdant Meadows Airport",1500,1}
};
At the end of script I have this to make the flights work.
The problem is that it randomise everything. Lets say it says me SF to LV, but the check points appers in SF and LS. I get other flight cash. :/ What did I did wrong again?
Above is trucker missions thats why else if but trucker have same prob.
Код:
else if(gTeam[playerid] == TEAM_PILOT)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 577 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 511 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 553 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
{
new rand = random(sizeof(Flight));
if(OnMission[playerid] == 1)
{
new obj[256];
SetPlayerCheckpoint(playerid, Flight[rand][X1], Flight[rand][Y1], Flight[rand][Z1], 10);
format(obj, sizeof(obj), "Flight number %s from %s to %s",Flight[rand][Flnr], Flight[rand][From], Flight[rand][To]);
SendClientMessage(playerid, TEAM_PILOT_COLOR, obj);
SendClientMessage(playerid, TEAM_PILOT_COLOR, "Go to the marked airport");
OnMission[playerid] = 2;
}
else if(OnMission[playerid] == 2)
{
SetPlayerCheckpoint(playerid, Flight[rand][X2], Flight[rand][Y2], Flight[rand][Z2], 10);
SendClientMessage(playerid, TEAM_PILOT_COLOR, "Go to the marked destination airport");
OnMission[playerid] = 3;
}
else if(OnMission[playerid] == 3)
{
new reward[256];
DisablePlayerCheckpoint(playerid);
OnMission[playerid] = 0;
format(reward,sizeof(reward), "Delivery completed! You have earned %d$", Flight[rand][Money]);
SendClientMessage(playerid, TEAM_PILOT_COLOR, reward);
GivePlayerMoney(playerid, Flight[rand][Money]);
SetPlayerScore(playerid, GetPlayerScore(playerid)+(Flight[rand][Score]));
}
}
}
return 0;
}