Advertisement
Guest User

[Fs]Menu De Autos + Car Spawn

a guest
Mar 30th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Hecho por [sT]Alejo/xP_One para Español-Pawno
  3. El Menu De Autos Es De Camilo Yo Solo Modifique Y Agregue Unas Cosas
  4. Bloque Los Hunter, Hydras, Rhino y Eso Bye
  5. */
  6. #include <a_samp>
  7.  
  8. #define ROJO 0xF10000FF //define el color ROJO
  9. #define VERDE 0x006500FF //define el color VERDE
  10. #define AZUL 0x000071FF //define el color AZUL
  11. #define NARANJA 0xBF6500FF //define el color NARANJA
  12. #define COLOR_AZUL 0x33CCFFAA
  13. #define rojo 0xFF0000AA
  14.  
  15. enum AutoPlayer
  16. {
  17. pCar
  18. };
  19. new aVehicleNames[][] = {
  20. "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster",
  21. "Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto",
  22. "Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee",
  23. "Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion","Rumpo",
  24. "RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer",
  25. "Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer",
  26. "PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez","Sparrow","Patriot",
  27. "Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina","Comet","BMX",
  28. "Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo",
  29. "Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa",
  30. "RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
  31. "Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain","Nebula","Majestic",
  32. "Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona",
  33. "FBI Truck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight",
  34. "Streak","Vortex","Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob",
  35. "Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A","Monster B","Uranus",
  36. "Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight",
  37. "Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford",
  38. "BF-400","Newsvan","Tug","Trailer A","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C",
  39. "Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)","Police Car (LVPD)","Police Ranger",
  40. "Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
  41. "Stair Trailer","Boxville","Farm Plow","Utility Trailer" };
  42.  
  43. new AccInfo[MAX_PLAYERS][AutoPlayer];
  44.  
  45.  
  46. forward CarSpawner(playerid,model);
  47. forward ResAuto(vehicleid);
  48. forward BorrarAuto(vehicleid);
  49.  
  50.  
  51. ShowPlayerDefaultDialog( playerid )
  52. {
  53. ShowPlayerDialog( playerid, 2500, DIALOG_STYLE_LIST, "Vehiculos Disponibles", "Aviones\nHelicopteros\nMotos\nConvertibles
  54.  
  55. \nIndustriales\nLowriders\nTodoterreno\nServicio Publico\nElegantes\nDeportivos\nVagones\nBarcos\nTrailers\nCarros Unicos
  56.  
  57. \nRadio Control", "Aceptar", "Cancelar" );
  58. return 1;
  59. }
  60. public OnPlayerCommandText( playerid, cmdtext[] )
  61. {
  62. new cmd[200], idx,String[200],tmp[256];
  63. cmd = strtok(cmdtext, idx);
  64. tmp = strtok(cmdtext, idx);
  65.  
  66. if(strcmp(cmd, "/car", true, 10) == 0)
  67. {
  68. if(!strlen(tmp)) return ShowPlayerDefaultDialog( playerid );
  69. new vehicle = GetVehicleModelIDFromName(tmp);
  70. if(vehicle < 400 || vehicle > 611) return  SendClientMessage(playerid, rojo, "Este Auto No Existe!");
  71. if((vehicle==520)||(vehicle==432)||(vehicle==447)||(vehicle==425)||(vehicle==464)||(vehicle==476)) return SendClientMessage
  72.  
  73. (playerid, rojo, "Este Auto No Existe!");
  74.  
  75. if(IsPlayerInAnyVehicle(playerid))
  76. SendClientMessage(playerid, rojo, "ERROR: Ya Estas En Un Auto!");
  77. else
  78. {
  79. new Float:x, Float:y, Float:z, Float:angle;
  80. GetPlayerPos(playerid, x, y, z);
  81. GetPlayerFacingAngle(playerid, angle);
  82. if(AccInfo[playerid][pCar] != -1)
  83. BorrarAuto(AccInfo[playerid][pCar]);
  84. new vehicleid=CreateVehicle(vehicle, x, y, z+2, angle, -1, -1, -1);
  85. PutPlayerInVehicle(playerid, vehicleid, 0);
  86. SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
  87. LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
  88. AccInfo[playerid][pCar] = vehicleid;
  89. }
  90. format(String, sizeof(String), "Has Aparecido Un %s", aVehicleNames[vehicle - 400]);
  91. SendClientMessage(playerid, 0x33FF33AA, String);
  92. return 1;
  93. }
  94. return 0;
  95. }
  96. public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
  97. {
  98. switch(dialogid)
  99. {
  100.             case 2500 :
  101.             {
  102.                 switch ( listitem )
  103.                 {
  104.                     case 0 : ShowPlayerDialog( playerid, 2501, DIALOG_STYLE_LIST, "Aviones",
  105.  
  106. "Andromada\nAT-400\nBeagle\nCropduster\nDodo\nNevada\nRustler\nShamal\nSkimmer\nStuntplane\nAtras", "Aceptar",
  107.  
  108. "Cancelar" );
  109.                     case 1 : ShowPlayerDialog( playerid, 2502, DIALOG_STYLE_LIST,
  110.  
  111. "Helicopteros", "Cargobob\nLeviathan\nMaverick\nMaverick SATV\nMaverick De Policia\nRaindance\nSeasparrow\nSparrow
  112.  
  113. \nAtras", "Aceptar", "Cancelar" );
  114.                     case 2 : ShowPlayerDialog( playerid, 2503, DIALOG_STYLE_LIST, "Motos",
  115.  
  116. "BF-400\nBike\nBMX\nFaggio\nFCR-900\nFreeway\nMountain Bike\nNRG-500\nPCJ-600\nPizzaboy\nQuad\nSanchez
  117.  
  118. \nWayfarer\nAtras", "Aceptar", "Cancelar" );
  119.                     case 3 : ShowPlayerDialog( playerid, 2504, DIALOG_STYLE_LIST,
  120.  
  121. "Convertibles", "Comet\nFeltzer\nStallion\nWindsor\nAtras", "Aceptar", "Cancelar" );
  122.                     case 4 : ShowPlayerDialog( playerid, 2505, DIALOG_STYLE_LIST,
  123.  
  124. "Industriales", "Benson\nBobcat\nBurrito\nBoxville\nBoxburg\nCement Truck\nDFT-30\nFlatbed\nLinerunner\nMule\nVan SATV
  125.  
  126. \nPacker\nPetrol Tanker\nPony\nRoadtrain\nRumpo\nSadler\nSadler Shit\nTopfun\nTractor\nTrashmaster\nUtility Van\nWalton
  127.  
  128. \nYankee\nYosemite\nAtras", "Aceptar", "Cancelar" );
  129.                     case 5 : ShowPlayerDialog( playerid, 2506, DIALOG_STYLE_LIST,
  130.  
  131. "Lowriders", "Blade\nBroadway\nRemington\nSavanna\nSlamvan\nTahoma\nTornado\nVoodoo\nAtras", "Aceptar", "Cancelar" );
  132.                     case 6 : ShowPlayerDialog( playerid, 2507, DIALOG_STYLE_LIST,
  133.  
  134. "Todoterreno", "Bandito\nBF Injection\nDune\nHuntley\nLandstalker\nMesa\nMonster\nMonster A\nMonster B\nPatriot\nRancher
  135.  
  136. A\nRancher B\nSandking\nAtras", "Aceptar", "Cancelar" );
  137.                     case 7 : ShowPlayerDialog( playerid, 2508, DIALOG_STYLE_LIST, "Servicio
  138.  
  139. Publico", "Ambulancia\nBarracks\nBus\nCabbie\nCoach\nMoto Policia (HPV-1000)\nEnforcer\nFBI Rancher\nFBI Truck\nFiretruck
  140.  
  141. \nFiretruck LA\nPatrulla (LSPD)\nPatrulla (LVPD)\nPatrulla (SFPD)\nRanger\nS.W.A.T\nTaxi\nAtras", "Aceptar", "Cancelar" );
  142.                     case 8 : ShowPlayerDialog( playerid, 2509, DIALOG_STYLE_LIST,
  143.  
  144. "Elegantes", "Admiral\nBloodring Banger\nBravura\nBuccaneer\nCadrona\nClover\nElegant\nElegy\nEmperor\nEsperanto
  145.  
  146. \nFortune\nGlendale Shit\nGlendale\nGreenwood\nHermes\nIntruder\nMajestic\nManana\nMerit\nNebula\nOceanic\nPicador
  147.  
  148. \nPremier\nPrevion\nPrimo\nSentinel\nStafford\nSultan\nSunrise\nTampa\nVincent\nVirgo\nWillard\nWashington\nAtras",
  149.  
  150. "Aceptar", "Cancelar" );
  151.                     case 9 : ShowPlayerDialog( playerid, 2510, DIALOG_STYLE_LIST,
  152.  
  153. "Deportivos", "Alpha\nBanshee\nBlista Compact\nBuffalo\nBullet\nCheetah\nClub\nEuros\nFlash\nHotring Racer\nHotring Racer
  154.  
  155. A\nHotring Racer B\nInfernus\nJester\nPhoenix\nSabre\nSuper GT\nTurismo\nUranus\nZR-350\nAtras", "Aceptar", "Cancelar" );
  156.                     case 10 : ShowPlayerDialog( playerid, 2511, DIALOG_STYLE_LIST,
  157.  
  158. "Vagones", "Moonbeam\nPerenniel\nRegina\nSolair\nStratum\nAtras", "Aceptar", "Cancelar" );
  159.                     case 11 : ShowPlayerDialog( playerid, 2512, DIALOG_STYLE_LIST, "Barcos",
  160.  
  161. "Guardia Costera\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSqualo\nTropic\nAtras", "Aceptar",
  162.  
  163. "Cancelar" );
  164.                     case 12 : ShowPlayerDialog( playerid, 2513, DIALOG_STYLE_LIST, "Trailers",
  165.  
  166. "Article Trailer\nArticle Trailer 2\nArticle Trailer 3\nBaggage Trailer A\nBaggage Trailer B\nFarm Trailer\nFreight Flat Trailer
  167.  
  168. (Train)\nFreight Box Trailer (Train)\nPetrol Trailer\nStreak Trailer (Train)\nStairs Trailer\nUtility Trailer\nAtras", "Aceptar",
  169.  
  170. "Cancelar" );
  171.                     case 13 : ShowPlayerDialog( playerid, 2514, DIALOG_STYLE_LIST, "Carros
  172.  
  173. Unicos", "Baggage\nBrownstreak (Train)\nCaddy\nCamper\nCamper A\nCombine Harvester\nDozer\nDumper\nForklift\nFreight
  174.  
  175. (Train)\nHotknife\nHustler\nHotdog\nKart\nMower\nMr Whoopee\nRomero\nSecuricar\nStretch\nSweeper\nTram\nTowtruck
  176.  
  177. \nTug\nVortex\nAtras", "Aceptar", "Cancelar" );
  178.                     case 14 : ShowPlayerDialog( playerid, 2515, DIALOG_STYLE_LIST, "Radio
  179.  
  180. Control", "RC Bandit\nRC Baron\nRC Raider\nRC Goblin\nRC Tiger\nRC Cam\nAtras", "Aceptar", "Cancelar" );
  181.                 }
  182.             }
  183.             case 2501 :
  184.             {
  185.                 if ( listitem > 10 ) return ShowPlayerDefaultDialog( playerid );
  186.  
  187.                 new
  188.                     modelo[] = { 592, 577, 511, 512, 593, 553, 476, 519, 460, 513 };
  189.  
  190.                 return CarSpawner( playerid, modelo[ listitem ] );
  191.             }
  192.             case 2502 :
  193.             {
  194.                 if ( listitem > 8 ) return ShowPlayerDefaultDialog( playerid );
  195.  
  196.                 new
  197.                     modelo[] = { 548, 417, 487, 488, 497, 563, 447, 469 };
  198.  
  199.                 return CarSpawner( playerid, modelo[ listitem ] );
  200.             }
  201.             case 2503 :
  202.             {
  203.                 if ( listitem > 12 ) return ShowPlayerDefaultDialog( playerid );
  204.  
  205.                 new
  206.                     modelo[] = { 581, 509, 481, 462, 521, 463, 510, 522, 461, 448, 471, 468, 586
  207.  
  208. };
  209.  
  210.                 return CarSpawner( playerid, modelo[ listitem ] );
  211.             }
  212.             case 2504 :
  213.             {
  214.                 if ( listitem > 3 ) return ShowPlayerDefaultDialog( playerid );
  215.  
  216.                 new
  217.                     modelo[] = { 480, 533, 439, 555 };
  218.  
  219.                 return CarSpawner( playerid, modelo[ listitem ] );
  220.             }
  221.             case 2505 :
  222.             {
  223.                 if ( listitem > 24 ) return ShowPlayerDefaultDialog( playerid );
  224.  
  225.                 new
  226.                     modelo[] = { 499, 422, 482, 498, 609, 524, 578, 455, 403, 414, 582, 443, 514, 413, 515, 440,
  227.  
  228. 543, 605, 459, 531, 408, 552, 478, 456, 554 };
  229.  
  230.                 return CarSpawner( playerid, modelo[ listitem ] );
  231.             }
  232.             case 2506 :
  233.             {
  234.                 if ( listitem > 7 ) return ShowPlayerDefaultDialog( playerid );
  235.  
  236.                 new
  237.                     modelo[] = { 536, 575, 534, 567, 535, 566, 576, 412 };
  238.  
  239.                 return CarSpawner( playerid, modelo[ listitem ] );
  240.             }
  241.             case 2507 :
  242.             {
  243.                 if ( listitem > 12 ) return ShowPlayerDefaultDialog( playerid );
  244.  
  245.                 new
  246.                     modelo[] = { 568, 424, 573, 579, 400, 500, 444, 556, 557, 470, 489, 505, 495 };
  247.  
  248.                 return CarSpawner( playerid, modelo[ listitem ] );
  249.             }
  250.             case 2508 :
  251.             {
  252.                 if ( listitem > 17 ) return ShowPlayerDefaultDialog( playerid );
  253.  
  254.                 new
  255.                     modelo[] = { 416, 433, 431, 438, 437, 523, 427, 490, 528, 407, 544, 596, 598, 597, 599, 601,
  256.  
  257. 420 };
  258.  
  259.                 return CarSpawner( playerid, modelo[ listitem ] );
  260.             }
  261.             case 2509 :
  262.             {
  263.                 if ( listitem > 33 ) return ShowPlayerDefaultDialog( playerid );
  264.  
  265.                 new
  266.                     modelo[] = { 445, 504, 401, 518, 527, 542, 507, 562, 585, 419, 526, 604, 466, 492, 474, 546, 517, 410,
  267.  
  268. 551, 516, 467, 600, 426, 436, 547, 405, 580, 560, 550, 549, 540, 491, 529, 421 };
  269.  
  270.                 return CarSpawner( playerid, modelo[ listitem ] );
  271.             }
  272.             case 2510 :
  273.             {
  274.                 if ( listitem > 19 ) return ShowPlayerDefaultDialog( playerid );
  275.  
  276.                 new
  277.                     modelo[] = { 602, 429, 496, 402, 541, 415, 589, 587, 565, 494, 502, 503, 411, 559, 603, 475, 506, 451,
  278.  
  279. 558, 477 };
  280.  
  281.                 return CarSpawner( playerid, modelo[ listitem ] );
  282.             }
  283.             case 2511 :
  284.             {
  285.                 if ( listitem > 4 ) return ShowPlayerDefaultDialog( playerid );
  286.  
  287.                 new
  288.                     modelo[] = { 418, 404, 479, 458, 561 };
  289.  
  290.                 return CarSpawner( playerid, modelo[ listitem ] );
  291.             }
  292.             case 2512 :
  293.             {
  294.                 if ( listitem > 9 ) return ShowPlayerDefaultDialog( playerid );
  295.  
  296.                 new
  297.                     modelo[] = { 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 };
  298.  
  299.                 return CarSpawner( playerid, modelo[ listitem ] );
  300.             }
  301.             case 2513 :
  302.             {
  303.                 if ( listitem > 11 ) return ShowPlayerDefaultDialog( playerid );
  304.  
  305.                 new
  306.                     modelo[] = { 435, 450, 591, 606, 607, 610, 569, 590, 584, 570, 608, 611 };
  307.  
  308.                 return CarSpawner( playerid, modelo[ listitem ] );
  309.             }
  310.             case 2514 :
  311.             {
  312.                 if ( listitem > 23 ) return ShowPlayerDefaultDialog( playerid );
  313.  
  314.                 new
  315.                     modelo[] = { 485, 537, 457, 483, 508, 532, 486, 406, 530, 538, 434, 545, 588, 571, 572, 423, 442, 428,
  316.  
  317. 409, 574, 449, 525, 583, 539 };
  318.  
  319.                 return CarSpawner( playerid, modelo[ listitem ] );
  320.             }
  321.             case 2515 :
  322.             {
  323.                 if ( listitem > 5 ) return ShowPlayerDefaultDialog( playerid );
  324.  
  325.                 new
  326.                     modelo[] = { 441, 464, 465, 501, 564, 594 };
  327.  
  328.                 return CarSpawner( playerid, modelo[ listitem ] );
  329.             }
  330. }
  331. return 0;
  332. }
  333.  
  334. //====================================================================================================
  335.  
  336. public OnPlayerConnect(playerid)
  337. {
  338.     AccInfo[playerid][pCar]         = -1;
  339.     return 1;
  340. }
  341.  
  342. public OnPlayerDisconnect(playerid)
  343. {
  344. if(AccInfo[playerid][pCar] != -1) BorrarAuto(AccInfo[playerid][pCar]);
  345. return 1;
  346. }
  347. //=============================================NUEVA
  348.  
  349. FUNCION===============================================
  350. public CarSpawner(playerid,model)
  351. {
  352.     if(IsPlayerInAnyVehicle(playerid))
  353.     SendClientMessage(playerid, rojo, "ERROR: Ya Estas En Un Auto!");
  354.     else
  355.     {
  356.         new Float:x, Float:y, Float:z, Float:angle;
  357.         GetPlayerPos(playerid, x, y, z);
  358.         GetPlayerFacingAngle(playerid, angle);
  359.  
  360.         if(AccInfo[playerid][pCar] != -1)
  361.         BorrarAuto(AccInfo[playerid][pCar]);
  362.         new vehicleid=CreateVehicle(model, x, y, z+2, angle, -1, -1, -1);
  363.         PutPlayerInVehicle(playerid, vehicleid, 0);
  364.         SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
  365.         LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
  366.         AccInfo[playerid][pCar] = vehicleid;
  367.     }
  368.     return 1;
  369. }
  370.  
  371.  
  372. public BorrarAuto(vehicleid)
  373. {
  374.     for(new i=0;i<MAX_PLAYERS;i++)
  375.     {
  376.         new Float:X,Float:Y,Float:Z;
  377.         if(IsPlayerInVehicle(i, vehicleid))
  378.         {
  379.         RemovePlayerFromVehicle(i);
  380.         GetPlayerPos(i,X,Y,Z);
  381.         SetPlayerPos(i,X,Y+3,Z);
  382.         }
  383.         SetVehicleParamsForPlayer(vehicleid,i,0,1);
  384.     }
  385.     SetTimerEx("ResAuto",1500,0,"i",vehicleid);
  386. }
  387. public ResAuto(vehicleid)
  388. {
  389.     DestroyVehicle(vehicleid);
  390. }
  391.  
  392. public OnVehicleSpawn(vehicleid)
  393. {
  394.     for(new i=0;i<MAX_PLAYERS;i++)
  395.     {
  396.         if(vehicleid==AccInfo[i][pCar])
  397.         {
  398.             BorrarAuto(vehicleid);
  399.             AccInfo[i][pCar]=-1;
  400.         }
  401.     }
  402.     return 1;
  403. }
  404. //=======================Termino De Autos================================
  405. strtok(const string[], &index)
  406. {
  407.    new length = strlen(string);
  408.    while ((index < length) && (string[index] <= ' '))
  409.    {
  410.       index++;
  411.    }
  412.  
  413.    new offset = index;
  414.    new result[20];
  415.    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  416.    {
  417.       result[index - offset] = string[index];
  418.       index++;
  419.    }
  420.    result[index - offset] = EOS;
  421.    return result;
  422. }
  423.  
  424. GetVehicleModelIDFromName(vname[])
  425. {
  426.    for(new i = 0; i < 211; i++)
  427.    {
  428.       if(strfind(aVehicleNames[i], vname, true) != -1)
  429.       return i + 400;
  430.    }
  431.    return -1;
  432. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement