18.11.2016, 11:14
So I am creating this import system, similar to the Single Player. But I have no idea on how would I generate a random vehicle model ID (avoiding selecting an invalid ID, boat, planes, trains)
This is how I coded the Import System.
gBonusModel is where the vehicle model ID is stored.
This is how I coded the Import System.
PHP код:
// Timer
if(EIsystem[0][gBonusModel])
{
if(!EIsystem[0][gGotBonus])
{
format(string, sizeof(string), "[EASTER BASIN]"white" %dx %s hasn't been imported to %s (There are %d still needed %s to get it shipped to %s).", EIsystem[0][gRequiredBonus], GetVehicleNameEx(EIsystem[0][gBonusModel]), EILocations[EIsystem[0][gAssignedLocation]], EIsystem[0][gRequiredBonus] - EIsystem[0][gDeliveredBonus], GetVehicleNameEx(EIsystem[0][gBonusModel]), EILocations[EIsystem[0][gAssignedLocation]]);
if(!closestdepot)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
SendClientMessage(playerid, "[SHIPMENT NOTICE]"white" A new required vehicle imports will arrive shortly, Please wait until furthermore notice.");
}
printf("* The shipment of %s from Easter Basin to %s has been cancelled due to lack of %d more %s.", GetVehicleNameEx(EIsystem[0][gBonusModel]), EILocations[EIsystem[0][gAssignedLocation]], EIsystem[0][gRequiredBonus] - EIsystem[0][gDeliveredBonus], GetVehicleNameEx(EIsystem[0][gBonusModel]));
EIsystem[0][gAssignedLocation] = -1;
EIsystem[0][gRequiredBonus] = 0;
EIsystem[0][gBonusModel] = 0;
EIsystem[0][gBonusMoney] = 0;
EIsystem[0][gDeliveredBonus] = 0;
}
}
else
{
if(!closestdepot)
{
EIsystem[0][gAssignedLocation] = random(sizeof(EIlocations));
EIsystem[0][gRequiredBonus] = Random(2, 5);
EIsystem[0][gBonusModel] = 0;
EIsystem[0][gBonusMoney] = 0;
EIsystem[0][gDeliveredBonus] = 0;
format(string, sizeof(string), "[EASTER BASIN]"white" We need volunteers who will give away their %s, We current need %dx of them. ($%s overall reward pot)", GetVehicleNameEx(EIsystem[0][gBonusModel]), EIsystem[0][gRequiredBonus], AddComma(EIsystem[0][gBonusCash]));
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "* The vehicles are to be imported to %s.", EIsystem[0][gRequiredBonus]));
SendClientMessage(playerid, -1, string);
}
}