Guest User

[FS] Brzinomjer v2.0

a guest
Jun 9th, 2015
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 26.64 KB | None | 0 0
  1. // SPEEDOMETER CREATED BY Atom (Scott_Walker)
  2. // version 2.0
  3.  
  4. // Copyright
  5.  
  6. #include <a_samp>
  7.  
  8.  
  9. #define GasMax          100                 // Kapacitet rezervoara
  10. #define RunOutTime      12000               // Tajmer goriva
  11. #define RefuelWait      8000                // Tajmer punjenja goriva
  12. #define CAR_AMOUNT      1000                // Kolicina vozila na serveru
  13. #define D_FuelStation   4564                // 4564 definira dijalog
  14.  
  15. #define SCM     SendClientMessage           // kratica
  16. #define SCMTA   SendClientMessageToAll      // kratica
  17. #define GPN     GetPlayerName               // kratica
  18. #define SPD     ShowPlayerDialog            // kratica
  19. #define DSL     DIALOG_STYLE_LIST           // kratica
  20. #define DSI     DIALOG_STYLE_INPUT          // kratica
  21. #define DSM     DIALOG_STYLE_MSGBOX         // kratica
  22.  
  23. #define COLOR_SPEEDOBLUE        0x0098FFFF  // plava boja za snagu vozila
  24. #define COLOR_SPEEDOGREEN       0x32CD32FF  // zelena boja za gorivo
  25. #define COLOR_RED               0xCC0000FF  // crvena boja za TOTALKU
  26.  
  27. ////////////////////////////////////////////////////////////////////////////////
  28. //                  Varijable
  29. ////////////////////////////////////////////////////////////////////////////////
  30. new Gas[CAR_AMOUNT];
  31. new Text: Atomspeedtankline[MAX_PLAYERS];
  32. new Text: Atomkmph[MAX_PLAYERS];
  33. new Text: Atomkmphs;
  34. new Text: Atomvehiclename[MAX_PLAYERS];
  35. new Text: Atompowerline[MAX_PLAYERS];
  36. new Text: Atompowerlines;
  37. new Text: Atompowerlinestext;
  38. new Text: Atomspeedtankstext;
  39. new Text: Atomspeedtank;
  40. new Text: Atombox;
  41. new FORTIMER;
  42. new Float:Velocity [3];
  43. new gGas[MAX_PLAYERS];
  44. new NoFuel[MAX_PLAYERS];
  45. new totaledveh[MAX_VEHICLES];
  46. new refueling[MAX_PLAYERS];
  47. new checkgastimer;
  48. new stoppedvehtimer;
  49. new FuelStation[MAX_PLAYERS];
  50. new MoneyForFuel[MAX_PLAYERS];
  51. new totaled[MAX_PLAYERS];
  52. new Vehicles[212][]=
  53. {
  54. {"Landstalker"},
  55. {"Bravura"},
  56. {"Buffalo"},
  57. {"Linerunner"},
  58. {"Perrenial"},
  59. {"Sentinel"},
  60. {"Dumper"},
  61. {"Firetruck"},
  62. {"Trashmaster"},
  63. {"Stretch"},
  64. {"Manana"},
  65. {"Infernus"},
  66. {"Voodoo"},
  67. {"Pony"},
  68. {"Mule"},
  69. {"Cheetah"},
  70. {"Ambulance"},
  71. {"Leviathan"},
  72. {"Moonbeam"},
  73. {"Esperanto"},
  74. {"Taxi"},
  75. {"Washington"},
  76. {"Bobcat"},
  77. {"Mr. Whoopee"},
  78. {"BF.Injection"},
  79. {"Hunter"},
  80. {"Premier"},
  81. {"Enforcer"},
  82. {"Securicar"},
  83. {"Banshee"},
  84. {"Predator"},
  85. {"Bus"},
  86. {"Rhino"},
  87. {"Barracks"},
  88. {"Hotknife"},
  89. {"Article Trailer"},
  90. {"Previon"},
  91. {"Coach"},
  92. {"Cabbie"},
  93. {"Stallion"},
  94. {"Rumpo"},
  95. {"RC Bandit"},
  96. {"Romero"},
  97. {"Packer"},
  98. {"Monster"},
  99. {"Admiral"},
  100. {"Squalo"},
  101. {"Seasparrow"},
  102. {"Pizzaboy"},
  103. {"Tram"},
  104. {"Article Trailer2"},
  105. {"Turismo"},
  106. {"Speeder"},
  107. {"Reefer"},
  108. {"Tropic"},
  109. {"Flatbed"},
  110. {"Yankee"},
  111. {"Caddy"},
  112. {"Solair"},
  113. {"Berkley's RC Van"},
  114. {"Skimmer"},
  115. {"PCJ-600"},
  116. {"Faggio"},
  117. {"Freeway"},
  118. {"RC Baron"},
  119. {"RC Raider"},
  120. {"Glendale"},
  121. {"Oceanic"},
  122. {"Sanchez"},
  123. {"Sparrow"},
  124. {"Patriot"},
  125. {"Quad"},
  126. {"Coastguard"},
  127. {"Dinghy"},
  128. {"Hermes"},
  129. {"Sabre"},
  130. {"Rustler"},
  131. {"ZR-350"},
  132. {"Walton"},
  133. {"Regina"},
  134. {"Comet"},
  135. {"BMX"},
  136. {"Burrito"},
  137. {"Camper"},
  138. {"Marquis"},
  139. {"Baggage"},
  140. {"Dozer"},
  141. {"Maverick"},
  142. {"News Chopper"},
  143. {"Rancher"},
  144. {"FBI Rancher"},
  145. {"Virgo"},
  146. {"Greenwood"},
  147. {"Jetmax"},
  148. {"Hotring"},
  149. {"Sandking"},
  150. {"Blista Compact"},
  151. {"PD Maverick"},
  152. {"Boxville"},
  153. {"Benson"},
  154. {"Mesa"},
  155. {"RC Goblin"},
  156. {"Hotring Racer A"},
  157. {"Hotring Racer B"},
  158. {"Bloodring Banger"},
  159. {"Rancher"},
  160. {"Super GT"},
  161. {"Elegant"},
  162. {"Journey"},
  163. {"Bike"},
  164. {"MountainBike"},
  165. {"Beagle"},
  166. {"Cropdust"},
  167. {"Stunt"},
  168. {"Tanker"},
  169. {"Roadtrain"},
  170. {"Nebula"},
  171. {"Majestic"},
  172. {"Buccaneer"},
  173. {"Shamal"},
  174. {"Hydra"},
  175. {"FCR-900"},
  176. {"NRG-500"},
  177. {"HPV1000"},
  178. {"Cement Truck"},
  179. {"Tow Truck"},
  180. {"Fortune"},
  181. {"Cadrona"},
  182. {"FBI Truck"},
  183. {"Willard"},
  184. {"Forklift"},
  185. {"Tractor"},
  186. {"Combine"},
  187. {"Feltzer"},
  188. {"Remington"},
  189. {"Slamvan"},
  190. {"Blade"},
  191. {"Freight"},
  192. {"Streak"},
  193. {"Vortex"},
  194. {"Vincent"},
  195. {"Bullet"},
  196. {"Clover"},
  197. {"Sadler"},
  198. {"Firetruck"},
  199. {"Hustler"},
  200. {"Intruder"},
  201. {"Primo"},
  202. {"Cargobob"},
  203. {"Tampa"},
  204. {"Sunrise"},
  205. {"Merit"},
  206. {"Utility"},
  207. {"Nevada"},
  208. {"Yosemite"},
  209. {"Windsor"},
  210. {"Monster A"},
  211. {"Monster B"},
  212. {"Uranus"},
  213. {"Jester"},
  214. {"Sultan"},
  215. {"Stratum"},
  216. {"Elegy"},
  217. {"Raindance"},
  218. {"RC Tiger"},
  219. {"Flash"},
  220. {"Tahoma"},
  221. {"Savanna"},
  222. {"Bandito"},
  223. {"Freight Flat"},
  224. {"Streak Carriage"},
  225. {"Kart"},{"Mower"},
  226. {"Dunerider"},
  227. {"Sweeper"},
  228. {"Broadway"},
  229. {"Tornado"},
  230. {"AT-400"},
  231. {"DFT-30"},
  232. {"Huntley"},
  233. {"Stafford"},
  234. {"BF-400"},
  235. {"Newsvan"},
  236. {"Tug"},
  237. {"Article Trailer 3"},
  238. {"Emperor"},
  239. {"Wayfarer"},
  240. {"Euros"},
  241. {"Mobile Hotdog"},
  242. {"Club"},
  243. {"Freight Carriage"},
  244. {"Trailer 3"},
  245. {"Andromada"},
  246. {"Dodo"},
  247. {"RC Cam"},
  248. {"Launch"},
  249. {"Police Car"},
  250. {"Police Car"},
  251. {"Police Car"},
  252. {"Police Ranger"},
  253. {"Picador"},
  254. {"SWAT Van"},
  255. {"Alpha"},
  256. {"Phoenix"},
  257. {"Glendale"},
  258. {"Sadler"},
  259. {"Luggage Trailer A"},
  260. {"Luggage Trailer B"},
  261. {"Stair Trailer"},
  262. {"Boxville"},
  263. {"Farm Plow"},
  264. {"Utility Trailer"}
  265. };
  266. ////////////////////////////////////////////////////////////////////////////////
  267. //                  Forwardi
  268. ////////////////////////////////////////////////////////////////////////////////
  269. forward CheckGas(playerid);
  270. forward Fillup();
  271. forward AtomSpeedometer(playerid);
  272. forward IsAtGasStation(playerid);
  273. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  274. ////////////////////////////////////////////////////////////////////////////////
  275. //                  Publici
  276. ////////////////////////////////////////////////////////////////////////////////
  277. public OnFilterScriptInit()
  278. {
  279.     FORTIMER = SetTimer("AtomSpeedometer",400,1);
  280.     checkgastimer = SetTimer("CheckGas", RunOutTime, 1);
  281.     stoppedvehtimer = SetTimer("StoppedVehicle", RunOutTime, 1);
  282.     SetTimer("Speed",1500,1);
  283.  
  284.     /////////////////////////////////////////////////////////////////
  285.     //              Textdrawi
  286.     /////////////////////////////////////////////////////////////////
  287.     Atombox = TextDrawCreate(558.000000,365,"_");
  288.     TextDrawLetterSize(Atombox,0.5,9.000000);
  289.     TextDrawUseBox(Atombox,1);
  290.     TextDrawBoxColor(Atombox,0x00000060);
  291.     TextDrawTextSize(Atombox,650,450);
  292.  
  293.     Atomkmphs = TextDrawCreate(615.000000, 425.000000, "km/h");
  294.     TextDrawBackgroundColor(Atomkmphs, 255);
  295.     TextDrawFont(Atomkmphs, 3);
  296.     TextDrawLetterSize(Atomkmphs, 0.200000, 1.000000);
  297.     TextDrawColor(Atomkmphs, 0xFFFFFFFF);
  298.     TextDrawSetOutline(Atomkmphs, 1);
  299.  
  300.     Atomspeedtankstext = TextDrawCreate(561.500000,365.000000,"gorivo");
  301.     TextDrawBackgroundColor(Atomspeedtankstext, 255);
  302.     TextDrawFont(Atomspeedtankstext, 3);
  303.     TextDrawLetterSize(Atomspeedtankstext, 0.200000, 1.000000);
  304.     TextDrawColor(Atomspeedtankstext, 0xFFFFFFFF);
  305.     TextDrawSetOutline(Atomspeedtankstext, 1);
  306.  
  307.     Atompowerlinestext = TextDrawCreate(561.500000,385.000000,"snaga vozila");
  308.     TextDrawBackgroundColor(Atompowerlinestext, 255);
  309.     TextDrawFont(Atompowerlinestext, 3);
  310.     TextDrawLetterSize(Atompowerlinestext, 0.200000, 1.000000);
  311.     TextDrawColor(Atompowerlinestext, 0xFFFFFFFF);
  312.     TextDrawSetOutline(Atompowerlinestext, 1);
  313.  
  314.     Atompowerlines = TextDrawCreate(559.500000,396.500000,"_");
  315.     TextDrawUseBox(Atompowerlines,1);
  316.     TextDrawBoxColor(Atompowerlines,0x000000ff);
  317.     TextDrawTextSize(Atompowerlines,635.500000,1.000000);
  318.     TextDrawAlignment(Atompowerlines,0);
  319.     TextDrawBackgroundColor(Atompowerlines,0x000000ff);
  320.     TextDrawFont(Atompowerlines,3);
  321.     TextDrawLetterSize(Atompowerlines,0.199999,0.600000);
  322.     TextDrawColor(Atompowerlines,0xffffffff);
  323.     TextDrawSetOutline(Atompowerlines,1);
  324.  
  325.     Atomspeedtank = TextDrawCreate(559.500000,376.500000,"_");
  326.     TextDrawUseBox(Atomspeedtank,1);
  327.     TextDrawBoxColor(Atomspeedtank,0x000000ff);
  328.     TextDrawTextSize(Atomspeedtank,635.500000,1.000000);
  329.     TextDrawAlignment(Atomspeedtank,0);
  330.     TextDrawBackgroundColor(Atomspeedtank,0x000000ff);
  331.     TextDrawFont(Atomspeedtank,3);
  332.     TextDrawLetterSize(Atomspeedtank,0.199999,0.600000);
  333.     TextDrawColor(Atomspeedtank,0xffffffff);
  334.     TextDrawSetOutline(Atomspeedtank,1);
  335.  
  336.     for(new i=0; i<GetMaxPlayers(); i++)
  337.     {
  338.         Atompowerline[i] = TextDrawCreate(560.000000,397.500000,"_");
  339.         TextDrawUseBox(Atompowerline[i],1);
  340.         TextDrawBoxColor(Atompowerline[i],COLOR_SPEEDOBLUE);
  341.         TextDrawAlignment(Atompowerline[i],0);
  342.         TextDrawBackgroundColor(Atompowerline[i],0x000000ff);
  343.         TextDrawFont(Atompowerline[i],3);
  344.         TextDrawLetterSize(Atompowerline[i],1.000000,0.3);
  345.         TextDrawColor(Atompowerline[i],0xffffffff);
  346.         TextDrawSetOutline(Atompowerline[i],1);
  347.  
  348.         Atomspeedtankline[i] = TextDrawCreate(560.000000,377.50000,"_");
  349.         TextDrawUseBox(Atomspeedtankline[i],1);
  350.         TextDrawBoxColor(Atomspeedtankline[i],COLOR_SPEEDOGREEN);
  351.         TextDrawAlignment(Atomspeedtankline[i],0);
  352.         TextDrawBackgroundColor(Atomspeedtankline[i],0x000000ff);
  353.         TextDrawFont(Atomspeedtankline[i],3);
  354.         TextDrawLetterSize(Atomspeedtankline[i],1.000000,0.3);
  355.         TextDrawColor(Atomspeedtankline[i],0xffffffff);
  356.         TextDrawSetOutline(Atomspeedtankline[i],1);
  357.  
  358.         Atomkmph[i] = TextDrawCreate(565.000000, 400.000000, "_");
  359.         TextDrawBackgroundColor(Atomkmph[i], 255);
  360.         TextDrawFont(Atomkmph[i], 3);
  361.         TextDrawLetterSize(Atomkmph[i], 0.800000, 4.000000);
  362.         TextDrawColor(Atomkmph[i], 0xFFFFFFFF);
  363.         TextDrawSetOutline(Atomkmph[i], 1);
  364.  
  365.         Atomvehiclename[i] = TextDrawCreate(565.000000, 435.000000, "_");
  366.         TextDrawBackgroundColor(Atomvehiclename[i], 255);
  367.         TextDrawFont(Atomvehiclename[i], 2);
  368.         TextDrawLetterSize(Atomvehiclename[i], 0.200000, 1.000000);
  369.         TextDrawColor(Atomvehiclename[i], 0xFFFFFFFF);
  370.         TextDrawSetOutline(Atomvehiclename[i], 1);
  371.     }
  372. /////////////////////////////////////////////////////////////////////////////
  373.  
  374.     for(new v=0;v<CAR_AMOUNT;v++)
  375.     {
  376.         Gas[v] = GasMax;
  377.         new engine, lights, alarm, doors, bonnet, boot, objective;
  378.         GetVehicleParamsEx(v,engine,lights, alarm, doors, bonnet, boot, objective);
  379.         SetVehicleParamsEx(v, 0, lights, alarm, doors, bonnet, boot, objective); // Samo je motor promjenjen u 1
  380.     }
  381.  
  382.     print("\n--------------------------------------");
  383.     print(" Speedometer by Atom ucitano");
  384.     print("--------------------------------------\n");
  385.     return 1;
  386. }
  387.  
  388. public OnFilterScriptExit()
  389. {
  390.     return 1;
  391. }
  392.  
  393. public OnGameModeInit()
  394. {
  395.     // Don't use these lines if it's a filterscript
  396.     return 1;
  397. }
  398.  
  399. public OnGameModeExit()
  400. {
  401.     KillTimer(checkgastimer);
  402.     KillTimer(stoppedvehtimer);
  403.     KillTimer(FORTIMER);
  404.     return 1;
  405. }
  406.  
  407. public OnPlayerConnect(playerid)
  408. {
  409.     gGas[playerid] = 0;
  410.     return 1;
  411. }
  412.  
  413. public OnPlayerCommandText(playerid, cmdtext[])
  414. {
  415.     if (strcmp("/fill", cmdtext, true, 10))
  416.     {
  417.         new string[128];
  418.         new engine, lights, alarm, doors, bonnet, boot, objective;
  419.         if(IsPlayerConnected(playerid))
  420.         {
  421.             if(IsAtGasStation(playerid))
  422.             {
  423.                 new vehicle = GetPlayerVehicleID(playerid);
  424.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Bike(vehicle))
  425.                 {
  426.                     if(Gas[vehicle] <= 99)
  427.                     {
  428.                         MoneyForFuel[playerid] = GasMax - Gas[vehicle];
  429.                         format(string, sizeof(string),"{C9FFAB}Unesite cijenu za koju zelite napuniti vozilo.\nMaksimalna cijena za gorivo iznosi %d.", MoneyForFuel[playerid]);
  430.                         SPD(playerid,D_FuelStation,DSI,"Punjenje rezervoara",string,"Odaberi","Odustani");
  431.                         GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  432.                         SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
  433.                     }
  434.                     else
  435.                     {
  436.                         GameTextForPlayer(playerid,"~g~~n~~n~~n~~n~~n~Rezervoar je pun.",3000,3);
  437.                     }
  438.                 }
  439.             }
  440.             else
  441.             {
  442.                 SendClientMessage(playerid,-1,"{C3C3C3}Niste na benzinskoj pumpi.");
  443.             }
  444.         }
  445.         else SCM(playerid, -1, "{FFAF00}Komanda /napuni ne postoji.");
  446.         return 1;
  447.     }
  448.     return 1;
  449. }
  450.  
  451. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  452. {
  453.     return 1;
  454. }
  455.  
  456. public OnPlayerExitVehicle(playerid, vehicleid)
  457. {
  458.     return 1;
  459. }
  460.  
  461. public OnPlayerStateChange(playerid, newstate, oldstate)
  462. {
  463.     return 1;
  464. }
  465.  
  466. public OnPlayerEnterCheckpoint(playerid)
  467. {
  468.     return 1;
  469. }
  470.  
  471. public OnPlayerLeaveCheckpoint(playerid)
  472. {
  473.     return 1;
  474. }
  475.  
  476. public OnPlayerEnterRaceCheckpoint(playerid)
  477. {
  478.     return 1;
  479. }
  480.  
  481. public OnPlayerLeaveRaceCheckpoint(playerid)
  482. {
  483.     return 1;
  484. }
  485.  
  486. public OnRconCommand(cmd[])
  487. {
  488.     return 1;
  489. }
  490.  
  491. public OnPlayerRequestSpawn(playerid)
  492. {
  493.     return 1;
  494. }
  495.  
  496. public OnObjectMoved(objectid)
  497. {
  498.     return 1;
  499. }
  500.  
  501. public OnPlayerObjectMoved(playerid, objectid)
  502. {
  503.     return 1;
  504. }
  505.  
  506. public OnPlayerPickUpPickup(playerid, pickupid)
  507. {
  508.     return 1;
  509. }
  510.  
  511. public OnVehicleMod(playerid, vehicleid, componentid)
  512. {
  513.     return 1;
  514. }
  515.  
  516. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  517. {
  518.     return 1;
  519. }
  520.  
  521. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  522. {
  523.     return 1;
  524. }
  525.  
  526. public OnPlayerSelectedMenuRow(playerid, row)
  527. {
  528.     return 1;
  529. }
  530.  
  531. public OnPlayerExitedMenu(playerid)
  532. {
  533.     return 1;
  534. }
  535.  
  536. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  537. {
  538.     return 1;
  539. }
  540.  
  541. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  542. {
  543.     new vehicle = GetPlayerVehicleID(playerid);
  544.     new engine, lights, alarm, doors, bonnet, boot, objective;
  545.     if(IsPlayerInAnyVehicle(playerid))
  546.     {
  547.         if(newkeys == KEY_NO)
  548.         {
  549.             if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Bike(vehicle))
  550.             {
  551.                 new Float: health;
  552.                 GetVehicleHealth(vehicle, health);
  553.                 GetVehicleParamsEx(vehicle,engine,lights, alarm, doors, bonnet, boot, objective);
  554.                 if(engine == 0)
  555.                 {
  556.                     if(health <= 350)
  557.                     {
  558.                         SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Nemozete upaliti vozilo jer je previse osteceno.");
  559.                     }
  560.                     else if(Gas[vehicle] < 3)
  561.                     {
  562.                         SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Nemozete upaliti vozilo jer je rezervoar prazan.");
  563.                     }
  564.                     else
  565.                     {
  566.                         SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Upalili ste motor vozila.");
  567.                         GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  568.                         SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
  569.                     }
  570.                 }
  571.                 else
  572.                 {
  573.                     SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Ugasili ste motor vozila.");
  574.                     SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
  575.                 }
  576.             }
  577.         }
  578.     }
  579.     return 1;
  580. }
  581.  
  582. public OnRconLoginAttempt(ip[], password[], success)
  583. {
  584.     return 1;
  585. }
  586.  
  587. public OnPlayerUpdate(playerid)
  588. {
  589.     return 1;
  590. }
  591.  
  592. public OnPlayerStreamIn(playerid, forplayerid)
  593. {
  594.     return 1;
  595. }
  596.  
  597. public OnPlayerStreamOut(playerid, forplayerid)
  598. {
  599.     return 1;
  600. }
  601.  
  602. public OnVehicleStreamIn(vehicleid, forplayerid)
  603. {
  604.     return 1;
  605. }
  606.  
  607. public OnVehicleStreamOut(vehicleid, forplayerid)
  608. {
  609.     return 1;
  610. }
  611.  
  612. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  613. {
  614.     new string[2048];
  615.     new engine, lights, alarm, doors, bonnet, boot, objective;
  616.     new vehicle = GetPlayerVehicleID(playerid);
  617.     new money = GetPlayerMoney(playerid);
  618.     switch(dialogid)
  619.     {
  620.         case D_FuelStation:
  621.         {
  622.             if(response)
  623.             {
  624.                 MoneyForFuel[playerid] = GasMax - Gas[vehicle];
  625.                 if(strval(inputtext) > 0 && strval(inputtext) <= MoneyForFuel[playerid])
  626.                 {
  627.                     if(money > MoneyForFuel[playerid])
  628.                     {
  629.                         GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  630.                         SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
  631.                         GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~Rezervoar se puni...",3000,3);
  632.                         SetTimer("Fillup",RefuelWait,0);
  633.                         refueling[playerid] = 1;
  634.                         FuelStation[playerid] = strval(inputtext);
  635.                     }
  636.                     else
  637.                     {
  638.                         format(string,sizeof(string),"{C9FFAB}Nemate dovoljno novca, treba vam %d$",MoneyForFuel[playerid]);
  639.                         SCM(playerid,-1,string);
  640.                     }
  641.                 }
  642.                 else
  643.                 {
  644.                     format(string, sizeof(string),"{C9FFAB}Unijeli ste preveliku cifru.\n\nUnesite cijenu za koju zelite napuniti vozilo.\nMaksimalna cijena za gorivo iznosi %d.", MoneyForFuel[playerid]);
  645.                     SPD(playerid,D_FuelStation,DSI,"Punjenje rezervoara",string,"Odaberi","Odustani");
  646.                 }
  647.             }
  648.             else
  649.             {
  650.                 GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  651.                 SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
  652.             }
  653.         }
  654.     }
  655.     return 1;
  656. }
  657.  
  658. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  659. {
  660.     return 1;
  661. }
  662. public Fillup()
  663. {
  664.     for(new i=0; i<GetMaxPlayers(); i++)
  665.     {
  666.         new string[128];
  667.         new vehicle = GetPlayerVehicleID(i);
  668.         if(refueling[i] == 1)
  669.         {
  670.             Gas[vehicle] += FuelStation[i];
  671.             format(string,sizeof(string),"{C9FFAB}Vase vozilo je napunjeno sa gorivom, cijena: %d$",FuelStation[i]);
  672.             SCM(i,-1,string);
  673.             GivePlayerMoney(i, - FuelStation[i]);
  674.             refueling[i] = 0;
  675.             new engine, lights, alarm, doors, bonnet, boot, objective;
  676.             GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  677.             SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
  678.         }
  679.     }
  680.     return 1;
  681. }
  682. public CheckGas(playerid)
  683. {
  684.     new engine, lights, alarm, doors, bonnet, boot, objective;
  685.     for(new i=0; i<GetMaxPlayers(); i++)
  686.     {
  687.         new vehicle = GetPlayerVehicleID(i);
  688.         if(GetPlayerState(i) == PLAYER_STATE_DRIVER && Bike(vehicle))
  689.         {
  690.             GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  691.             if(engine == 1)
  692.             {
  693.                 if(Gas[vehicle] >= 5)
  694.                 {
  695.                     if(Gas[vehicle] <= 13)
  696.                     {
  697.                         PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  698.                         if(gGas[i] == 0)
  699.                         {
  700.                             GameTextForPlayer(i,"~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Rezerva",5000,3);
  701.                         }
  702.                     }
  703.                     Gas[vehicle]--;
  704.                 }
  705.                 else
  706.                 {
  707.                     NoFuel[i] = 1;
  708.                     SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective); // ONLY the engine param was changed (to 1)
  709.                     GameTextForPlayer(i,"~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Rezerva",1500,3);
  710.                 }
  711.             }
  712.         }
  713.     }
  714.     return 1;
  715. }
  716. public AtomSpeedometer(playerid)
  717. {
  718.     for(new i=0; i<GetMaxPlayers(); i++)
  719.     {
  720.         if(IsPlayerConnected(i))
  721.         {
  722.             if(IsPlayerInAnyVehicle(i))
  723.             {
  724.                 new vehicle = GetPlayerVehicleID(i);
  725.                 if(GetPlayerState(i) == PLAYER_STATE_DRIVER && Bike(vehicle))
  726.                 {
  727.                     new Float: health;
  728.                     GetVehicleHealth(GetPlayerVehicleID(i), health);
  729.                     if(health <= 350)
  730.                     {
  731.                         if(IsPlayerAdmin(i))
  732.                         {
  733.                             TextDrawTextSize(Atompowerline[i],578.750000,0.000000);
  734.                             SetVehicleHealth(vehicle,1000);
  735.                             RepairVehicle(vehicle);
  736.                         }
  737.                         else
  738.                         {
  739.                             TextDrawTextSize(Atompowerline[i],578.750000,0.000000);
  740.                             GameTextForPlayer(i,"~w~pritisnite tipku~n~~r~F / enter~n~~w~da napustite vozilo~n~~n~~n~~n~~n~~n~~n~~r~TOTALKA",5000,3);
  741.                             SetVehicleHealth(vehicle,350);
  742.                             TextDrawBoxColor(Atompowerline[i],COLOR_RED);
  743.                             totaled[i] = 1;
  744.                             new engine, lights, alarm, doors, bonnet, boot, objective;
  745.                             GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  746.                             SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective); // ugasen motor
  747.                             totaledveh[vehicle] = 1;
  748.                         }
  749.                     }
  750.                     else if(health >= 1000)
  751.                     {
  752.                         TextDrawTextSize(Atompowerline[i],635.00000,0.000000);
  753.                         TextDrawBoxColor(Atompowerline[i],COLOR_SPEEDOBLUE);
  754.                     }
  755.                     else
  756.                     {
  757.                         TextDrawBoxColor(Atompowerline[i],COLOR_SPEEDOBLUE);
  758.                         TextDrawTextSize(Atompowerline[i],floatadd(560.0, floatdiv(health, 13.333333)),0.000000);
  759.                     }
  760.                     if(Gas[vehicle] <= 13)
  761.                     {
  762.                         TextDrawTextSize(Atomspeedtankline[i],560.000000,0.000000);
  763.                         TextDrawBoxColor(Atomspeedtankline[i],COLOR_RED);
  764.                     }
  765.                     else if(Gas[vehicle] >= 100)
  766.                     {
  767.                         TextDrawTextSize(Atomspeedtankline[i],635.00000,0.000000);
  768.                         TextDrawBoxColor(Atomspeedtankline[i],COLOR_SPEEDOGREEN);
  769.                     }
  770.                     else
  771.                     {
  772.                         TextDrawTextSize(Atomspeedtankline[i],floatadd(560.0, floatdiv(Gas[vehicle], 1.3333333333)),0.000000);
  773.                         TextDrawBoxColor(Atomspeedtankline[i],COLOR_SPEEDOGREEN);
  774.                     }
  775.                     new velocityAtom[64],speed = GetSpeed(i);
  776.                     format(velocityAtom,64,"%d", speed);
  777.                     TextDrawSetString(Atomkmph[i], velocityAtom);
  778.                     new modelAtom[16];
  779.                     format(modelAtom,16,"%s", Vehicles[GetVehicleModel(GetPlayerVehicleID(i)) - 400]);
  780.                     TextDrawSetString(Atomvehiclename[i], modelAtom);
  781.                     TextDrawShowForPlayer(i, Atompowerline[i]);
  782.                     TextDrawShowForPlayer(i, Atompowerlines);
  783.                     TextDrawShowForPlayer(i, Atomkmph[i]);
  784.                     TextDrawShowForPlayer(i, Atomkmphs);
  785.                     TextDrawShowForPlayer(i, Atombox);
  786.                     TextDrawShowForPlayer(i, Atompowerlinestext);
  787.                     TextDrawShowForPlayer(i, Atomspeedtank);
  788.                     TextDrawShowForPlayer(i, Atomspeedtankstext);
  789.                     TextDrawShowForPlayer(i, Atomvehiclename[i]);
  790.                     TextDrawShowForPlayer(i, Atomspeedtankline[i]);
  791.                 }
  792.             }
  793.             else
  794.             {
  795.                 TextDrawHideForPlayer(i, Atompowerline[i]);
  796.                 TextDrawHideForPlayer(i, Atompowerlines);
  797.                 TextDrawHideForPlayer(i, Atomkmph[i]);
  798.                 TextDrawHideForPlayer(i, Atomkmphs);
  799.                 TextDrawHideForPlayer(i, Atombox);
  800.                 TextDrawHideForPlayer(i, Atompowerlinestext);
  801.                 TextDrawHideForPlayer(i, Atomspeedtank);
  802.                 TextDrawHideForPlayer(i, Atomspeedtankstext);
  803.                 TextDrawHideForPlayer(i, Atomvehiclename[i]);
  804.                 TextDrawHideForPlayer(i, Atomspeedtankline[i]);
  805.             }
  806.         }
  807.     }
  808.     return 1;
  809. }
  810.  
  811. public IsAtGasStation(playerid)
  812. {
  813.     if(IsPlayerConnected(playerid))
  814.     {
  815.         if(PlayerToPoint(6.0,playerid,1004.0070,-939.3102,42.1797) || PlayerToPoint(6.0,playerid,1944.3260,-1772.9254,13.3906))
  816.         {//LS
  817.             return 1;
  818.         }
  819.         else if(PlayerToPoint(6.0,playerid,-90.5515,-1169.4578,2.4079) || PlayerToPoint(6.0,playerid,-1609.7958,-2718.2048,48.5391))
  820.         {//LS
  821.             return 1;
  822.         }
  823.         else if(PlayerToPoint(6.0,playerid,-2029.4968,156.4366,28.9498) || PlayerToPoint(8.0,playerid,-2408.7590,976.0934,45.4175))
  824.         {//SF
  825.             return 1;
  826.         }
  827.         else if(PlayerToPoint(5.0,playerid,-2243.9629,-2560.6477,31.8841) || PlayerToPoint(8.0,playerid,-1676.6323,414.0262,6.9484))
  828.         {//Between LS and SF
  829.             return 1;
  830.         }
  831.         else if(PlayerToPoint(6.0,playerid,2202.2349,2474.3494,10.5258) || PlayerToPoint(10.0,playerid,614.9333,1689.7418,6.6968))
  832.         {//LV
  833.             return 1;
  834.         }
  835.         else if(PlayerToPoint(8.0,playerid,-1328.8250,2677.2173,49.7665) || PlayerToPoint(6.0,playerid,70.3882,1218.6783,18.5165))
  836.         {//LV
  837.             return 1;
  838.         }
  839.         else if(PlayerToPoint(8.0,playerid,2113.7390,920.1079,10.5255) || PlayerToPoint(6.0,playerid,-1327.7218,2678.8723,50.0625))
  840.         {//LV
  841.             return 1;
  842.         }
  843.         else if(PlayerToPoint(8.0,playerid,656.4265,-559.8610,16.5015) || PlayerToPoint(6.0,playerid,656.3797,-570.4138,16.5015))
  844.         {//Dillimore
  845.             return 1;
  846.         }
  847.         else if(PlayerToPoint(8.0,playerid,125.2434463501, -1935.9764404297, 2.6310691833496) || PlayerToPoint(8.0,playerid,133.91174316406, -1941.7890625, 2.6310691833496))
  848.         {//Pumpa za Helice
  849.             return 1;
  850.         }
  851.         else if(PlayerToPoint(8.0,playerid,1004.1514892578, -936.96557617188, 47.211837768555))
  852.         {//Pumpa za Helice
  853.             return 1;
  854.         }
  855.         else if(PlayerToPoint(8.0,playerid,2638.9402345345, 1106.41373453456, 10.543724234534))
  856.         {//LV
  857.             return 1;
  858.         }
  859.         else if(PlayerToPoint(8.0,playerid,-1471.315834534, 1864.20734534538, 32.359456456649))
  860.         {//LV
  861.             return 1;
  862.         }
  863.         else if(PlayerToPoint(8.0,playerid,1593.8060574677, 2199.42504563487, 10.547347895345))
  864.         {//LV
  865.             return 1;
  866.         }
  867.     }
  868.     return 0;
  869. }
  870. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  871. {
  872.     if(IsPlayerConnected(playerid))
  873.     {
  874.         new Float:oldposx, Float:oldposy, Float:oldposz;
  875.         new Float:tempposx, Float:tempposy, Float:tempposz;
  876.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  877.         tempposx = (oldposx -x);
  878.         tempposy = (oldposy -y);
  879.         tempposz = (oldposz -z);
  880.         //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  881.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  882.         {
  883.             return 1;
  884.         }
  885.     }
  886.     return 0;
  887. }
  888. stock Bike(veh)
  889. {
  890.     new no[] = { 481,509,510 };
  891.     for(new e = 0; e < sizeof(no); e++)
  892.     {
  893.         if(GetVehicleModel(veh) == no[e]) return 0;
  894.     }
  895.     return 1;
  896. }
  897. stock Auti(veh)
  898. {
  899.     new car[] = { 400,401,402,404,405,409,410,411,412,413,414,415,416,418,419,420,421,422,426,429,436,438,439,440,442,445,451,458,459,466,467,470,474,475,477,479,480,482,483,489,490,491,492,494,495,496,498,499,500,502,503,504,505,506,507,516,517,518,526,527,529,533,534,535,536,540,541,542,543,545,546,547,549,550,551,552,554,555,558,559,560,561,562,565,566,567,575,576,579,580,582,585,587,589,596,597,598,599,600,602,603,604,605 };
  900.     for(new e = 0; e < sizeof(car); e++)
  901.     {
  902.         if(GetVehicleModel(veh) == car[e]) return 0;
  903.     }
  904.     return 1;
  905. }
  906. stock Brodovi(veh)
  907. {
  908.     new car[] = { 430,446,452,453,454,472,473,484,493,508,514,515,595 };
  909.     for(new e = 0; e < sizeof(car); e++)
  910.     {
  911.         if(GetVehicleModel(veh) == car[e]) return 0;
  912.     }
  913.     return 1;
  914. }
  915. stock Motori(veh)
  916. {
  917.     new car[] = { 448,461,462,463,468,471,521,522,523,528,531,532,568,571,581,586 };
  918.     for(new e = 0; e < sizeof(car); e++)
  919.     {
  920.         if(GetVehicleModel(veh) == car[e]) return 0;
  921.     }
  922.     return 1;
  923. }
  924. stock Kamioni(veh)
  925. {
  926.     new car[] = { 403,406,407,408,423,424,427,428,431,432,433,434,437,443,444,455,456,457,478,485,486,524,525,537,538,543,556,557,568,573,574,578,583,588,601,609 };
  927.     for(new e = 0; e < sizeof(car); e++)
  928.     {
  929.         if(GetVehicleModel(veh) == car[e]) return 0;
  930.     }
  931.     return 1;
  932. }
  933. stock Letjelice(veh)
  934. {
  935.     new car[] = { 417,425,447,460,469,476,487,488,497,511,512,513,519,520,548,553,563,577,592,593 };
  936.     for(new e = 0; e < sizeof(car); e++)
  937.     {
  938.         if(GetVehicleModel(veh) == car[e]) return 0;
  939.     }
  940.     return 1;
  941. }
  942. stock GetSpeed (playerid, mod = 1)
  943. {
  944.     GetVehicleVelocity ( GetPlayerVehicleID ( playerid ) , Velocity [ 0 ] , Velocity [ 1 ] , Velocity [ 2 ] ) ;
  945.     return IsPlayerInAnyVehicle ( playerid ) ? floatround ( ( ( floatsqroot ( ( ( Velocity [ 0 ] * Velocity [ 0 ] ) + ( Velocity [ 1 ] * Velocity [ 1 ] ) + ( Velocity [ 2 ] * Velocity [ 2 ] ) ) ) * ( !mod ? 105.0 : 170.0 ) ) ) * 1 ) : 0;
  946. }
Advertisement
Add Comment
Please, Sign In to add comment