04.09.2013, 01:11
Hi, I've taken a part from the sscanf script and made some changes to it:
I've tried to do it with sscanf(******) but I have the same problem. I have this cmd:
If I do
It won't spawn any car.
I must do /car nrg-500 or /car NRG-500 to spawn the car.
Why is it happening?
Using sscanf:
I know it uses strcmp.
But it takes some time to spawn the car:
- Sorry for my bad english skills.
PHP код:
stock GetVehicleModelByName(string[])
{
new model;
if (strfind(string, "Landstalker",true ) != -1) model = 400;
if (strfind(string, "Bravura",true ) != -1) model = 401;
if (strfind(string, "Buffalo",true ) != -1) model = 402;
if (strfind(string, "Linerunner",true ) != -1) model = 403;
if (strfind(string, "Perenniel",true ) != -1) model = 404;
if (strfind(string, "Sentinel",true ) != -1) model = 405;
if (strfind(string, "Dumper",true ) != -1) model = 406;
if (strfind(string, "Firetruck",true ) != -1) model = 407;
if (strfind(string, "Trashmaster",true ) != -1) model = 408;
if (strfind(string, "Stretch",true ) != -1) model = 409;
if (strfind(string, "Manana",true ) != -1) model = 410;
if (strfind(string, "Infernus",true ) != -1) model = 411;
if (strfind(string, "Voodoo",true ) != -1) model = 412;
if (strfind(string, "Pony",true ) != -1) model = 413;
if (strfind(string, "Mule",true ) != -1) model = 414;
if (strfind(string, "Cheetah",true ) != -1) model = 415;
if (strfind(string, "Ambulance",true ) != -1) model = 416;
if (strfind(string, "Leviathan",true ) != -1) model = 417;
if (strfind(string, "Moonbeam",true ) != -1) model = 418;
if (strfind(string, "Esperanto",true ) != -1) model = 419;
if (strfind(string, "Taxi",true ) != -1) model = 420;
if (strfind(string, "Washington",true ) != -1) model = 421;
if (strfind(string, "Bobcat",true ) != -1) model = 422;
if (strfind(string, "Mr Whoopee",true ) != -1) model = 423;
if (strfind(string, "BF Injection",true ) != -1) model = 424;
if (strfind(string, "Hunter",true ) != -1) model = 425;
if (strfind(string, "Premier",true ) != -1) model = 426;
if (strfind(string, "Enforcer",true ) != -1) model = 427;
if (strfind(string, "Securicar",true ) != -1) model = 428;
if (strfind(string, "Banshee",true ) != -1) model = 429;
if (strfind(string, "Predator",true ) != -1) model = 430;
if (strfind(string, "Bus",true ) != -1) model = 431;
if (strfind(string, "Rhino",true ) != -1) model = 432;
if (strfind(string, "Barracks",true ) != -1) model = 433;
if (strfind(string, "Hotknife",true ) != -1) model = 434;
if (strfind(string, "Article Trailer",true ) != -1) model = 435;
if (strfind(string, "Previon",true ) != -1) model = 436;
if (strfind(string, "Coach",true ) != -1) model = 437;
if (strfind(string, "Cabbie",true ) != -1) model = 438;
if (strfind(string, "Stallion",true ) != -1) model = 439;
if (strfind(string, "Rumpo",true ) != -1) model = 440;
if (strfind(string, "RC Bandit",true ) != -1) model = 441;
if (strfind(string, "Romero",true ) != -1) model = 442;
if (strfind(string, "Packer",true ) != -1) model = 443;
if (strfind(string, "Monster",true ) != -1) model = 444;
if (strfind(string, "Admiral",true ) != -1) model = 445;
if (strfind(string, "Squallo",true ) != -1) model = 446;
if (strfind(string, "Seasparrow",true ) != -1) model = 447;
if (strfind(string, "Pizzaboy",true ) != -1) model = 448;
if (strfind(string, "Tram",true ) != -1) model = 449;
if (strfind(string, "Article Trailer 2",true ) != -1) model = 450;
if (strfind(string, "Turismo",true ) != -1) model = 451;
if (strfind(string, "Speeder",true ) != -1) model = 452;
if (strfind(string, "Reefer",true ) != -1) model = 453;
if (strfind(string, "Tropic",true ) != -1) model = 454;
if (strfind(string, "Flatbed",true ) != -1) model = 455;
if (strfind(string, "Yankee",true ) != -1) model = 456;
if (strfind(string, "Caddy",true ) != -1) model = 457;
if (strfind(string, "Solair",true ) != -1) model = 458;
if (strfind(string, "Berkley's RC Van",true ) != -1) model = 459;
if (strfind(string, "Skimmer",true ) != -1) model = 460;
if (strfind(string, "PCJ-600",true ) != -1) model = 461;
if (strfind(string, "Faggio",true ) != -1) model = 462;
if (strfind(string, "Freeway",true ) != -1) model = 463;
if (strfind(string, "RC Baron",true ) != -1) model = 464;
if (strfind(string, "RC Raider",true ) != -1) model = 465;
if (strfind(string, "Glendale",true ) != -1) model = 466;
if (strfind(string, "Oceanic",true ) != -1) model = 467;
if (strfind(string, "Sanchez",true ) != -1) model = 468;
if (strfind(string, "Sparrow",true ) != -1) model = 469;
if (strfind(string, "Patriot",true ) != -1) model = 470;
if (strfind(string, "Quad",true ) != -1) model = 471;
if (strfind(string, "Coastguard",true ) != -1) model = 472;
if (strfind(string, "Dinghy",true ) != -1) model = 473;
if (strfind(string, "Hermes",true ) != -1) model = 474;
if (strfind(string, "Sabre",true ) != -1) model = 475;
if (strfind(string, "Rustler",true ) != -1) model = 476;
if (strfind(string, "ZR-350",true ) != -1) model = 477;
if (strfind(string, "Walton",true ) != -1) model = 478;
if (strfind(string, "Regina",true ) != -1) model = 479;
if (strfind(string, "Comet",true ) != -1) model = 480;
if (strfind(string, "BMX",true ) != -1) model = 481;
if (strfind(string, "Burrito",true ) != -1) model = 482;
if (strfind(string, "Camper",true ) != -1) model = 483;
if (strfind(string, "Marquis",true ) != -1) model = 484;
if (strfind(string, "Baggage",true ) != -1) model = 485;
if (strfind(string, "Dozer",true ) != -1) model = 486;
if (strfind(string, "Maverick",true ) != -1) model = 487;
if (strfind(string, "SAN News Maverick",true ) != -1) model = 488;
if (strfind(string, "Rancher",true ) != -1) model = 489;
if (strfind(string, "FBI Rancher",true ) != -1) model = 490;
if (strfind(string, "Virgo",true ) != -1) model = 491;
if (strfind(string, "Greenwood",true ) != -1) model = 492;
if (strfind(string, "Jetmax",true ) != -1) model = 493;
if (strfind(string, "Hotring Racer",true ) != -1) model = 494;
if (strfind(string, "Sandking",true ) != -1) model = 495;
if (strfind(string, "Blista Compact",true ) != -1) model = 496;
if (strfind(string, "Police Maverick",true ) != -1) model = 497;
if (strfind(string, "Boxville",true ) != -1) model = 498;
if (strfind(string, "Benson",true ) != -1) model = 499;
if (strfind(string, "Mesa",true ) != -1) model = 500;
if (strfind(string, "RC Goblin",true ) != -1) model = 501;
if (strfind(string, "Hotring Racer",true ) != -1) model = 502;
if (strfind(string, "Hotring Racer",true ) != -1) model = 503;
if (strfind(string, "Bloodring Banger",true ) != -1) model = 504;
if (strfind(string, "Rancher",true ) != -1) model = 505;
if (strfind(string, "Super GT",true ) != -1) model = 506;
if (strfind(string, "Elegant",true ) != -1) model = 507;
if (strfind(string, "Journey",true ) != -1) model = 508;
if (strfind(string, "Bike",true ) != -1) model = 509;
if (strfind(string, "Mountain Bike",true ) != -1) model = 510;
if (strfind(string, "Beagle",true ) != -1) model = 511;
if (strfind(string, "Cropduster",true ) != -1) model = 512;
if (strfind(string, "Stuntplane",true ) != -1) model = 513;
if (strfind(string, "Tanker",true ) != -1) model = 514;
if (strfind(string, "Roadtrain",true ) != -1) model = 515;
if (strfind(string, "Nebula",true ) != -1) model = 516;
if (strfind(string, "Majestic",true ) != -1) model = 517;
if (strfind(string, "Buccaneer",true ) != -1) model = 518;
if (strfind(string, "Shamal",true ) != -1) model = 519;
if (strfind(string, "Hydra",true ) != -1) model = 520;
if (strfind(string, "FCR-900",true ) != -1) model = 521;
if (strfind(string, "NRG-500",true ) != -1) model = 522;
if (strfind(string, "HPV1000",true ) != -1) model = 523;
if (strfind(string, "Cement Truck",true ) != -1) model = 524;
if (strfind(string, "Towtruck",true ) != -1) model = 525;
if (strfind(string, "Fortune",true ) != -1) model = 526;
if (strfind(string, "Cadrona",true ) != -1) model = 527;
if (strfind(string, "FBI Truck",true ) != -1) model = 528;
if (strfind(string, "Willard",true ) != -1) model = 529;
if (strfind(string, "Forklift",true ) != -1) model = 530;
if (strfind(string, "Tractor",true ) != -1) model = 531;
if (strfind(string, "Combine Harvester",true ) != -1) model = 532;
if (strfind(string, "Feltzer",true ) != -1) model = 533;
if (strfind(string, "Remington",true ) != -1) model = 534;
if (strfind(string, "Slamvan",true ) != -1) model = 535;
if (strfind(string, "Blade",true ) != -1) model = 536;
if (strfind(string, "Freight (Train)",true ) != -1) model = 537;
if (strfind(string, "Brownstreak (Train)",true ) != -1) model = 538;
if (strfind(string, "Vortex",true ) != -1) model = 539;
if (strfind(string, "Vincent",true ) != -1) model = 540;
if (strfind(string, "Bullet",true ) != -1) model = 541;
if (strfind(string, "Clover",true ) != -1) model = 542;
if (strfind(string, "Sadler",true ) != -1) model = 543;
if (strfind(string, "Firetruck LA",true ) != -1) model = 544;
if (strfind(string, "Hustler",true ) != -1) model = 545;
if (strfind(string, "Intruder",true ) != -1) model = 546;
if (strfind(string, "Primo",true ) != -1) model = 547;
if (strfind(string, "Cargobob",true ) != -1) model = 548;
if (strfind(string, "Tampa",true ) != -1) model = 549;
if (strfind(string, "Sunrise",true ) != -1) model = 550;
if (strfind(string, "Merit",true ) != -1) model = 551;
if (strfind(string, "Utility Van",true ) != -1) model = 552;
if (strfind(string, "Nevada",true ) != -1) model = 553;
if (strfind(string, "Yosemite",true ) != -1) model = 554;
if (strfind(string, "Windsor",true ) != -1) model = 555;
if (strfind(string, "Monster \"A\"",true ) != -1) model = 556;
if (strfind(string, "Monster \"B\"",true ) != -1) model = 557;
if (strfind(string, "Uranus",true ) != -1) model = 558;
if (strfind(string, "Jester",true ) != -1) model = 559;
if (strfind(string, "Sultan",true ) != -1) model = 560;
if (strfind(string, "Stratum",true ) != -1) model = 561;
if (strfind(string, "Elegy",true ) != -1) model = 562;
if (strfind(string, "Raindance",true ) != -1) model = 563;
if (strfind(string, "RC Tiger",true ) != -1) model = 564;
if (strfind(string, "Flash",true ) != -1) model = 565;
if (strfind(string, "Tahoma",true ) != -1) model = 566;
if (strfind(string, "Savanna",true ) != -1) model = 567;
if (strfind(string, "Bandito",true ) != -1) model = 568;
if (strfind(string, "Freight Flat Trailer (Train)",true ) != -1) model = 569;
if (strfind(string, "Streak Trailer (Train)",true ) != -1) model = 570;
if (strfind(string, "Kart",true ) != -1) model = 571;
if (strfind(string, "Mower",true ) != -1) model = 572;
if (strfind(string, "Dune",true ) != -1) model = 573;
if (strfind(string, "Sweeper",true ) != -1) model = 574;
if (strfind(string, "Broadway",true ) != -1) model = 575;
if (strfind(string, "Tornado",true ) != -1) model = 576;
if (strfind(string, "AT400",true ) != -1) model = 577;
if (strfind(string, "DFT-30",true ) != -1) model = 578;
if (strfind(string, "Huntley",true ) != -1) model = 579;
if (strfind(string, "Stafford",true ) != -1) model = 580;
if (strfind(string, "BF-400",true ) != -1) model = 581;
if (strfind(string, "Newsvan",true ) != -1) model = 582;
if (strfind(string, "Tug",true ) != -1) model = 583;
if (strfind(string, "Petrol Trailer",true ) != -1) model = 584;
if (strfind(string, "Emperor",true ) != -1) model = 585;
if (strfind(string, "Wayfarer",true ) != -1) model = 586;
if (strfind(string, "Euros",true ) != -1) model = 587;
if (strfind(string, "Hotdog",true ) != -1) model = 588;
if (strfind(string, "Club",true ) != -1) model = 589;
if (strfind(string, "Freight Box Trailer (Train)",true ) != -1) model = 590;
if (strfind(string, "Article Trailer 3",true ) != -1) model = 591;
if (strfind(string, "Andromada",true ) != -1) model = 592;
if (strfind(string, "Dodo",true ) != -1) model = 593;
if (strfind(string, "RC Cam",true ) != -1) model = 594;
if (strfind(string, "Launch",true ) != -1) model = 595;
if (strfind(string, "Police Car (LSPD)",true ) != -1) model = 596;
if (strfind(string, "Police Car (SFPD)",true ) != -1) model = 597;
if (strfind(string, "Police Car (LVPD)",true ) != -1) model = 598;
if (strfind(string, "Police Ranger",true ) != -1) model = 599;
if (strfind(string, "Picador",true ) != -1) model = 600;
if (strfind(string, "S.W.A.T.",true ) != -1) model = 601;
if (strfind(string, "Alpha",true ) != -1) model = 602;
if (strfind(string, "Phoenix",true ) != -1) model = 603;
if (strfind(string, "Glendale Shit",true ) != -1) model = 604;
if (strfind(string, "Sadler Shit",true ) != -1) model = 605;
if (strfind(string, "Baggage Trailer \"A\"",true ) != -1) model = 606;
if (strfind(string, "Baggage Trailer \"B\"",true ) != -1) model = 607;
if (strfind(string, "Tug Stairs Trailer",true ) != -1) model = 608;
if (strfind(string, "Boxville",true ) != -1) model = 609;
if (strfind(string, "Farm Trailer",true ) != -1) model = 610;
if (strfind(string, "Utility Trailer",true ) != -1) model = 611;
return model;
}
PHP код:
CMD:car(playerid, params[])
{
new vname[40], model, veh;
if(sscanf(params, "s[40]", vname)) return USAGE(playerid, "/car [vehicle name]");
model = GetVehicleModelByName(vname);
new Float:Pos[5];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
Vehicle[veh] = CreateVehicle(model, Pos[0], Pos[1], Pos[2], Pos[3], 1, 2, 30);
return 1;
}
Код:
/car nrg
I must do /car nrg-500 or /car NRG-500 to spawn the car.
Why is it happening?
Using sscanf:
I know it uses strcmp.
But it takes some time to spawn the car:
PHP код:
CMD:car(playerid, params[])
{
new vname[40], model, veh;
if(sscanf(params, "s[40]", vname)) return USAGE(playerid, "/car [vehicle name]");
sscanf(vname, "k<vehicle>", model);
new Float:Pos[5];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
Vehicle[veh] = CreateVehicle(model, Pos[0], Pos[1], Pos[2], Pos[3], 1, 2, 30);
return 1;
}