/car <carname/id> little help pls
#1

Hi guys i wanted to make my Own /car spawner and it works.
but i want it like when i type /car 520
it says Hydra spawnt and when i type /car Hydra it says Hydra spawnt can anyone help me ?

pawn Код:
CMD:car(playerid,params[])
{
    new vID[20],color1,color2;
    if(Acc[playerid][Adminlevel]<3) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command");
    else if(sscanf(params,"sdd",vID,color1,color2)) return SendClientMessage(playerid,COLOR_RED,"Usage: /car <vehicleid / vehiclename> <color1> <color2>");
    {
        new s[128];
        format(s,sizeof s,"Fahrzeug: %s spawned",vID);
        SendClientMessage(playerid,COLOR_LBLUE,s);
        CreateVehicleForPlayer(playerid,vID,color1, color2);
    }
    return 1;
}

pawn Код:
stock CreateVehicleForPlayer(playerid, vehiclename[], color1, color2)
{
        new pvmid;
        if(strfind("Landstalker", vehiclename,true,0) != -1) pvmid = 400;
        if(strfind("Bravura", vehiclename,true,0) != -1) pvmid = 401;
        if(strfind("Buffalo", vehiclename,true,0) != -1) pvmid = 402;
        if(strfind("Linerunner", vehiclename,true,0) != -1) pvmid = 403;
        if(strfind("Perenniel", vehiclename,true,0) != -1) pvmid = 404;
        if(strfind("Sentinel", vehiclename,true,0) != -1) pvmid = 405;
        if(strfind("Dumper", vehiclename,true,0) != -1) pvmid = 406;
        if(strfind("Firetuck", vehiclename,true,0) != -1) pvmid = 407;
        if(strfind("Trashmaster", vehiclename,true,0) != -1) pvmid = 408;
        if(strfind("Stretch", vehiclename,true,0) != -1) pvmid = 409;
        if(strfind("Manana", vehiclename,true,0) != -1) pvmid = 410;
        if(strfind("Infernus", vehiclename,true,0) != -1) pvmid = 411;
        if(strfind("Voodoo", vehiclename,true,0) != -1) pvmid = 412;
        if(strfind("Pony", vehiclename,true,0) != -1) pvmid = 413;
        if(strfind("Mule", vehiclename,true,0) != -1) pvmid = 414;
        if(strfind("Cheetah", vehiclename,true,0) != -1) pvmid = 415;
        if(strfind("Ambulance", vehiclename,true,0) != -1) pvmid = 416;
        if(strfind("Leviathan", vehiclename,true,0) != -1) pvmid = 417;
        if(strfind("Moonbeam", vehiclename,true,0) != -1) pvmid = 418;
        if(strfind("Esperanto", vehiclename,true,0) != -1) pvmid = 419;
        if(strfind("Taxi", vehiclename,true,0) != -1) pvmid = 420;
        if(strfind("Washington", vehiclename,true,0) != -1) pvmid = 421;
        if(strfind("Bobcat", vehiclename,true,0) != -1) pvmid = 422;
        if(strfind("Mr Whoopie", vehiclename,true,0) != -1) pvmid = 423;
        if(strfind("BF Injection", vehiclename,true,0) != -1) pvmid = 424;
        if(strfind("Hunter", vehiclename,true,0) != -1) pvmid = 425;
        if(strfind("Premier", vehiclename,true,0) != -1) pvmid = 426;
        if(strfind("Enforcer", vehiclename,true,0) != -1) pvmid = 427;
        if(strfind("Securicar", vehiclename,true,0) != -1) pvmid = 428;
        if(strfind("Banshee", vehiclename,true,0) != -1) pvmid = 429;
        if(strfind("Predator", vehiclename,true,0) != -1) pvmid = 430;
        if(strfind("Bus", vehiclename,true,0) != -1) pvmid = 431;
        if(strfind("Rhino", vehiclename,true,0) != -1) pvmid = 432;
        if(strfind("Barracks", vehiclename,true,0) != -1) pvmid = 433;
        if(strfind("Hotknife", vehiclename,true,0) != -1) pvmid = 434;
        if(strfind("ArticleTrailer", vehiclename,true,0) != -1) pvmid = 435;
        if(strfind("Previon", vehiclename,true,0) != -1) pvmid = 436;
        if(strfind("Coach", vehiclename,true,0) != -1) pvmid = 437;
        if(strfind("Cabbie", vehiclename,true,0) != -1) pvmid = 438;
        if(strfind("Stallion", vehiclename,true,0) != -1) pvmid = 439;
        if(strfind("Rumpo", vehiclename,true,0) != -1) pvmid = 440;
        if(strfind("RCBandit", vehiclename,true,0) != -1) pvmid = 441;
        if(strfind("Romero", vehiclename,true,0) != -1) pvmid = 442;
        if(strfind("Packer", vehiclename,true,0) != -1) pvmid = 443;
        if(strfind("Monster", vehiclename,true,0) != -1) pvmid = 444;
        if(strfind("Admiral", vehiclename,true,0) != -1) pvmid = 445;
        if(strfind("Squallo", vehiclename,true,0) != -1) pvmid = 446;
        if(strfind("Seasparrow", vehiclename,true,0) != -1) pvmid = 447;
        if(strfind("Pizzaboy", vehiclename,true,0) != -1) pvmid = 448;
        if(strfind("Tram", vehiclename,true,0) != -1) pvmid = 449;
        if(strfind("Article Trailer 2", vehiclename,true,0) != -1) pvmid = 450;
        if(strfind("Turismo", vehiclename,true,0) != -1) pvmid = 451;
        if(strfind("Speeder", vehiclename,true,0) != -1) pvmid = 452;
        if(strfind("Reefer", vehiclename,true,0) != -1) pvmid = 453;
        if(strfind("Tropic", vehiclename,true,0) != -1) pvmid = 454;
        if(strfind("Flatbed", vehiclename,true,0) != -1) pvmid = 455;
        if(strfind("Yankee", vehiclename,true,0) != -1) pvmid = 456;
        if(strfind("Caddy", vehiclename,true,0) != -1) pvmid = 457;
        if(strfind("Solair", vehiclename,true,0) != -1) pvmid = 458;
        if(strfind("Berkley's RC Van", vehiclename,true,0) != -1) pvmid = 459;
        if(strfind("Skimmer", vehiclename,true,0) != -1) pvmid = 460;
        if(strfind("PCJ600", vehiclename,true,0) != -1) pvmid = 461;
        if(strfind("Faggio", vehiclename,true,0) != -1) pvmid = 462;
        if(strfind("Freeway", vehiclename,true,0) != -1) pvmid = 463;
        if(strfind("RCBaron", vehiclename,true,0) != -1) pvmid = 464;
        if(strfind("RCRaider", vehiclename,true,0) != -1) pvmid = 465;
        if(strfind("Glendale", vehiclename,true,0) != -1) pvmid = 466;
        if(strfind("Oceanic", vehiclename,true,0) != -1) pvmid = 467;
        if(strfind("Sanchez", vehiclename,true,0) != -1) pvmid = 468;
        if(strfind("Sparrow", vehiclename,true,0) != -1) pvmid = 469;
        if(strfind("Patriot", vehiclename,true,0) != -1) pvmid = 470;
        if(strfind("Quad", vehiclename,true,0) != -1) pvmid = 471;
        if(strfind("Coastguard", vehiclename,true,0) != -1) pvmid = 472;
        if(strfind("Dinghy", vehiclename,true,0) != -1) pvmid = 473;
        if(strfind("Hermes", vehiclename,true,0) != -1) pvmid = 474;
        if(strfind("Sabre", vehiclename,true,0) != -1) pvmid = 475;
        if(strfind("Rustler", vehiclename,true,0) != -1) pvmid = 476;
        if(strfind("ZR350", vehiclename,true,0) != -1) pvmid = 477;
        if(strfind("Walton", vehiclename,true,0) != -1) pvmid = 478;
        if(strfind("Regina", vehiclename,true,0) != -1) pvmid = 479;
        if(strfind("Comet", vehiclename,true,0) != -1) pvmid = 480;
        if(strfind("BMX", vehiclename,true,0) != -1) pvmid = 481;
        if(strfind("Burrito", vehiclename,true,0) != -1) pvmid = 482;
        if(strfind("Camper", vehiclename,true,0) != -1) pvmid = 483;
        if(strfind("Marquis", vehiclename,true,0) != -1) pvmid = 484;
        if(strfind("Baggage", vehiclename,true,0) != -1) pvmid = 485;
        if(strfind("Dozer", vehiclename,true,0) != -1) pvmid = 486;
        if(strfind("Maverick", vehiclename,true,0) != -1) pvmid = 487;
        if(strfind("SAN News Maverick", vehiclename,true,0) != -1) pvmid = 488;
        if(strfind("Rancher", vehiclename,true,0) != -1) pvmid = 489;
        if(strfind("FBI Rancher", vehiclename,true,0) != -1) pvmid = 490;
        if(strfind("Virgo", vehiclename,true,0) != -1) pvmid = 491;
        if(strfind("Greenwood", vehiclename,true,0) != -1) pvmid = 492;
        if(strfind("Jetmax", vehiclename,true,0) != -1) pvmid = 493;
        if(strfind("Hotring Racer", vehiclename,true,0) != -1) pvmid = 494;
        if(strfind("Sandking", vehiclename,true,0) != -1) pvmid = 495;
        if(strfind("Blista Compact", vehiclename,true,0) != -1) pvmid = 496;
        if(strfind("Police Maverick", vehiclename,true,0) != -1) pvmid = 497;
        if(strfind("Boxville", vehiclename,true,0) != -1) pvmid = 498;
        if(strfind("Benson", vehiclename,true,0) != -1) pvmid = 499;
        if(strfind("Mesa", vehiclename,true,0) != -1) pvmid = 500;
        if(strfind("RC Goblin", vehiclename,true,0) != -1) pvmid = 501;
        if(strfind("Hotring Racer", vehiclename,true,0) != -1) pvmid = 502;
        if(strfind("Hotring Racer", vehiclename,true,0) != -1) pvmid = 503;
        if(strfind("Bloodring Banger", vehiclename,true,0) != -1) pvmid = 505;
        if(strfind("Rancher", vehiclename,true,0) != -1) pvmid = 505;
        if(strfind("Super GT", vehiclename,true,0) != -1) pvmid = 506;
        if(strfind("Elegant", vehiclename,true,0) != -1) pvmid = 507;
        if(strfind("Journey", vehiclename,true,0) != -1) pvmid = 508;
        if(strfind("Bike", vehiclename,true,0) != -1) pvmid = 509;
        if(strfind("Mountain Bike", vehiclename,true,0) != -1) pvmid = 510;
        if(strfind("Beagle", vehiclename,true,0) != -1) pvmid = 511;
        if(strfind("Cropduster", vehiclename,true,0) != -1) pvmid = 512;
        if(strfind("Stuntplane", vehiclename,true,0) != -1) pvmid = 513;
        if(strfind("Tanker", vehiclename,true,0) != -1) pvmid = 515;
        if(strfind("Roadtrain", vehiclename,true,0) != -1) pvmid = 515;
        if(strfind("Nebula", vehiclename,true,0) != -1) pvmid = 516;
        if(strfind("Majestic", vehiclename,true,0) != -1) pvmid = 517;
        if(strfind("Buccaneer", vehiclename,true,0) != -1) pvmid = 518;
        if(strfind("Shamal", vehiclename,true,0) != -1) pvmid = 519;
        if(strfind("Hydra", vehiclename,true,0) != -1) pvmid = 520;
        if(strfind("FCR900", vehiclename,true,0) != -1) pvmid = 521;
        if(strfind("NRG500", vehiclename,true,0) != -1) pvmid = 522;
        if(strfind("HPV1000", vehiclename,true,0) != -1) pvmid = 523;
        if(strfind("Cement Truck", vehiclename,true,0) != -1) pvmid = 525;
        if(strfind("Towtruck", vehiclename,true,0) != -1) pvmid = 525;
        if(strfind("Fortune", vehiclename,true,0) != -1) pvmid = 526;
        if(strfind("Cadrona", vehiclename,true,0) != -1) pvmid = 527;
        if(strfind("FBI Truck", vehiclename,true,0) != -1) pvmid = 528;
        if(strfind("Willard", vehiclename,true,0) != -1) pvmid = 529;
        if(strfind("Forklift", vehiclename,true,0) != -1) pvmid = 530;
        if(strfind("Tractor", vehiclename,true,0) != -1) pvmid = 531;
        if(strfind("Combine Harvester", vehiclename,true,0) != -1) pvmid = 532;
        if(strfind("Feltzer", vehiclename,true,0) != -1) pvmid = 533;
        if(strfind("Remington", vehiclename,true,0) != -1) pvmid = 535;
        if(strfind("Slamvan", vehiclename,true,0) != -1) pvmid = 535;
        if(strfind("Blade", vehiclename,true,0) != -1) pvmid = 536;
        if(strfind("Freight Train", vehiclename,true,0) != -1) pvmid = 537;
        if(strfind("Brownstreak Train", vehiclename,true,0) != -1) pvmid = 538;
        if(strfind("Vortex", vehiclename,true,0) != -1) pvmid = 539;
        if(strfind("Vincent", vehiclename,true,0) != -1) pvmid = 540;
        if(strfind("Bullet", vehiclename,true,0) != -1) pvmid = 541;
        if(strfind("Clover", vehiclename,true,0) != -1) pvmid = 542;
        if(strfind("Sadler", vehiclename,true,0) != -1) pvmid = 543;
        if(strfind("Firetruck LA", vehiclename,true,0) != -1) pvmid = 544;
        if(strfind("Hustler", vehiclename,true,0) != -1) pvmid = 545;
        if(strfind("Intruder", vehiclename,true,0) != -1) pvmid = 546;
        if(strfind("Primo", vehiclename,true,0) != -1) pvmid = 547;
        if(strfind("Cargobob", vehiclename,true,0) != -1) pvmid = 548;
        if(strfind("Tampa", vehiclename,true,0) != -1) pvmid = 549;
        if(strfind("Sunrise", vehiclename,true,0) != -1) pvmid = 550;
        if(strfind("Merit", vehiclename,true,0) != -1) pvmid = 551;
        if(strfind("Utility Van", vehiclename,true,0) != -1) pvmid = 552;
        if(strfind("Nevada", vehiclename,true,0) != -1) pvmid = 553;
        if(strfind("Yosemite", vehiclename,true,0) != -1) pvmid = 555;
        if(strfind("Windsor", vehiclename,true,0) != -1) pvmid = 555;
        if(strfind("MonsterA", vehiclename,true,0) != -1) pvmid = 556;
        if(strfind("MonsterB", vehiclename,true,0) != -1) pvmid = 557;
        if(strfind("Uranus", vehiclename,true,0) != -1) pvmid = 558;
        if(strfind("Jester", vehiclename,true,0) != -1) pvmid = 559;
        if(strfind("Sultan", vehiclename,true,0) != -1) pvmid = 560;
        if(strfind("Stratum", vehiclename,true,0) != -1) pvmid = 561;
        if(strfind("Elegy", vehiclename,true,0) != -1) pvmid = 562;
        if(strfind("Raindance", vehiclename,true,0) != -1) pvmid = 563;
        if(strfind("RC Tiger", vehiclename,true,0) != -1) pvmid = 564;
        if(strfind("Flash", vehiclename,true,0) != -1) pvmid = 565;
        if(strfind("Tahoma", vehiclename,true,0) != -1) pvmid = 566;
        if(strfind("Savanna", vehiclename,true,0) != -1) pvmid = 567;
        if(strfind("Bandito", vehiclename,true,0) != -1) pvmid = 568;
        if(strfind("Freight Flat Trailer", vehiclename,true,0) != -1) pvmid = 569;
        if(strfind("Streak Trailer", vehiclename,true,0) != -1) pvmid = 570;
        if(strfind("Kart", vehiclename,true,0) != -1) pvmid = 571;
        if(strfind("Mower", vehiclename,true,0) != -1) pvmid = 572;
        if(strfind("Dune", vehiclename,true,0) != -1) pvmid = 573;
        if(strfind("Sweeper", vehiclename,true,0) != -1) pvmid = 574;
        if(strfind("Broadway", vehiclename,true,0) != -1) pvmid = 575;
        if(strfind("Tornado", vehiclename,true,0) != -1) pvmid = 576;
        if(strfind("AT400", vehiclename,true,0) != -1) pvmid = 577;
        if(strfind("DFT30", vehiclename,true,0) != -1) pvmid = 578;
        if(strfind("Huntley", vehiclename,true,0) != -1) pvmid = 579;
        if(strfind("Stafford", vehiclename,true,0) != -1) pvmid = 580;
        if(strfind("BF400", vehiclename,true,0) != -1) pvmid = 581;
        if(strfind("Newsvan", vehiclename,true,0) != -1) pvmid = 582;
        if(strfind("Tug", vehiclename,true,0) != -1) pvmid = 583;
        if(strfind("Petrol Trailer", vehiclename,true,0) != -1) pvmid = 584;
        if(strfind("Emperor", vehiclename,true,0) != -1) pvmid = 585;
        if(strfind("Wayfarer", vehiclename,true,0) != -1) pvmid = 586;
        if(strfind("Euros", vehiclename,true,0) != -1) pvmid = 587;
        if(strfind("Hotdog", vehiclename,true,0) != -1) pvmid = 588;
        if(strfind("Club", vehiclename,true,0) != -1) pvmid = 589;
        if(strfind("Freight Box Trailer", vehiclename,true,0) != -1) pvmid = 590;
        if(strfind("Article Trailer 3", vehiclename,true,0) != -1) pvmid = 591;
        if(strfind("Andromada", vehiclename,true,0) != -1) pvmid = 592;
        if(strfind("Dodo", vehiclename,true,0) != -1) pvmid = 593;
        if(strfind("RCCam", vehiclename,true,0) != -1) pvmid = 595;
        if(strfind("Launch", vehiclename,true,0) != -1) pvmid = 595;
        if(strfind("Police Car LSPD", vehiclename,true,0) != -1) pvmid = 596;
        if(strfind("Police Car SFPP", vehiclename,true,0) != -1) pvmid = 597;
        if(strfind("Police Car LVPD", vehiclename,true,0) != -1) pvmid = 598;
        if(strfind("Police Ranger", vehiclename,true,0) != -1) pvmid = 599;
        if(strfind("S.W.A.T. SWAT", vehiclename,true,0) != -1) pvmid = 601;
        if(strfind("Alpha", vehiclename,true,0) != -1) pvmid = 602;
        if(strfind("Phoenix", vehiclename,true,0) != -1) pvmid = 603;
        if(strfind("Glendale Shit", vehiclename,true,0) != -1) pvmid = 604;
        if(strfind("Sadler Shit", vehiclename,true,0) != -1) pvmid = 605;
        if(strfind("Baggage Trailer A", vehiclename,true,0) != -1) pvmid = 606;
        if(strfind("Baggage Trailer B", vehiclename,true,0) != -1) pvmid = 607;
        if(strfind("Tug Stairs Trailer", vehiclename,true,0) != -1) pvmid = 608;
        if(strfind("Boxville", vehiclename,true,0) != -1) pvmid = 609;
        if(strfind("Farm Trailer", vehiclename,true,0) != -1) pvmid = 610;
        if(strfind("Utility Trailer", vehiclename,true,0) != -1) pvmid = 611;

        if(strlen(vehiclename) == 3 && strval(vehiclename) >= 400 && strval(vehiclename) <= 611) pvmid = strval(vehiclename);
        if(pvmid == 0) return SendClientMessage(playerid, 0xFF0000AA, "Incorrect Vehicle Name/Model ID");
        new Float:pVposX, Float:pVposY, Float:pVposZ, Float:pVposFA;
        GetPlayerPos(playerid, pVposX, pVposY, pVposZ);
        GetPlayerFacingAngle(playerid, pVposFA);
        if(IsPlayerInAnyVehicle(playerid))
        {
            new VID;
            VID = GetPlayerVehicleID(playerid);
            GetVehicleZAngle(VID, pVposFA);
        }
        new CVID, pVW, pINT;
        pVW = GetPlayerVirtualWorld(playerid);
        pINT = GetPlayerInterior(playerid);
        CVID = CreateVehicle(pvmid, pVposX, pVposY, pVposZ+0.6, pVposFA,color1,color2,0);
        SetVehicleVirtualWorld(CVID, pVW);
        LinkVehicleToInterior(CVID, pINT);
        PutPlayerInVehicle(playerid,CVID,0);
        new pmsg[64];
        format(pmsg,sizeof(pmsg),"[pVehicle] Vehicle ID: %i Created (Model %i).",CVID,pvmid);
        print(pmsg);
        return CVID;
}
Reply
#2

dump

no one can help?

and i have a new question

can someone show me a /car name/id c1 c2
that smaller then my code pls
Reply
#3

pawn Код:
new VehicleNames[212][] = {
    "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","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","Previon","Coach","Cabbie",
    "Stallion","Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","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","ZR3 50","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","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","Trailer",
    "Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford","BF-400","Newsvan","Tug","Trailer A","Emperor",
    "Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C","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"
};
pawn Код:
stock GetVehicleModelIDFromName(const vname[])
{
    for(new i=0; i < sizeof(VehicleNames); i++)
    {
        if (strfind(VehicleNames[i], vname, true) != -1) return i + 400;
    }
    return -1;
}
pawn Код:
stock IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
pawn Код:
CMD:car(playerid,params[])
{
    if(Acc[playerid][Adminlevel]<3) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command");
    new vID[32],modelid,color1,color2;
    if(sscanf(params,"sdd",vID,color1,color2)) return SendClientMessage(playerid,COLOR_RED,"Usage: /car <vehicleid / vehiclename> <color1> <color2>");
    if(IsNumeric(vID)) modelid = strval(vID);
    else modelid = GetVehicleModelIDFromName(vID);
    if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, 0xFF0000AA, "Incorrect Vehicle Name/Model ID");
    new Float:pVposX, Float:pVposY, Float:pVposZ, Float:pVposFA;
    GetPlayerPos(playerid, pVposX, pVposY, pVposZ);
    GetPlayerFacingAngle(playerid, pVposFA);
    if(IsPlayerInAnyVehicle(playerid))
    {
        new VID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VID, pVposFA);
    }
    new CVID, pVW, pINT;
    pVW = GetPlayerVirtualWorld(playerid);
    pINT = GetPlayerInterior(playerid);
    CVID = CreateVehicle(modelid, pVposX, pVposY, pVposZ+0.6, pVposFA,color1,color2,0);
    SetVehicleVirtualWorld(CVID, pVW);
    LinkVehicleToInterior(CVID, pINT);
    PutPlayerInVehicle(playerid,CVID,0);
    new s[128];
    format(s,sizeof s,"Fahrzeug: %s spawned",VehicleNames[modelid-400]);
    SendClientMessage(playerid,COLOR_LBLUE,s);
    printf("[pVehicle] Vehicle ID: %i Created (Model %i).",CVID,modelid);
    return 1;
}
Reply
#4

what did this mean ?

VehicleNames[modelid-400]

and how to make it for weapons
Reply
#5

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
what did this mean ?

VehicleNames[modelid-400]
It shows vehicle model name.

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
how to make it for weapons
Use this function

pawn Код:
stock GetWeaponIDFromName(const WeaponName[])
{
    if(strfind("molotov",WeaponName,true) != -1) return 18;
    new name[32];
    for(new i = 0; i <= 46; i++)
    {
        switch(i)
        {
            case 19,20,21: continue;
            default:
            {
                GetWeaponName(i,name,32);
                if(strfind(name, WeaponName, true) != -1) return i;
            }
        }
    }
    return -1;
}
Reply
#6

hmm ok thanks ^^
but i try the same way as with cars

thanks again
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)