12.11.2015, 00:33
Hello. I'm testing the "(K) Custom specifier". But I have no idea how to use the example that brings include (k <vehicle>). I want to make /car [ID/name] without using strcmp..
SSCANF:vehicle(string[])
{
// This function is VERY basic, needs VASTLY improving to detect variations.
if ('0' <= string[0] <= '9')
{
new
ret = strval(string);
if (400 <= ret <= 611)
{
return ret;
}
}
else if (!strcmp(string, "Landstalker")) return 400;
else if (!strcmp(string, "Bravura")) return 401;
else if (!strcmp(string, "Buffalo")) return 402;
else if (!strcmp(string, "Linerunner")) return 403;
else if (!strcmp(string, "Perenniel")) return 404;
else if (!strcmp(string, "Sentinel")) return 405;
else if (!strcmp(string, "Dumper")) return 406;
else if (!strcmp(string, "Firetruck")) return 407;
else if (!strcmp(string, "Trashmaster")) return 408;
else if (!strcmp(string, "Stretch")) return 409;
else if (!strcmp(string, "Manana")) return 410;
else if (!strcmp(string, "Infernus")) return 411;
else if (!strcmp(string, "Voodoo")) return 412;
else if (!strcmp(string, "Pony")) return 413;
else if (!strcmp(string, "Mule")) return 414;
else if (!strcmp(string, "Cheetah")) return 415;
else if (!strcmp(string, "Ambulance")) return 416;
else if (!strcmp(string, "Leviathan")) return 417;
else if (!strcmp(string, "Moonbeam")) return 418;
else if (!strcmp(string, "Esperanto")) return 419;
else if (!strcmp(string, "Taxi")) return 420;
else if (!strcmp(string, "Washington")) return 421;
else if (!strcmp(string, "Bobcat")) return 422;
else if (!strcmp(string, "Mr Whoopee")) return 423;
else if (!strcmp(string, "BF Injection")) return 424;
else if (!strcmp(string, "Hunter")) return 425;
else if (!strcmp(string, "Premier")) return 426;
else if (!strcmp(string, "Enforcer")) return 427;
else if (!strcmp(string, "Securicar")) return 428;
else if (!strcmp(string, "Banshee")) return 429;
else if (!strcmp(string, "Predator")) return 430;
else if (!strcmp(string, "Bus")) return 431;
else if (!strcmp(string, "Rhino")) return 432;
else if (!strcmp(string, "Barracks")) return 433;
else if (!strcmp(string, "Hotknife")) return 434;
else if (!strcmp(string, "Article Trailer")) return 435;
else if (!strcmp(string, "Previon")) return 436;
else if (!strcmp(string, "Coach")) return 437;
else if (!strcmp(string, "Cabbie")) return 438;
else if (!strcmp(string, "Stallion")) return 439;
else if (!strcmp(string, "Rumpo")) return 440;
else if (!strcmp(string, "RC Bandit")) return 441;
else if (!strcmp(string, "Romero")) return 442;
else if (!strcmp(string, "Packer")) return 443;
else if (!strcmp(string, "Monster")) return 444;
else if (!strcmp(string, "Admiral")) return 445;
else if (!strcmp(string, "Squallo")) return 446;
else if (!strcmp(string, "Seasparrow")) return 447;
else if (!strcmp(string, "Pizzaboy")) return 448;
else if (!strcmp(string, "Tram")) return 449;
else if (!strcmp(string, "Article Trailer 2")) return 450;
else if (!strcmp(string, "Turismo")) return 451;
else if (!strcmp(string, "Speeder")) return 452;
else if (!strcmp(string, "Reefer")) return 453;
else if (!strcmp(string, "Tropic")) return 454;
else if (!strcmp(string, "Flatbed")) return 455;
else if (!strcmp(string, "Yankee")) return 456;
else if (!strcmp(string, "Caddy")) return 457;
else if (!strcmp(string, "Solair")) return 458;
else if (!strcmp(string, "Berkley's RC Van")) return 459;
else if (!strcmp(string, "Skimmer")) return 460;
else if (!strcmp(string, "PCJ-600")) return 461;
else if (!strcmp(string, "Faggio")) return 462;
else if (!strcmp(string, "Freeway")) return 463;
else if (!strcmp(string, "RC Baron")) return 464;
else if (!strcmp(string, "RC Raider")) return 465;
else if (!strcmp(string, "Glendale")) return 466;
else if (!strcmp(string, "Oceanic")) return 467;
else if (!strcmp(string, "Sanchez")) return 468;
else if (!strcmp(string, "Sparrow")) return 469;
else if (!strcmp(string, "Patriot")) return 470;
else if (!strcmp(string, "Quad")) return 471;
else if (!strcmp(string, "Coastguard")) return 472;
else if (!strcmp(string, "Dinghy")) return 473;
else if (!strcmp(string, "Hermes")) return 474;
else if (!strcmp(string, "Sabre")) return 475;
else if (!strcmp(string, "Rustler")) return 476;
else if (!strcmp(string, "ZR-350")) return 477;
else if (!strcmp(string, "Walton")) return 478;
else if (!strcmp(string, "Regina")) return 479;
else if (!strcmp(string, "Comet")) return 480;
else if (!strcmp(string, "BMX")) return 481;
else if (!strcmp(string, "Burrito")) return 482;
else if (!strcmp(string, "Camper")) return 483;
else if (!strcmp(string, "Marquis")) return 484;
else if (!strcmp(string, "Baggage")) return 485;
else if (!strcmp(string, "Dozer")) return 486;
else if (!strcmp(string, "Maverick")) return 487;
else if (!strcmp(string, "SAN News Maverick")) return 488;
else if (!strcmp(string, "Rancher")) return 489;
else if (!strcmp(string, "FBI Rancher")) return 490;
else if (!strcmp(string, "Virgo")) return 491;
else if (!strcmp(string, "Greenwood")) return 492;
else if (!strcmp(string, "Jetmax")) return 493;
else if (!strcmp(string, "Hotring Racer")) return 494;
else if (!strcmp(string, "Sandking")) return 495;
else if (!strcmp(string, "Blista Compact")) return 496;
else if (!strcmp(string, "Police Maverick")) return 497;
else if (!strcmp(string, "Boxville")) return 498;
else if (!strcmp(string, "Benson")) return 499;
else if (!strcmp(string, "Mesa")) return 500;
else if (!strcmp(string, "RC Goblin")) return 501;
else if (!strcmp(string, "Hotring Racer")) return 502;
else if (!strcmp(string, "Hotring Racer")) return 503;
else if (!strcmp(string, "Bloodring Banger")) return 504;
else if (!strcmp(string, "Rancher")) return 505;
else if (!strcmp(string, "Super GT")) return 506;
else if (!strcmp(string, "Elegant")) return 507;
else if (!strcmp(string, "Journey")) return 508;
else if (!strcmp(string, "Bike")) return 509;
else if (!strcmp(string, "Mountain Bike")) return 510;
else if (!strcmp(string, "Beagle")) return 511;
else if (!strcmp(string, "Cropduster")) return 512;
else if (!strcmp(string, "Stuntplane")) return 513;
else if (!strcmp(string, "Tanker")) return 514;
else if (!strcmp(string, "Roadtrain")) return 515;
else if (!strcmp(string, "Nebula")) return 516;
else if (!strcmp(string, "Majestic")) return 517;
else if (!strcmp(string, "Buccaneer")) return 518;
else if (!strcmp(string, "Shamal")) return 519;
else if (!strcmp(string, "Hydra")) return 520;
else if (!strcmp(string, "FCR-900")) return 521;
else if (!strcmp(string, "NRG-500")) return 522;
else if (!strcmp(string, "HPV1000")) return 523;
else if (!strcmp(string, "Cement Truck")) return 524;
else if (!strcmp(string, "Towtruck")) return 525;
else if (!strcmp(string, "Fortune")) return 526;
else if (!strcmp(string, "Cadrona")) return 527;
else if (!strcmp(string, "FBI Truck")) return 528;
else if (!strcmp(string, "Willard")) return 529;
else if (!strcmp(string, "Forklift")) return 530;
else if (!strcmp(string, "Tractor")) return 531;
else if (!strcmp(string, "Combine Harvester")) return 532;
else if (!strcmp(string, "Feltzer")) return 533;
else if (!strcmp(string, "Remington")) return 534;
else if (!strcmp(string, "Slamvan")) return 535;
else if (!strcmp(string, "Blade")) return 536;
else if (!strcmp(string, "Freight (Train)")) return 537;
else if (!strcmp(string, "Brownstreak (Train)")) return 538;
else if (!strcmp(string, "Vortex")) return 539;
else if (!strcmp(string, "Vincent")) return 540;
else if (!strcmp(string, "Bullet")) return 541;
else if (!strcmp(string, "Clover")) return 542;
else if (!strcmp(string, "Sadler")) return 543;
else if (!strcmp(string, "Firetruck LA")) return 544;
else if (!strcmp(string, "Hustler")) return 545;
else if (!strcmp(string, "Intruder")) return 546;
else if (!strcmp(string, "Primo")) return 547;
else if (!strcmp(string, "Cargobob")) return 548;
else if (!strcmp(string, "Tampa")) return 549;
else if (!strcmp(string, "Sunrise")) return 550;
else if (!strcmp(string, "Merit")) return 551;
else if (!strcmp(string, "Utility Van")) return 552;
else if (!strcmp(string, "Nevada")) return 553;
else if (!strcmp(string, "Yosemite")) return 554;
else if (!strcmp(string, "Windsor")) return 555;
else if (!strcmp(string, "Monster \"A\"")) return 556;
else if (!strcmp(string, "Monster \"B\"")) return 557;
else if (!strcmp(string, "Uranus")) return 558;
else if (!strcmp(string, "Jester")) return 559;
else if (!strcmp(string, "Sultan")) return 560;
else if (!strcmp(string, "Stratum")) return 561;
else if (!strcmp(string, "Elegy")) return 562;
else if (!strcmp(string, "Raindance")) return 563;
else if (!strcmp(string, "RC Tiger")) return 564;
else if (!strcmp(string, "Flash")) return 565;
else if (!strcmp(string, "Tahoma")) return 566;
else if (!strcmp(string, "Savanna")) return 567;
else if (!strcmp(string, "Bandito")) return 568;
else if (!strcmp(string, "Freight Flat Trailer (Train)")) return 569;
else if (!strcmp(string, "Streak Trailer (Train)")) return 570;
else if (!strcmp(string, "Kart")) return 571;
else if (!strcmp(string, "Mower")) return 572;
else if (!strcmp(string, "Dune")) return 573;
else if (!strcmp(string, "Sweeper")) return 574;
else if (!strcmp(string, "Broadway")) return 575;
else if (!strcmp(string, "Tornado")) return 576;
else if (!strcmp(string, "AT400")) return 577;
else if (!strcmp(string, "DFT-30")) return 578;
else if (!strcmp(string, "Huntley")) return 579;
else if (!strcmp(string, "Stafford")) return 580;
else if (!strcmp(string, "BF-400")) return 581;
else if (!strcmp(string, "Newsvan")) return 582;
else if (!strcmp(string, "Tug")) return 583;
else if (!strcmp(string, "Petrol Trailer")) return 584;
else if (!strcmp(string, "Emperor")) return 585;
else if (!strcmp(string, "Wayfarer")) return 586;
else if (!strcmp(string, "Euros")) return 587;
else if (!strcmp(string, "Hotdog")) return 588;
else if (!strcmp(string, "Club")) return 589;
else if (!strcmp(string, "Freight Box Trailer (Train)")) return 590;
else if (!strcmp(string, "Article Trailer 3")) return 591;
else if (!strcmp(string, "Andromada")) return 592;
else if (!strcmp(string, "Dodo")) return 593;
else if (!strcmp(string, "RC Cam")) return 594;
else if (!strcmp(string, "Launch")) return 595;
else if (!strcmp(string, "Police Car (LSPD)")) return 596;
else if (!strcmp(string, "Police Car (SFPD)")) return 597;
else if (!strcmp(string, "Police Car (LVPD)")) return 598;
else if (!strcmp(string, "Police Ranger")) return 599;
else if (!strcmp(string, "Picador")) return 600;
else if (!strcmp(string, "S.W.A.T.")) return 601;
else if (!strcmp(string, "Alpha")) return 602;
else if (!strcmp(string, "Phoenix")) return 603;
else if (!strcmp(string, "Glendale Shit")) return 604;
else if (!strcmp(string, "Sadler Shit")) return 605;
else if (!strcmp(string, "Baggage Trailer \"A\"")) return 606;
else if (!strcmp(string, "Baggage Trailer \"B\"")) return 607;
else if (!strcmp(string, "Tug Stairs Trailer")) return 608;
else if (!strcmp(string, "Boxville")) return 609;
else if (!strcmp(string, "Farm Trailer")) return 610;
else if (!strcmp(string, "Utility Trailer")) return 611;
return -1;
}
SSCANF:vehicle(string[])
{
// If the string is numeric, check for valid vehicle modelid
if ('0' <= string[0] <= '9')
{
new
ret = strval(string)
;
if (400 <= ret <= 611)
{
return ret;
}
}
// Or if the vehicle name or match is entered, check for the nearest vehicle name
else
{
for(new i = 0; i < 211; i++)
{
// "VehicleNames" is you vehicles' names array
if (strfind(VehicleNames[i], string, true) != -1)
{
return i + 400;
}
}
return -1;
}
}