Vehicle spawn with name
#4

Here is the stuff needed to do that. Just copy it into your include or at the top of your script.

pawn Код:
new const VehicleNames[][] =
{
"Landstalker",
"Bravura",
"Buffalo",
"Linerunner",
"Perenniel",
"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",
"Article Trailer",
"Previon",
"Coach",
"Cabbie",
"Stallion",
"Rumpo",
"RC Bandit",
"Romero",
"Packer",
"Monster",
"Admiral",
"Squallo",
"Seasparrow",
"Pizzaboy",
"Tram",
"Article 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",
"SAN News Maverick",
"Rancher",
"FBI Rancher",
"Virgo",
"Greenwood",
"Jetmax",
"Hotring Racer",
"Sandking",
"Blista Compact",
"Police Maverick",
"Boxville",
"Benson",
"Mesa",
"RC Goblin",
"Hotring Racer 2",
"Hotring Racer 3",
"Bloodring Banger",
"Rancher 2",
"Super GT",
"Elegant",
"Journey",
"Bike",
"Mountain Bike",
"Beagle",
"Cropduster",
"Stuntplane",
"Tanker",
"Roadtrain",
"Nebula",
"Majestic",
"Buccaneer",
"Shamal",
"Hydra",
"FCR-900",
"NRG-500",
"HPV1000",
"Cement Truck",
"Towtruck",
"Fortune",
"Cadrona",
"FBI Truck",
"Willard",
"Forklift",
"Tractor",
"Combine Harvester",
"Feltzer",
"Remington",
"Slamvan",
"Blade",
"Freight",
"Brownstreak",
"Vortex",
"Vincent",
"Bullet",
"Clover",
"Sadler",
"Firetruck LA",
"Hustler",
"Intruder",
"Primo",
"Cargobob",
"Tampa",
"Sunrise",
"Merit",
"Utility Van",
"Nevada",
"Yosemite",
"Windsor",
"Monster A",
"Monster B",
"Uranus",
"Jester",
"Sultan",
"Stratum",
"Elegy",
"Raindance",
"RC Tiger",
"Flash",
"Tahoma",
"Savanna",
"Bandito",
"Freight Flat Trailer",
"Streak Trailer",
"Kart",
"Mower",
"Dune",
"Sweeper",
"Broadway",
"Tornado",
"AT400",
"DFT-30",
"Huntley",
"Stafford",
"BF-400",
"Newsvan",
"Tug",
"Petrol Trailer",
"Emperor",
"Wayfarer",
"Euros",
"Hotdog",
"Club",
"Freight Box Trailer",
"Article Trailer 3",
"Andromada",
"Dodo",
"RC Cam",
"Launch",
"Police Car (LSPD)",
"Police Car (SFPD)",
"Police Car (LVPD)",
"Police Ranger",
"Picador",
"S.W.A.T.",
"Alpha",
"Phoenix",
"Glendale Shit",
"Sadler Shit",
"Baggage Trailer A",
"Baggage Trailer B",
"Tug Stairs Trailer",
"Boxville 2",
"Farm Trailer",
"Utility Trailer"
};

stock bool:IsNumericChar(character) return character > 47 && character < 58;

stock GetCharsCount(const string[], ...)
{
new Count, num = numargs();
for(new n = 1; n<num; n++) for(new i; i<strlen(string); i++) if(getarg(n, 0) && string[i] == getarg(n, 0)) Count++;
return Count;
}

stock GetNumericCharsCount(const string[]) return GetCharsCount(string, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57);

stock bool:IsNumeric(const string[]) return GetNumericCharsCount(string) == strlen(string);

stock bool:GetNumericPartOfString(const string[], output[], &index)
{
new lenght = strlen(string);
if(!lenght || !GetNumericCharsCount(string)) return false;
while(index < lenght && !IsNumericChar(string[index])) index++;
new offset = index;
while(index < lenght && IsNumericChar(string[index])) output[index - offset] = string[index], index++;
return true;
}

stock GetVehicleModelFromName(const name[])
{
if(IsNumeric(name)) return strval(name);
for(new i; i<sizeof(VehicleNames); i++) if(strfind(VehicleNames[i], name, true) != -1) return i + 400;
new output[5], index;
if(GetNumericPartOfString(name, output, index) && strval(output) < 612 && strval(output) > 399) return strval(output);
return 0;
}
Just put this into the script:

pawn Код:
new Model = GetVehicleModelFromName(tmp);
Have fun.
Reply


Messages In This Thread
Vehicle spawn with name - by JustinB - 16.05.2010, 04:40
Re: Vehicle spawn with name - by Babul - 16.05.2010, 05:03
Re: Vehicle spawn with name - by JustinB - 16.05.2010, 05:46
Re: Vehicle spawn with name - by ¤Adas¤ - 16.05.2010, 06:00
Re: Vehicle spawn with name - by JustinB - 16.05.2010, 06:07
Re: Vehicle spawn with name - by ¤Adas¤ - 16.05.2010, 06:15
Re: Vehicle spawn with name - by ¤Adas¤ - 16.05.2010, 06:17
Re: Vehicle spawn with name - by JustinB - 16.05.2010, 11:57
Re: Vehicle spawn with name - by ¤Adas¤ - 16.05.2010, 11:58
Re: Vehicle spawn with name - by alenblue - 16.05.2010, 12:45

Forum Jump:


Users browsing this thread: 2 Guest(s)