Guest User

[T]AKELOT iT Car System

a guest
Jul 15th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 11.64 KB | None | 0 0
  1. /*CRIADO POR [T]AKELOT .*/
  2. //==============================================================================
  3.  
  4. #include <a_samp>
  5. #include zcmd
  6. #include sscanf
  7.  
  8.  
  9. //==============================================================================
  10.  
  11. #define FILTERSCRIPT
  12. #define NEON 1089
  13. //==============================================================================
  14. new luz[MAX_PLAYERS];
  15.  
  16. new bool:b[MAX_VEHICLES], Float:v[MAX_VEHICLES];
  17.  
  18. //==============================================================================
  19.  
  20. #if defined FILTERSCRIPT
  21.  
  22.  
  23. forward OnPlayerInfoChange(playerid);
  24.  
  25. //==============================================================================
  26.  
  27. new NomeDosVeiculos[][] ={
  28. "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster",
  29. "Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto",
  30. "Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee",
  31. "Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion","Rumpo",
  32. "RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer",
  33. "Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer",
  34. "PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez","Sparrow","Patriot",
  35. "Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina","Comet","BMX",
  36. "Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo",
  37. "Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa",
  38. "RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
  39. "Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain","Nebula","Majestic",
  40. "Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona",
  41. "FBI Truck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight",
  42. "Streak","Vortex","Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob",
  43. "Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A","Monster B","Uranus",
  44. "Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight",
  45. "Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford",
  46. "BF-400","Newsvan","Tug","Trailer A","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C",
  47. "Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)","Police Car (LVPD)","Police Ranger",
  48. "Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
  49. "Stair Trailer","Boxville","Farm Plow","Utility Trailer" };
  50.  
  51. #endif
  52.  
  53. //==============================================================================
  54. public OnFilterScriptInit()
  55. {
  56.     SetTimer("damagedCar",2000,true);
  57.  
  58.     print("\n==================================");
  59.     print(" Filterscript: [iT Car System] Ligado");
  60.     print("====================================\n");
  61.    
  62.     return 1;
  63. }
  64.  
  65. //==============================================================================
  66.  
  67. command(blindar, playerid, params[]) {
  68.     if(!IsPlayerInAnyVehicle(playerid))
  69.         return false;
  70.  
  71.     new vehicleid = GetPlayerVehicleID(playerid);
  72.     b[vehicleid] = true;
  73.  
  74.     GetVehicleHealth(vehicleid, v[vehicleid]);
  75.     SetTimerEx("Blindagem", 5*60000, false, "i", vehicleid);
  76.  
  77.     SendClientMessage(playerid, -1, "{00cc00}Blindagem adcionada");
  78.     return true;
  79. }
  80.  
  81. command(neon, playerid, params[]) {
  82.     new pname[MAX_PLAYER_NAME], string[79 + MAX_PLAYER_NAME];
  83.     GetPlayerName(playerid, pname, sizeof(pname));
  84.     format(string, sizeof(string), "{8080FF}o jogador {E6E6E6}%s {8080FF}Está adcionando um neon ao veiculo. {E6E6E6}[/Neon]", pname);
  85.     SendClientMessageToAll(-1, string);
  86.     ShowPlayerDialog(playerid, NEON, DIALOG_STYLE_LIST, "{FFFF00}# {FFFFFF}Selecione o Neon","Azul\nVerde\nAmarelo\nBranco\nRosa\n{FF0000}Retirar Neon Do Veiculo","Add","Close");
  87.     return true;
  88. }
  89. //==============================================================================
  90. public OnVehicleDamageStatusUpdate(vehicleid, playerid)
  91. {
  92.     if(b[vehicleid] == true)
  93.         return SetVehicleHealth(vehicleid, v[vehicleid]);
  94.     return 1;
  95. }
  96. public OnPlayerStateChange(playerid, newstate, oldstate)
  97. {
  98. if(newstate == PLAYER_STATE_DRIVER)
  99. {
  100.     SendClientMessage(playerid, 0x00CC00FF, "{00CC00}[iT Car System]: Use a a tecla {FFFFFF}2 {00CC00}para ligar ou desligar o veiculo");
  101.     SendClientMessage(playerid, 0x00CC00FF, "{00CC00}[iT Car System]: Para Ligar o Farol Aperte {FFFFFF}Y");
  102. }
  103. new
  104.    str[50],
  105.    oldnew
  106. ;
  107. if (newstate == 2 || newstate == 3)
  108. {
  109.     if (oldnew == 0)
  110.     {
  111.         format(str, sizeof(str), "~g~%s",NomeDosVeiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
  112.         GameTextForPlayer(playerid, str, 6000, 1);
  113.     }
  114. }
  115. return 1;
  116. }
  117.  
  118. public OnPlayerUpdate(playerid) {
  119.     if (GetPlayerVehicleSeat(playerid) == 0)
  120.     {
  121.         new Float:health, engine, lights, alarm, doors, bonnet, boot, objective;
  122.         GetVehicleHealth(GetPlayerVehicleID(playerid), health);
  123.         if (health < 250)
  124.         {
  125.             SetVehicleHealth(GetPlayerVehicleID(playerid), 300.0);
  126.             GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
  127.             SetVehicleParamsEx(GetPlayerVehicleID(playerid), false, lights, alarm, doors, bonnet, boot, objective);
  128.             GameTextForPlayer(playerid, "~h~veiculo quebrado chame um mecanico", 5000, 4);
  129.             SendClientMessage(playerid, 0xFF0000AA, "Falha, chame um mecanico /mecanico .");
  130.         }
  131.     }
  132.     return 1;
  133. }
  134.  
  135. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  136. {
  137. if(newkeys == KEY_YES && IsPlayerInAnyVehicle(playerid))
  138. {
  139.     new engine, lights, alarm, doors, bonnet, boot, objective;
  140.     if(luz[playerid] == 0)
  141.     {
  142.         new veh = GetPlayerVehicleID(playerid);
  143.         GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
  144.         SetVehicleParamsEx(veh, engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
  145.         luz[playerid] = 1;
  146.         GameTextForPlayer(playerid,"~y~farol: ~g~ligado",5000,3);
  147.         }
  148.         else if(luz[playerid] == 1)
  149.         {
  150.         new veh = GetPlayerVehicleID(playerid);
  151.         GetVehicleParamsEx(veh, engine, lights, alarm,doors, bonnet, boot, objective);
  152.         SetVehicleParamsEx(veh, engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
  153.         luz[playerid] = 0;
  154.         GameTextForPlayer(playerid,"~y~FAROL: ~r~DESLIGADO",5000,3);
  155.     }
  156. }
  157. if(newkeys == KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
  158. {
  159.     new mot, lu, alar, por, cap, porma, ob;
  160.     new carro = GetPlayerVehicleID(playerid);
  161.     GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
  162.     if(mot == VEHICLE_PARAMS_OFF)
  163.     {
  164.         SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
  165.         GameTextForPlayer(playerid,"~y~motor: ~g~ligado",5000,3);
  166.         PlayerPlaySound(playerid, 1054 , 0.0, 0.0, 10.0);
  167.         }else{
  168.         GameTextForPlayer(playerid,"~y~motor: ~r~desligado",5000,3);
  169.         PlayerPlaySound(playerid, 1054 , 0.0, 0.0, 10.0);
  170.         SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
  171.     }
  172. }
  173. return 1;
  174. }
  175. forward Blindagem(vehicleid);
  176. public Blindagem(vehicleid) {
  177.     b[vehicleid] = false;
  178.     return true;
  179. }
  180. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  181. {
  182.     if(dialogid == NEON)
  183.     {
  184.         if(response)
  185.         {
  186.             if(listitem == 0)
  187.             {
  188.                 SetPVarInt(playerid, "neon", 1);
  189.                 SetPVarInt(playerid, "blue", CreateObject(18648,0,0,0,0,0,0));
  190.                 SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
  191.                 AttachObjectToVehicle(GetPVarInt(playerid, "blue"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  192.                 AttachObjectToVehicle(GetPVarInt(playerid, "blue1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  193.                 GameTextForPlayer(playerid, "~g~] Neon Azul adcionado ]",3500,5);
  194.             }
  195.             if(listitem == 1)
  196.             {
  197.                 SetPVarInt(playerid, "neon", 1);
  198.                 SetPVarInt(playerid, "green", CreateObject(18649,0,0,0,0,0,0));
  199.                 SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
  200.                 AttachObjectToVehicle(GetPVarInt(playerid, "green"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  201.                 AttachObjectToVehicle(GetPVarInt(playerid, "green1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  202.                 GameTextForPlayer(playerid, "~g~] Neon Verde adcionado ]",3500,5);
  203.             }
  204.             if(listitem == 2)
  205.             {
  206.                 SetPVarInt(playerid, "neon", 1);
  207.                 SetPVarInt(playerid, "yellow", CreateObject(18650,0,0,0,0,0,0));
  208.                 SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
  209.                 AttachObjectToVehicle(GetPVarInt(playerid, "yellow"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  210.                 AttachObjectToVehicle(GetPVarInt(playerid, "yellow1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  211.                 GameTextForPlayer(playerid, "~g~] Neon Amarelo adcionado ]",3500,5);
  212.             }
  213.             if(listitem == 3)
  214.             {
  215.                 SetPVarInt(playerid, "neon", 1);
  216.                 SetPVarInt(playerid, "white", CreateObject(18652,0,0,0,0,0,0));
  217.                 SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
  218.                 AttachObjectToVehicle(GetPVarInt(playerid, "white"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  219.                 AttachObjectToVehicle(GetPVarInt(playerid, "white1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  220.                 GameTextForPlayer(playerid, "~g~] Neon Branco adcionado ]",3500,5);
  221.             }
  222.             if(listitem == 4)
  223.             {
  224.                 SetPVarInt(playerid, "neon", 1);
  225.                 SetPVarInt(playerid, "pink", CreateObject(18651,0,0,0,0,0,0));
  226.                 SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
  227.                 AttachObjectToVehicle(GetPVarInt(playerid, "pink"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  228.                 AttachObjectToVehicle(GetPVarInt(playerid, "pink1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  229.                 GameTextForPlayer(playerid, "~g~] Neon Rosa adcionado ]",3500,5);
  230.             }
  231.             if(listitem == 5)
  232.             {
  233.                 DestroyObject(GetPVarInt(playerid, "blue"));
  234.                 DeletePVar(playerid, "neon");
  235.                 DestroyObject(GetPVarInt(playerid, "blue1"));
  236.                 DeletePVar(playerid, "neon");
  237.                 DestroyObject(GetPVarInt(playerid, "green"));
  238.                 DeletePVar(playerid, "neon");
  239.                 DestroyObject(GetPVarInt(playerid, "green1"));
  240.                 DeletePVar(playerid, "neon");
  241.                 DestroyObject(GetPVarInt(playerid, "yellow"));
  242.                 DeletePVar(playerid, "neon");
  243.                 DestroyObject(GetPVarInt(playerid, "yellow1"));
  244.                 DeletePVar(playerid, "neon");
  245.                 DestroyObject(GetPVarInt(playerid, "white"));
  246.                 DeletePVar(playerid, "neon");
  247.                 DestroyObject(GetPVarInt(playerid, "white1"));
  248.                 DeletePVar(playerid, "neon");
  249.                 DestroyObject(GetPVarInt(playerid, "pink"));
  250.                 DeletePVar(playerid, "neon");
  251.                 DestroyObject(GetPVarInt(playerid, "pink1"));
  252.                 DeletePVar(playerid, "neon");
  253.                 GameTextForPlayer(playerid, "~r~Todos neon foram removidos",3500,5);
  254.             }
  255.         }
  256.     }
  257.     return 1;
  258. }
  259. /*CRIADO POR [T]AKELOT .*/
Advertisement
Add Comment
Please, Sign In to add comment