Advertisement
Shiny_

AVC

May 5th, 2013
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 31.21 KB | None | 0 0
  1. /* by Shiny */
  2.  
  3. /*
  4. License:
  5.     Copyright (c) 2013 Shiny
  6.     All rights reserved.
  7.     Redistribution and use, whether in the form of source code, or in the form of executable code, are permitted provided that the following conditions are met:
  8.     Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  9.     Redistribution executable code must retain the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided above with a copy of the software.
  10.     AVC Neither the name nor the name of the Advanced Vehicle Creator can not be used to endorse or promote products derived from this software without specific, expressed in writing their permission.
  11.     This software is provided by Shiny "as is". Each, implied or directly expressed warranty, including the implied warranties of merchantability and fitness for a particular purpose, are excluded.
  12.     In no event shall the copyright holders be liable for any direct, indirect, incidental, special, incidental or consequential damages (not excluding the obligation to provide replacement product or service, the responsibility for the loss of usability, data loss or benefits and breaks companies)
  13.     caused by any means and on the basis of existing contractual liability in the torii, whole or in tort (whether arising from the negligence of the other forms of guilt), arising in any way from the use of or in connection with the use of the software, even if the possibility of such damages warned.
  14. */
  15. #define FILTERSCRIPT // Zcmd need this
  16.  
  17. #include <a_samp>
  18. #include <mselection>
  19. #include <mysql>
  20. #include <YSI\y_iterate>
  21. #include <zcmd>
  22.  
  23. #undef mS_NEXT_TEXT
  24. #undef mS_PREV_TEXT
  25. #undef mS_CANCEL_TEXT
  26.  
  27. #define SQL_HOST                    "Type here your hostname"
  28. #define SQL_USR                     "Type here your username"
  29. #define SQL_PSWRD                   "Type here your password"
  30. #define SQL_DB                      "Type here your database"
  31.  
  32. #define SQL_TABLE                   "elements"
  33. #define SQL_TYPE                    "type"
  34. #define SQL_MODEL                   "model"
  35. #define SQL_CARS                    "vehicle"
  36. #define SQL_SKINS                   "skin"
  37.  
  38. #define mS_NEXT_TEXT                "Next"
  39. #define mS_PREV_TEXT                "Previous"
  40. #define mS_CANCEL_TEXT              "Cancel"
  41. #define UNABLE_TO_CONNECT           "There is issue in trying to connect with database!\nServer must be turn off!"
  42. #define TABLE_WAS_ADDED             "Table `"#SQL_TABLE"` was added!"
  43. #define VEHICLE_SELECTION_CANCEL    "Vehicle selection has been canceled by you!"
  44. #define SKIN_SELECTION_CANCEL       "Skin selection has been canceled by you!"
  45. #define VEHICLE_SELECTED            "Vehicle was chosen!"
  46. #define SKIN_SELECTED               "Skin was chosen!"
  47. #define SELECT_SKIN                 "Select skin"
  48. #define VEHICLE_SELECT_METHOD       "Select the method of vehicle selection"
  49. #define SELECT_BY_CLICK             "Selection by clicking on the vehicle image\n"
  50. #define SELECT_BY_DIALOG            "Selection by clicking and select vehicle from dialog list\n"
  51. #define SELECT_BY_INPUT             "Selection by write vehicle name in dialog input menu"
  52. #define SELECT                      "Select"
  53. #define CANCEL                      "Cancel"
  54. #define CLOSE                       "Close"
  55. #define EMPTY                       ""
  56. #define BAD_VEHICLE_NAME            "Bad vehicle name!"
  57. #define VEHICLE_TYPE_SELECT         "Select category of vehicle"
  58. #define CAR_LIST                    "Airplanes\nHelicopters\nMotorcycles\nBicycles\nConvertibles\nIndustrial\nLowriders\nOff-Road\nPublic\nSaloon\nSport\nWagon\nBoats\nUnique"
  59. #define SELECT_VEHICLE              "Select vehicle"
  60. #define BACK                        "Back"
  61. #define ENTERING_NAME               "Entering the name of the vehicle"
  62. #define ENTER_NAME_IN_FIELD_BELOW   "Enter the name of the vehicle in the box below"
  63. #define OKAY                        "Okay"
  64. #define COMMAND_IS_ONLY_FOR_ADMIN   "This command is available only for admin!"
  65. #define CARS_CREATED_BY_V           "Cars made by using the /v command has been removed."
  66. #define SKIN_COMMAND                CMD:skin(playerid)
  67. #define VEHICLE_COMMAND             CMD:v(playerid, params[])
  68. #define RESPAWN_COMMAND             CMD:respawn(playerid)
  69.  
  70. // #define ONLY_FOR_ADMIN
  71.  
  72. #if !defined mysql_format_ex
  73.     #define mysql_format_ex(%1,%2) format(QueryString, sizeof(QueryString), %1, %2), mysql_query(QueryString)
  74. #endif
  75.  
  76. #if !defined function
  77.     #define function%0(%1) forward%0(%1); public%0(%1)
  78. #endif
  79.  
  80. new bool:Commanded[MAX_VEHICLES];
  81. new MySQL:hMYSQL;
  82. new QueryString[500];
  83. new vehiclelist = mS_INVALID_LISTID;
  84. new skinlist = mS_INVALID_LISTID;
  85. new gVehicleNames[212][] =
  86. {
  87.     "Landstalker", "Bravura", "Buffalo", "Linerunner", "Pereniel", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana",
  88.     "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat",
  89.     "Mr Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks",
  90.     "Hotknife", "Trailer", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
  91.     "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy",
  92.     "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Harley", "RC Baron", "RC Raider", "Glendale", "Oceanic",
  93.     "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR3 50", "Walton", "Regina",
  94.     "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher",
  95.     "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa",
  96.     "RC Goblin", "Hotring Racer", "Hotring Racer", "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike",
  97.     "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", "RoadTrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
  98.     "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Traktor",
  99.     "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover", "Sadler",
  100.     "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor",
  101.     "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna",
  102.     "Bandito", "Freight", "Trailer", "Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley",
  103.     "Stafford", "BF-400", "Newsvan", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "Trailer", "Trailer",
  104.     "Andromeda", "Dodo", "RC Cam", "Launch", "Radiowoz", "Radiowoz", "Radiowoz", "Radiowoz", "Picador", "S.W.A.T. Van",
  105.     "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer", "Luggage Trailer", "Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer"
  106. };
  107.  
  108. enum
  109. {
  110.     DIALOG_VEHICLES_CATEGORY = 0,
  111.     DIALOG_VEHICLES_PLANES,
  112.     DIALOG_VEHICLES_HELICOPTERS,
  113.     DIALOG_VEHICLES_MOTORCYCLES,
  114.     DIALOG_VEHICLES_BIKES,
  115.     DIALOG_VEHICLES_CABRIOS,
  116.     DIALOG_VEHICLES_INDUSTRIALS,
  117.     DIALOG_VEHICLES_LOWRIDERS,
  118.     DIALOG_VEHICLES_OFF_ROAD,
  119.     DIALOG_VEHICLES_PUBLIC,
  120.     DIALOG_VEHICLES_SALOON,
  121.     DIALOG_VEHICLES_SPORT,
  122.     DIALOG_VEHICLES_WAGONS,
  123.     DIALOG_VEHICLES_BOATS,
  124.     DIALOG_VEHICLES_UNIQUE,
  125.     DIALOG_VEHICLES_SELECTOR,
  126.     DIALOG_VEHICLES_INPUT,
  127. };
  128.  
  129. // Stocki:
  130. function Respawning_Vehicles(vehicleid) // by Maktab
  131. {
  132.     RespawnUnusedVehicles();
  133.     SendClientMessage(vehicleid, -1, #CARS_CREATED_BY_V);
  134.     return 1;
  135. }
  136.  
  137. stock RespawnUnusedVehicles()
  138. {
  139.     new UsedVeh[MAX_VEHICLES] = {false, ...};
  140.    
  141.     foreach(Player, playerid)
  142.     UsedVeh[GetPlayerVehicleID(playerid)] = true;
  143.    
  144.     for(new vehicleid = 1; vehicleid != MAX_VEHICLES; vehicleid++)
  145.     {
  146.         if(UsedVeh[vehicleid]) continue;
  147.         if(Commanded[vehicleid]) return DestroyVehicle(vehicleid), Commanded[vehicleid] = false;
  148.         SetVehicleToRespawn(vehicleid);
  149.     }
  150.     return 1;
  151. }
  152.  
  153. stock CreatePlayerVehicle(playerid, modelid)
  154. {
  155.     new vehicle, Float:X, Float:Y, Float:Z, Float:angle;
  156.     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  157.     {
  158.         vehicle = GetPlayerVehicleID(playerid);
  159.         GetVehiclePos(vehicle, X, Y, Z);
  160.         GetVehicleZAngle(vehicle, angle);
  161.         DestroyVehicle(vehicle);
  162.     }
  163.     else
  164.     {
  165.         GetPlayerPos(playerid, X, Y, Z);
  166.         GetPlayerFacingAngle(playerid, angle);
  167.     }
  168.     vehicle = AddStaticVehicle(modelid, X, Y, Z + 1, angle, -1, -1);
  169.     LinkVehicleToInterior(vehicle, GetPlayerInterior(playerid));
  170.     SetVehicleVirtualWorld(vehicle, GetPlayerVirtualWorld(playerid));
  171.     SetVehicleNumberPlate(vehicle, PlayerName(playerid));
  172.     PutPlayerInVehicle(playerid, vehicle, 0);
  173.     Commanded[vehicle] = true;
  174.     return 1;
  175. }
  176.  
  177. stock GetVehicleModelIdByName(vehiclename[])
  178. {
  179.     for(new i = 0; i < 211; i++)
  180.         if(strfind(gVehicleNames[i], vehiclename, true) != -1) return i + 400;
  181.     return -1;
  182. }
  183.  
  184. stock mysql_fetch_field_int(field[])
  185. {
  186.     new tmp_str[30];
  187.     mysql_fetch_field(field, tmp_str);
  188.     return strval(tmp_str);
  189. }
  190.  
  191. stock Float: mysql_fetch_field_float(field[])
  192. {
  193.     new tmp_str[60];
  194.     mysql_fetch_field(field, tmp_str);
  195.     return floatstr(tmp_str);
  196. }
  197.  
  198. stock LoadModelSelectionMenuEx(base_name[], list_type[])
  199. {
  200.     mysql_format_ex("SELECT * FROM %s WHERE "#SQL_TYPE" = '%s'", base_name, list_type);
  201.     mysql_store_result();
  202.     if(!mysql_num_rows())
  203.     {
  204.         printf("-mSelection- WARNING: Failed to load models with type %s", list_type);
  205.         return mS_INVALID_LISTID;
  206.     }
  207.  
  208.     if(gListAmount >= mS_TOTAL_LISTS)
  209.     {
  210.         printf("-mSelection- WARNING: Reached maximum amount of lists, increase \"mS_TOTAL_LISTS\"");
  211.         return mS_INVALID_LISTID;
  212.     }
  213.     new tmp_ItemAmount = gItemAmount; // copy value if loading fails
  214.    
  215.     for(new i; i < mysql_num_rows(); i++)
  216.     {
  217.         mysql_data_seek(i);
  218.         mysql_fetch_row_data();
  219.         if(tmp_ItemAmount >= mS_TOTAL_ITEMS)
  220.         {
  221.             printf("-mSelection- WARNING: Reached maximum amount of items, increase \"mS_TOTAL_ITEMS\"");
  222.             break;
  223.         }
  224.         new mID = mysql_fetch_field_int(SQL_MODEL);
  225.         if(0 <= mID < 20000)
  226.         {
  227.             gItemList[tmp_ItemAmount][mS_ITEM_MODEL] = mID;
  228.             new Float:mRotation[3], Float:mZoom = 1.0;
  229.             new bool:useRotation = false;
  230.            
  231.             if(useRotation)
  232.             {
  233.                 new bool:foundRotZoom = false;
  234.                 for(new val = 0; val < gRotZoomAmount; val++)
  235.                 {
  236.                     if(gRotZoom[val][0] == mRotation[0] && gRotZoom[val][1] == mRotation[1] && gRotZoom[val][2] == mRotation[2] && gRotZoom[val][3] == mZoom)
  237.                     {
  238.                         foundRotZoom = true;
  239.                         gItemList[tmp_ItemAmount][mS_ITEM_ROT_ZOOM_ID] = val;
  240.                         break;
  241.                     }
  242.                 }
  243.                 if(gRotZoomAmount < mS_TOTAL_ROT_ZOOM)
  244.                 {
  245.                     if(!foundRotZoom)
  246.                     {
  247.                         gRotZoom[gRotZoomAmount][0] = mRotation[0];
  248.                         gRotZoom[gRotZoomAmount][1] = mRotation[1];
  249.                         gRotZoom[gRotZoomAmount][2] = mRotation[2];
  250.                         gRotZoom[gRotZoomAmount][3] = mZoom;
  251.                         gItemList[tmp_ItemAmount][mS_ITEM_ROT_ZOOM_ID] = gRotZoomAmount;
  252.                         gRotZoomAmount++;
  253.                     }
  254.                 }
  255.                 else print("-mSelection- WARNING: Not able to save rotation/zoom information. Reached maximum rotation/zoom information count. Increase '#define mS_TOTAL_ROT_ZOOM' to fix the issue");
  256.             }
  257.             else gItemList[tmp_ItemAmount][mS_ITEM_ROT_ZOOM_ID] = -1;
  258.             tmp_ItemAmount++;
  259.         }
  260.     }
  261.     if(tmp_ItemAmount > gItemAmount) // any models loaded ?
  262.     {
  263.         gLists[gListAmount][mS_LIST_START] = gItemAmount;
  264.         gItemAmount = tmp_ItemAmount; // copy back
  265.         gLists[gListAmount][mS_LIST_END] = (gItemAmount-1);
  266.         gListAmount++;
  267.         return (gListAmount-1);
  268.     }
  269.     return mS_INVALID_LISTID;
  270. }  
  271.  
  272. stock str_del_free_space(string[], _char = ' ')
  273. {
  274.     new len = strlen (string);
  275.     if(len)
  276.     {
  277.         new begin = -1, end = len;
  278.         while(string[++begin] == _char){}
  279.         if(string[begin] == EOS)
  280.         {
  281.              string [0] = 0;
  282.              return 1;
  283.         }
  284.         while(string[--end] == _char){}
  285.         strmid(string, string, begin, end+1, len+1);
  286.     }
  287.     return 1;
  288. }
  289.  
  290. stock PlayerName(p)
  291. {
  292.     new N[MAX_PLAYER_NAME];
  293.     GetPlayerName(p, N, sizeof(N));
  294.     return N;
  295. }
  296.  
  297. public OnFilterScriptInit()
  298. {
  299.     hMYSQL = mysql_init(1);
  300.     new mHandle = mysql_connect(SQL_HOST, SQL_USR, SQL_PSWRD, SQL_DB, hMYSQL, 1);
  301.     if(!mHandle) return printf(#UNABLE_TO_CONNECT), SendRconCommand("exit");
  302.        
  303.     new string_[240];
  304.     strcat(string_, "CREATE TABLE IF NOT EXISTS "#SQL_TABLE"");
  305.     strcat(string_, "(");
  306.     strcat(string_, "`"#SQL_TYPE"` varchar(60) DEFAULT NULL,");
  307.     strcat(string_, "`"#SQL_MODEL"` int(11) NOT NULL");
  308.     strcat(string_, ") ENGINE = MyISAM  DEFAULT CHARSET = latin1;");
  309.     mysql_query(string_), printf(#TABLE_WAS_ADDED);
  310.    
  311.     skinlist = LoadModelSelectionMenuEx(#SQL_TABLE, #SQL_SKINS);
  312.     vehiclelist = LoadModelSelectionMenuEx(#SQL_TABLE, #SQL_CARS);
  313.    
  314.     SetTimer("Respawning_Vehicles", 15 * 60 * 1000, true);
  315.     return 1;
  316. }
  317.  
  318. public OnPlayerModelSelection(playerid, response, listid, modelid)
  319. {
  320.     if(listid == vehiclelist)
  321.     {
  322.         if(!response) return SendClientMessage(playerid, 0xFF0000FF, #VEHICLE_SELECTION_CANCEL);
  323.         SendClientMessage(playerid, 0xFF0000FF, #VEHICLE_SELECTED);
  324.         CreatePlayerVehicle(playerid, modelid);
  325.     }
  326.     else if(listid == skinlist)
  327.     {
  328.         if(!response) return SendClientMessage(playerid, 0xFF0000FF, #SKIN_SELECTION_CANCEL);
  329.         SendClientMessage(playerid, 0xFF0000FF, SKIN_SELECTED);
  330.         SetPlayerSkin(playerid, modelid);
  331.     }
  332.     return 1;
  333. }
  334.  
  335. SKIN_COMMAND
  336. {
  337.     ShowModelSelectionMenu(playerid, skinlist, #SELECT_SKIN);
  338.     return 1;
  339. }
  340.  
  341. VEHICLE_COMMAND
  342. {
  343.     str_del_free_space(params);
  344.     if(isnull(params)) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_SELECTOR, DIALOG_STYLE_LIST, #VEHICLE_SELECT_METHOD, #SELECT_BY_CLICK #SELECT_BY_DIALOG #SELECT_BY_INPUT, #SELECT, #EMPTY);
  345.     if(GetVehicleModelIdByName(params) != -1) CreatePlayerVehicle(playerid, GetVehicleModelIdByName(params));
  346.     else return SendClientMessage(playerid, -1, #BAD_VEHICLE_NAME);
  347.     return 1;
  348. }
  349.  
  350. RESPAWN_COMMAND
  351. {
  352. #if defined ONLY_FOR_ADMIN
  353.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, #COMMAND_IS_ONLY_FOR_ADMIN);
  354. #endif
  355.     SendClientMessage(playerid, -1, #CARS_CREATED_BY_V);
  356.     RespawnUnusedVehicles();
  357.     return 1;
  358. }
  359.  
  360. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  361. {
  362.     switch(dialogid)
  363.     {
  364.         case DIALOG_VEHICLES_PLANES:
  365.         {
  366.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  367.             switch(listitem)
  368.             {
  369.                 case 0: CreatePlayerVehicle(playerid, 460);
  370.                 case 1: CreatePlayerVehicle(playerid, 476);
  371.                 case 2: CreatePlayerVehicle(playerid, 511);
  372.                 case 3: CreatePlayerVehicle(playerid, 512);
  373.                 case 4: CreatePlayerVehicle(playerid, 513);
  374.                 case 5: CreatePlayerVehicle(playerid, 519);
  375.                 case 6: CreatePlayerVehicle(playerid, 520);
  376.                 case 7: CreatePlayerVehicle(playerid, 553);
  377.                 case 8: CreatePlayerVehicle(playerid, 577);
  378.                 case 9: CreatePlayerVehicle(playerid, 592);
  379.                 case 10: CreatePlayerVehicle(playerid, 593);
  380.             }
  381.         }
  382.         case DIALOG_VEHICLES_HELICOPTERS:
  383.         {
  384.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  385.             switch(listitem)
  386.             {
  387.                 case 0: CreatePlayerVehicle(playerid, 417);
  388.                 case 1: CreatePlayerVehicle(playerid, 425);
  389.                 case 2: CreatePlayerVehicle(playerid, 469);
  390.                 case 3: CreatePlayerVehicle(playerid, 447);
  391.                 case 4: CreatePlayerVehicle(playerid, 487);
  392.                 case 5: CreatePlayerVehicle(playerid, 488);
  393.                 case 6: CreatePlayerVehicle(playerid, 497);
  394.                 case 7: CreatePlayerVehicle(playerid, 548);
  395.                 case 8: CreatePlayerVehicle(playerid, 563);
  396.             }
  397.         }
  398.         case DIALOG_VEHICLES_MOTORCYCLES:
  399.         {
  400.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  401.             switch(listitem)
  402.             {
  403.                 case 0: CreatePlayerVehicle(playerid, 448);
  404.                 case 1: CreatePlayerVehicle(playerid, 461);
  405.                 case 2: CreatePlayerVehicle(playerid, 462);
  406.                 case 3: CreatePlayerVehicle(playerid, 463);
  407.                 case 4: CreatePlayerVehicle(playerid, 468);
  408.                 case 5: CreatePlayerVehicle(playerid, 471);
  409.                 case 6: CreatePlayerVehicle(playerid, 521);
  410.                 case 7: CreatePlayerVehicle(playerid, 522);
  411.                 case 8: CreatePlayerVehicle(playerid, 523);
  412.                 case 9: CreatePlayerVehicle(playerid, 581);
  413.                 case 10: CreatePlayerVehicle(playerid, 586);
  414.             }
  415.         }
  416.         case DIALOG_VEHICLES_BIKES:
  417.         {
  418.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  419.             switch(listitem)
  420.             {
  421.                 case 0: CreatePlayerVehicle(playerid, 481);
  422.                 case 1: CreatePlayerVehicle(playerid, 509);
  423.                 case 2: CreatePlayerVehicle(playerid, 510);
  424.             }
  425.         }
  426.         case DIALOG_VEHICLES_CABRIOS:
  427.         {
  428.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  429.             switch(listitem)
  430.             {
  431.                 case 0: CreatePlayerVehicle(playerid, 439);
  432.                 case 1: CreatePlayerVehicle(playerid, 480);
  433.                 case 2: CreatePlayerVehicle(playerid, 533);
  434.                 case 3: CreatePlayerVehicle(playerid, 555);
  435.             }
  436.         }
  437.         case DIALOG_VEHICLES_INDUSTRIALS:
  438.         {
  439.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  440.             switch(listitem)
  441.             {
  442.                 case 0: CreatePlayerVehicle(playerid, 499);
  443.                 case 1: CreatePlayerVehicle(playerid, 422);
  444.                 case 2: CreatePlayerVehicle(playerid, 482);
  445.                 case 3: CreatePlayerVehicle(playerid, 498);
  446.                 case 4: CreatePlayerVehicle(playerid, 609);
  447.                 case 5: CreatePlayerVehicle(playerid, 524);
  448.                 case 6: CreatePlayerVehicle(playerid, 578);
  449.                 case 7: CreatePlayerVehicle(playerid, 455);
  450.                 case 8: CreatePlayerVehicle(playerid, 403);
  451.                 case 9: CreatePlayerVehicle(playerid, 414);
  452.                 case 10: CreatePlayerVehicle(playerid, 582);
  453.                 case 11: CreatePlayerVehicle(playerid, 443);
  454.                 case 12: CreatePlayerVehicle(playerid, 514);
  455.                 case 13: CreatePlayerVehicle(playerid, 600);
  456.                 case 14: CreatePlayerVehicle(playerid, 413);
  457.                 case 15: CreatePlayerVehicle(playerid, 515);
  458.                 case 16: CreatePlayerVehicle(playerid, 440);
  459.                 case 17: CreatePlayerVehicle(playerid, 543);
  460.                 case 18: CreatePlayerVehicle(playerid, 605);
  461.                 case 19: CreatePlayerVehicle(playerid, 459);
  462.                 case 20: CreatePlayerVehicle(playerid, 531);
  463.                 case 21: CreatePlayerVehicle(playerid, 408);
  464.                 case 22: CreatePlayerVehicle(playerid, 552);
  465.                 case 23: CreatePlayerVehicle(playerid, 478);
  466.                 case 24: CreatePlayerVehicle(playerid, 456);
  467.                 case 25: CreatePlayerVehicle(playerid, 554);
  468.             }
  469.         }
  470.         case DIALOG_VEHICLES_LOWRIDERS:
  471.         {
  472.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  473.             switch(listitem)
  474.             {
  475.                 case 0: CreatePlayerVehicle(playerid, 412);
  476.                 case 1: CreatePlayerVehicle(playerid, 534);
  477.                 case 2: CreatePlayerVehicle(playerid, 535);
  478.                 case 3: CreatePlayerVehicle(playerid, 536);
  479.                 case 4: CreatePlayerVehicle(playerid, 566);
  480.                 case 5: CreatePlayerVehicle(playerid, 567);
  481.                 case 6: CreatePlayerVehicle(playerid, 575);
  482.                 case 7: CreatePlayerVehicle(playerid, 576);
  483.             }
  484.         }
  485.         case DIALOG_VEHICLES_OFF_ROAD:
  486.         {
  487.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  488.             switch(listitem)
  489.             {
  490.                 case 0: CreatePlayerVehicle(playerid, 400);
  491.                 case 1: CreatePlayerVehicle(playerid, 424);
  492.                 case 2: CreatePlayerVehicle(playerid, 444);
  493.                 case 3: CreatePlayerVehicle(playerid, 470);
  494.                 case 4: CreatePlayerVehicle(playerid, 489);
  495.                 case 5: CreatePlayerVehicle(playerid, 495);
  496.                 case 6: CreatePlayerVehicle(playerid, 500);
  497.                 case 7: CreatePlayerVehicle(playerid, 505);
  498.                 case 8: CreatePlayerVehicle(playerid, 556);
  499.                 case 9: CreatePlayerVehicle(playerid, 557);
  500.                 case 10: CreatePlayerVehicle(playerid, 568);
  501.                 case 11: CreatePlayerVehicle(playerid, 573);
  502.                 case 12: CreatePlayerVehicle(playerid, 579);
  503.             }
  504.         }
  505.         case DIALOG_VEHICLES_PUBLIC:
  506.         {
  507.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  508.             switch(listitem)
  509.             {
  510.                 case 0: CreatePlayerVehicle(playerid, 407);
  511.                 case 1: CreatePlayerVehicle(playerid, 416);
  512.                 case 2: CreatePlayerVehicle(playerid, 420);
  513.                 case 3: CreatePlayerVehicle(playerid, 427);
  514.                 case 4: CreatePlayerVehicle(playerid, 431);
  515.                 case 5: CreatePlayerVehicle(playerid, 432);
  516.                 case 6: CreatePlayerVehicle(playerid, 433);
  517.                 case 7: CreatePlayerVehicle(playerid, 437);
  518.                 case 8: CreatePlayerVehicle(playerid, 438);
  519.                 case 9: CreatePlayerVehicle(playerid, 490);
  520.                 case 10: CreatePlayerVehicle(playerid, 528);
  521.                 case 11: CreatePlayerVehicle(playerid, 544);
  522.                 case 12: CreatePlayerVehicle(playerid, 596);
  523.                 case 13: CreatePlayerVehicle(playerid, 597);
  524.                 case 14: CreatePlayerVehicle(playerid, 598);
  525.                 case 15: CreatePlayerVehicle(playerid, 599);
  526.                 case 16: CreatePlayerVehicle(playerid, 601);
  527.             }
  528.         }
  529.         case DIALOG_VEHICLES_SALOON:
  530.         {
  531.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  532.             switch(listitem)
  533.             {
  534.                 case 0: CreatePlayerVehicle(playerid, 445);
  535.                 case 1: CreatePlayerVehicle(playerid, 504);
  536.                 case 2: CreatePlayerVehicle(playerid, 401);
  537.                 case 3: CreatePlayerVehicle(playerid, 518);
  538.                 case 4: CreatePlayerVehicle(playerid, 527);
  539.                 case 5: CreatePlayerVehicle(playerid, 542);
  540.                 case 6: CreatePlayerVehicle(playerid, 507);
  541.                 case 7: CreatePlayerVehicle(playerid, 562);
  542.                 case 8: CreatePlayerVehicle(playerid, 585);
  543.                 case 9: CreatePlayerVehicle(playerid, 419);
  544.                 case 10: CreatePlayerVehicle(playerid, 526);
  545.                 case 11: CreatePlayerVehicle(playerid, 604);
  546.                 case 12: CreatePlayerVehicle(playerid, 466);
  547.                 case 13: CreatePlayerVehicle(playerid, 492);
  548.                 case 14: CreatePlayerVehicle(playerid, 474);
  549.                 case 15: CreatePlayerVehicle(playerid, 546);
  550.                 case 16: CreatePlayerVehicle(playerid, 517);
  551.                 case 17: CreatePlayerVehicle(playerid, 410);
  552.                 case 18: CreatePlayerVehicle(playerid, 551);
  553.                 case 19: CreatePlayerVehicle(playerid, 516);
  554.                 case 20: CreatePlayerVehicle(playerid, 467);
  555.                 case 21: CreatePlayerVehicle(playerid, 426);
  556.                 case 22: CreatePlayerVehicle(playerid, 436);
  557.                 case 23: CreatePlayerVehicle(playerid, 547);
  558.                 case 24: CreatePlayerVehicle(playerid, 405);
  559.                 case 25: CreatePlayerVehicle(playerid, 580);
  560.                 case 26: CreatePlayerVehicle(playerid, 560);
  561.                 case 27: CreatePlayerVehicle(playerid, 550);
  562.                 case 28: CreatePlayerVehicle(playerid, 549);
  563.                 case 29: CreatePlayerVehicle(playerid, 540);
  564.                 case 30: CreatePlayerVehicle(playerid, 491);
  565.                 case 31: CreatePlayerVehicle(playerid, 529);
  566.                 case 32: CreatePlayerVehicle(playerid, 421);
  567.             }
  568.         }
  569.         case DIALOG_VEHICLES_SPORT:
  570.         {
  571.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  572.             switch(listitem)
  573.             {
  574.                 case 0: CreatePlayerVehicle(playerid, 402);
  575.                 case 1: CreatePlayerVehicle(playerid, 411);
  576.                 case 2: CreatePlayerVehicle(playerid, 415);
  577.                 case 3: CreatePlayerVehicle(playerid, 429);
  578.                 case 4: CreatePlayerVehicle(playerid, 451);
  579.                 case 5: CreatePlayerVehicle(playerid, 475);
  580.                 case 6: CreatePlayerVehicle(playerid, 477);
  581.                 case 7: CreatePlayerVehicle(playerid, 494);
  582.                 case 8: CreatePlayerVehicle(playerid, 496);
  583.                 case 9: CreatePlayerVehicle(playerid, 502);
  584.                 case 10: CreatePlayerVehicle(playerid, 503);
  585.                 case 11: CreatePlayerVehicle(playerid, 506);
  586.                 case 12: CreatePlayerVehicle(playerid, 541);
  587.                 case 13: CreatePlayerVehicle(playerid, 558);
  588.                 case 14: CreatePlayerVehicle(playerid, 559);
  589.                 case 15: CreatePlayerVehicle(playerid, 565);
  590.                 case 16: CreatePlayerVehicle(playerid, 587);
  591.                 case 17: CreatePlayerVehicle(playerid, 589);
  592.                 case 18: CreatePlayerVehicle(playerid, 602);
  593.                 case 19: CreatePlayerVehicle(playerid, 603);
  594.             }
  595.         }
  596.         case DIALOG_VEHICLES_WAGONS:
  597.         {
  598.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  599.             switch(listitem)
  600.             {
  601.                 case 0: CreatePlayerVehicle(playerid, 404);
  602.                 case 1: CreatePlayerVehicle(playerid, 418);
  603.                 case 2: CreatePlayerVehicle(playerid, 458);
  604.                 case 3: CreatePlayerVehicle(playerid, 479);
  605.                 case 4: CreatePlayerVehicle(playerid, 561);
  606.             }
  607.         }
  608.         case DIALOG_VEHICLES_BOATS:
  609.         {
  610.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  611.             switch(listitem)
  612.             {
  613.                 case 0: CreatePlayerVehicle(playerid, 430);
  614.                 case 1: CreatePlayerVehicle(playerid, 446);
  615.                 case 2: CreatePlayerVehicle(playerid, 452);
  616.                 case 3: CreatePlayerVehicle(playerid, 453);
  617.                 case 4: CreatePlayerVehicle(playerid, 454);
  618.                 case 5: CreatePlayerVehicle(playerid, 472);
  619.                 case 6: CreatePlayerVehicle(playerid, 473);
  620.                 case 7: CreatePlayerVehicle(playerid, 484);
  621.                 case 8: CreatePlayerVehicle(playerid, 493);
  622.                 case 9: CreatePlayerVehicle(playerid, 595);
  623.             }
  624.         }
  625.         case DIALOG_VEHICLES_UNIQUE:
  626.         {
  627.             if(!response) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  628.             switch(listitem)
  629.             {
  630.                 case 0: CreatePlayerVehicle(playerid, 485);
  631.                 case 1: CreatePlayerVehicle(playerid, 457);
  632.                 case 2: CreatePlayerVehicle(playerid, 483);
  633.                 case 3: CreatePlayerVehicle(playerid, 508);
  634.                 case 4: CreatePlayerVehicle(playerid, 532);
  635.                 case 5: CreatePlayerVehicle(playerid, 486);
  636.                 case 6: CreatePlayerVehicle(playerid, 406);
  637.                 case 7: CreatePlayerVehicle(playerid, 530);
  638.                 case 8: CreatePlayerVehicle(playerid, 434);
  639.                 case 9: CreatePlayerVehicle(playerid, 545);
  640.                 case 10: CreatePlayerVehicle(playerid, 588);
  641.                 case 11: CreatePlayerVehicle(playerid, 571);
  642.                 case 12: CreatePlayerVehicle(playerid, 572);
  643.                 case 13: CreatePlayerVehicle(playerid, 423);
  644.                 case 14: CreatePlayerVehicle(playerid, 442);
  645.                 case 15: CreatePlayerVehicle(playerid, 428);
  646.                 case 16: CreatePlayerVehicle(playerid, 409);
  647.                 case 17: CreatePlayerVehicle(playerid, 574);
  648.                 case 18: CreatePlayerVehicle(playerid, 525);
  649.                 case 19: CreatePlayerVehicle(playerid, 583);
  650.                 case 20: CreatePlayerVehicle(playerid, 539);
  651.             }
  652.         }
  653.         case DIALOG_VEHICLES_CATEGORY:
  654.         {
  655.             if(!response) return 0;
  656.             switch(listitem)
  657.             {
  658.                 case 0: ShowPlayerDialog(playerid, DIALOG_VEHICLES_PLANES, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Skimmer\nRustler\nBeagle\nCropduster\nStuntplane\nShamal\nHydra\nNevada\nAT400\nAndromada\nDodo", #SELECT, #BACK);
  659.                 case 1: ShowPlayerDialog(playerid, DIALOG_VEHICLES_HELICOPTERS, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Leviathan\nHunter\nSparrow\nSeasparrow\nMaverick\nSAN News Maverick\nPolice Maverick\nCargobob\nRaindance", #SELECT, #BACK);
  660.                 case 2: ShowPlayerDialog(playerid, DIALOG_VEHICLES_MOTORCYCLES, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Pizzaboy\nPCJ-600\nFaggio\nFreeway\nSanchez\nQuad\nFCR-900\nNRG-500\nHPV1000\nBF-400\nWayfarer", #SELECT, #BACK);
  661.                 case 3: ShowPlayerDialog(playerid, DIALOG_VEHICLES_BIKES, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "BMX\nBike\nMountain Bike", #SELECT, #BACK);
  662.                 case 4: ShowPlayerDialog(playerid, DIALOG_VEHICLES_CABRIOS, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Stallion\nComet\nFeltzer", #SELECT, #BACK);
  663.                 case 5: ShowPlayerDialog(playerid, DIALOG_VEHICLES_INDUSTRIALS, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Benson\nBobcat\nBurrito\nBoxville\nBoxburg\nCement Truck\nDFT-30\nFlatbed\nLinerunner\nMule\nNewsvan\nPacker\nTanker\nPicador\nPony\nRoadtrain\nRumpo\nSadler\nSadler Shit\nTopfun\nTractor\nTrashmaster\nUtility Van\nWalton\nYankee\nYosemite", #SELECT, #BACK);
  664.                 case 6: ShowPlayerDialog(playerid, DIALOG_VEHICLES_LOWRIDERS, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Voodoo\nRemington\nSlamvan\nBlade\nTahoma\nSawanna\nBroadway", #SELECT, #BACK);
  665.                 case 7: ShowPlayerDialog(playerid, DIALOG_VEHICLES_OFF_ROAD, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Landstalker\nBF Injection\nMonster A\nPatriot\nRancher A\nSandking\nMesa\nRancher B\nMonster B\nMonster C\nBandito\nDune\nHuntley", #SELECT, #BACK);
  666.                 case 8: ShowPlayerDialog(playerid, DIALOG_VEHICLES_PUBLIC, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Firetruck\nAmbulance\nTaxi\nEnforcer\nBus\nRhino\nBarracks\nCoach\nCabbie\nFBI Rancher\nFBI Truck\nFiretruck LA\nPolice Car (LSPD)\nPolice Car (SFPD)\nPolice Car (LVPD)\nPolice Ranger\nS.W.A.T", #SELECT, #BACK);
  667.                 case 9: ShowPlayerDialog(playerid, DIALOG_VEHICLES_SALOON, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Admiral\nBloodring Banger\nBravura\nBuccaneer\nCadrona\nClover\nElegant\nElegy\nEmperor\nEsperanto\nFortune\nGlendale Shit\nGlendale\nGreendwood\nHermes\nIntruder\nMajestic\nManana\nMerit\nNebula\nOceanic\nPremier\nPrevion\nPrimo\nSentinel\nStafford\nSultan\nSunrise\nTampa\nVincent\nVirgo\nWillard\nWashington", #SELECT, #BACK);
  668.                 case 10: ShowPlayerDialog(playerid, DIALOG_VEHICLES_SPORT, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Buffalo\nInfernus\nCheetah\nBanshee\nTurismo\nSabre\nZR-350\nHotring Racer A\nBlista Compact\nHotring Racer B\nHotring Racer C\nSuper GT\nBullet\nUranus\nJester\nFlash\nEuros\nClub\nAlpha\nPhoenix", #SELECT, #BACK);
  669.                 case 11: ShowPlayerDialog(playerid, DIALOG_VEHICLES_WAGONS, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Perenniel\nMoonbeam\nSolair\nRegina\nStratum", #SELECT, #BACK);
  670.                 case 12: ShowPlayerDialog(playerid, DIALOG_VEHICLES_BOATS, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Predator\nSquallo\nSpeeder\nReefer\nTropic\nCoastguard\nDinghy\nMarquis\nJetmax\nLaunch", #SELECT, #BACK);
  671.                 case 13: ShowPlayerDialog(playerid, DIALOG_VEHICLES_UNIQUE, DIALOG_STYLE_LIST, #SELECT_VEHICLE, "Baggage\nCaddy\nCamper A\nCamper B\nCombine Harvester\nDozer\nDumper\nForklift\nHotknife\nHustler\nHotdog\nKart\nMower\nMr.Whoopee\nRomero\nSecuricar\nStretch\nSweeper\nTowtruck\nTug\nVortex", #SELECT, #BACK);
  672.             }
  673.         }
  674.         case DIALOG_VEHICLES_SELECTOR:
  675.         {
  676.             if(!response) return 0;
  677.             switch(listitem)
  678.             {
  679.                 case 0: ShowModelSelectionMenu(playerid, vehiclelist, #SELECT_VEHICLE);
  680.                 case 1: ShowPlayerDialog(playerid, DIALOG_VEHICLES_CATEGORY, DIALOG_STYLE_LIST, #VEHICLE_TYPE_SELECT, #CAR_LIST, #SELECT, #CLOSE);
  681.                 case 2: ShowPlayerDialog(playerid, DIALOG_VEHICLES_INPUT, DIALOG_STYLE_INPUT, #ENTERING_NAME, #ENTER_NAME_IN_FIELD_BELOW, #OKAY, #CLOSE);
  682.             }
  683.         }
  684.         case DIALOG_VEHICLES_INPUT:
  685.         {
  686.             str_del_free_space(inputtext);
  687.             if(isnull(inputtext)) return ShowPlayerDialog(playerid, DIALOG_VEHICLES_SELECTOR, DIALOG_STYLE_LIST, #VEHICLE_SELECT_METHOD, #SELECT_BY_CLICK #SELECT_BY_DIALOG #SELECT_BY_INPUT, #SELECT, #EMPTY);
  688.             else if(GetVehicleModelIdByName(inputtext) != -1) CreatePlayerVehicle(playerid, GetVehicleModelIdByName(inputtext));
  689.             else return SendClientMessage(playerid, -1, #BAD_VEHICLE_NAME);
  690.         }
  691.     }
  692.     return 1;
  693. }
  694.  
  695. public OnFilterScriptExit()
  696. {
  697.     mysql_close(hMYSQL);
  698.     return 1;
  699. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement