// 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);
}
}
stock RandomVehicle(vehicleid)
{
switch(random(10))
{
case 0:
{
vehicleid = 560;
}//Choose the vehicle id's you want to include
case 1: // etc.
}
}
RandomVehicle(EIsystem[0][gBonusModel]);
new model; generate_model: model = random(211) + 400; if (model == 519) goto generate_model; //if the vehicle is Shamal (just an example) then generate a new model
new model = random(211) + 400; while (modelid == 519) //it will keep generating a new model if the model is a Shamal { model = random(211) + 400; }
stock IsACar(modelid)
{
switch(modelid)
{
case 0 .. 400, 611 .. 1000, // Wrong vehicle ID
417, 425, 447, 460, 469, 476, 487, 488, 497, 511 .. 513, 519, 520, 548, 553, 563, 577, 592, 593, // Plane & Helicopters
430, 446, 452, 453, 454, 472, 473, 484, 483, 595, // Boats
435, 441, 449, 450, 464, 465, 501, 537, 538, 539, 545, 564, 569 .. 572, 583, 584, 590, 591, 594, 606, 607, 608, 610 : return false; // Others (RC, trailer, etc..)
default : return true;
}
return true;
}
GetRandomModelCar(vehicleid)
{
static a;
do
{
a = random(211) + 400;
}
while(!IsACar(a));
return a;
}
new VehicleNames[212][] = {
{"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
{"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
{"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
{"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
{"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
{"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
{"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
{"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
{"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
{"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
{"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
{"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
{"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
{"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
{"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
{"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
{"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
{"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
{"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
{"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
{"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
{"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
{"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
{"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
{"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
{"Utility Trailer"}
};
// Debug Command
CMD:research(playerid, params[])
{
new string[128];
EIsystem[1][gAssignedLocation] = random(2);
EIsystem[1][gRequiredBonus] = Random(2, 5);
EIsystem[1][gBonusModel] = GetRandomModelCar();
switch(EIsystem[1][gRequiredBonus])
{
case 2: EIsystem[1][gBonusCash] = 10000;
case 3: EIsystem[1][gBonusCash] = 15000;
case 4: EIsystem[1][gBonusCash] = 20000;
case 5: EIsystem[1][gBonusCash] = 25000;
}
EIsystem[1][gDeliveredBonus] = 0;
format(string, sizeof(string), "[OCEAN DOCKS]"white" We are current looking for %dx %s which is to be imported @ %s ($%s overall reward pot)", EIsystem[1][gRequiredBonus], VehicleNames[EIsystem[1][gBonusModel]-400], EIlocations[EIsystem[1][gAssignedLocation]], AddComma(EIsystem[1][gBonusCash]));
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
return 1;
}
[OCEAN DOCKS]{FFFFFF} We are current looking for 4x 8Liberty City which is to be imported @ Vice City ($20,000 overall reward pot)
wiki says "The use of gotos is widely discouraged due to their effect on program flow."
|
new randModel, guard;
do
{
randModel = minrandom(400, 611);
}
while(!isACar(randModel) && ++guard < 100);
Because it can be replaced with do-while in a lot of cases. The main difference between while and do-while being that do-while always executes at least once because the comparison comes after the loop.
PHP код:
|