Guest User

Untitled

a guest
Apr 11th, 2011
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.48 KB | None | 0 0
  1. ///////////////////////
  2. //////SpeedoMeter//////
  3. ///////Created by://///
  4. ///////°Fallout°///////
  5. ///////////////////////
  6.  
  7. #include <a_samp>
  8.  
  9. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. forward CheckStatus();
  12.  
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  14.  
  15. new PlayerVehicle[212][] = {
  16. "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana",
  17. "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat",
  18. "Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife",
  19. "Trailer 1", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo",
  20. "Seasparrow", "Pizzaboy", "Tram", "Trailer 2", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair",
  21. "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic", "Sanchez", "Sparrow",
  22. "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX", "Burrito",
  23. "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring",
  24. "Sandking", "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B",
  25. "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster","Stunt", "Tanker",
  26. "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
  27. "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak",
  28. "Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck LA", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit",
  29. "Utility", "Nevada", "Yosemite", "Windsor", "Monster A", "Monster B", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance",
  30. "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper", "Broadway",
  31. "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer 3", "Emperor", "Wayfarer", "Euros", "Hotdog",
  32. "Club", "Freight Carriage", "Trailer 4", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
  33. "Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A",
  34. "Luggage Trailer B", "Stairs", "Boxville", "Tiller", "Utility Trailer" };
  35.  
  36. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  37.  
  38. //Booleans
  39. new bool:TextDrawsShown[MAX_PLAYERS];
  40. new bool:LightRedHealthCreated[MAX_PLAYERS];
  41. new bool:LightYellowSpeedCreated[MAX_PLAYERS];
  42. new bool:VHSCreated[MAX_PLAYERS];
  43. new bool:ExclamationShown[MAX_PLAYERS];
  44.  
  45. //Timer
  46. new CheckStatusTimer;
  47.  
  48. //4all
  49. new Text:Black0;
  50. new Text:White1;
  51. new Text:White2;
  52. new Text:BlackHealth;
  53. new Text:DarkRedHealth;
  54. new Text:BlackSpeed;
  55. new Text:DarkYellowSpeed;
  56. new Text:Marker;
  57. new Text:Exclamation;
  58.  
  59. //4player
  60. new Text:VHS[MAX_PLAYERS];
  61. new Text:LightRedHealth[MAX_PLAYERS];
  62. new Text:LightYellowSpeed[MAX_PLAYERS];
  63.  
  64. //Speed
  65. new Float:OldX[MAX_PLAYERS];
  66. new Float:OldY[MAX_PLAYERS];
  67. new Float:OldZ[MAX_PLAYERS];
  68.  
  69. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  70.  
  71. public OnFilterScriptInit()
  72. {
  73. Black0 = TextDrawCreate(481.000000,353.000000,"_");
  74. TextDrawUseBox(Black0,1);
  75. TextDrawBoxColor(Black0,0x00000044);
  76. TextDrawTextSize(Black0,596.000000,0.000000);
  77. TextDrawAlignment(Black0,0);
  78. TextDrawBackgroundColor(Black0,0x000000ff);
  79. TextDrawFont(Black0,3);
  80. TextDrawLetterSize(Black0,3.599999,7.599996);
  81. TextDrawColor(Black0,0xffffffff);
  82. TextDrawSetOutline(Black0,1);
  83. TextDrawSetProportional(Black0,1);
  84. TextDrawSetShadow(Black0,1);
  85.  
  86. White1 = TextDrawCreate(482.000000,354.000000,"_");
  87. TextDrawUseBox(White1,1);
  88. TextDrawBoxColor(White1,0xffffff11);
  89. TextDrawTextSize(White1,595.000000,-2.000000);
  90. TextDrawAlignment(White1,0);
  91. TextDrawBackgroundColor(White1,0x000000ff);
  92. TextDrawFont(White1,1);
  93. TextDrawLetterSize(White1,1.700000,7.399997);
  94. TextDrawColor(White1,0xffffffff);
  95. TextDrawSetOutline(White1,1);
  96. TextDrawSetProportional(White1,1);
  97. TextDrawSetShadow(White1,1);
  98.  
  99. White2 = TextDrawCreate(483.000000,355.000000,"_");
  100. TextDrawUseBox(White2,1);
  101. TextDrawBoxColor(White2,0xffffff22);
  102. TextDrawTextSize(White2,594.000000,0.000000);
  103. TextDrawAlignment(White2,0);
  104. TextDrawBackgroundColor(White2,0x000000ff);
  105. TextDrawFont(White2,1);
  106. TextDrawLetterSize(White2,0.299999,7.199996);
  107. TextDrawColor(White2,0xffffffff);
  108. TextDrawSetOutline(White2,1);
  109. TextDrawSetProportional(White2,1);
  110. TextDrawSetShadow(White2,1);
  111.  
  112. BlackHealth = TextDrawCreate(487.000000,385.000000,"_");
  113. TextDrawUseBox(BlackHealth,1);
  114. TextDrawBoxColor(BlackHealth,0x00000099);
  115. TextDrawTextSize(BlackHealth,590.000000,-11.000000);
  116. TextDrawAlignment(BlackHealth,0);
  117. TextDrawBackgroundColor(BlackHealth,0x000000ff);
  118. TextDrawFont(BlackHealth,3);
  119. TextDrawLetterSize(BlackHealth,1.000000,0.399999);
  120. TextDrawColor(BlackHealth,0xffffffff);
  121. TextDrawSetOutline(BlackHealth,1);
  122. TextDrawSetProportional(BlackHealth,1);
  123. TextDrawSetShadow(BlackHealth,1);
  124.  
  125. DarkRedHealth = TextDrawCreate(488.000000,386.000000,"_");
  126. TextDrawUseBox(DarkRedHealth,1);
  127. TextDrawBoxColor(DarkRedHealth,0xff000066);
  128. TextDrawTextSize(DarkRedHealth,589.000000,0.000000);
  129. TextDrawAlignment(DarkRedHealth,0);
  130. TextDrawBackgroundColor(DarkRedHealth,0x000000ff);
  131. TextDrawFont(DarkRedHealth,3);
  132. TextDrawLetterSize(DarkRedHealth,1.000000,0.199999);
  133. TextDrawColor(DarkRedHealth,0xffffffff);
  134. TextDrawSetOutline(DarkRedHealth,1);
  135. TextDrawSetProportional(DarkRedHealth,1);
  136. TextDrawSetShadow(DarkRedHealth,1);
  137.  
  138. BlackSpeed = TextDrawCreate(536.000000,403.000000,"_");
  139. TextDrawUseBox(BlackSpeed,1);
  140. TextDrawBoxColor(BlackSpeed,0x00000099);
  141. TextDrawTextSize(BlackSpeed,590.000000,0.000000);
  142. TextDrawAlignment(BlackSpeed,0);
  143. TextDrawBackgroundColor(BlackSpeed,0x000000ff);
  144. TextDrawFont(BlackSpeed,3);
  145. TextDrawLetterSize(BlackSpeed,1.000000,1.400000);
  146. TextDrawColor(BlackSpeed,0xffffffff);
  147. TextDrawSetOutline(BlackSpeed,1);
  148. TextDrawSetShadow(BlackSpeed,1);
  149. TextDrawSetProportional(BlackSpeed,1);
  150.  
  151. DarkYellowSpeed = TextDrawCreate(537.000000,404.000000,"_");
  152. TextDrawUseBox(DarkYellowSpeed,1);
  153. TextDrawBoxColor(DarkYellowSpeed,0xffff0033);
  154. TextDrawTextSize(DarkYellowSpeed,589.000000,0.000000);
  155. TextDrawAlignment(DarkYellowSpeed,0);
  156. TextDrawBackgroundColor(DarkYellowSpeed,0x000000ff);
  157. TextDrawFont(DarkYellowSpeed,3);
  158. TextDrawLetterSize(DarkYellowSpeed,1.000000,1.200000);
  159. TextDrawColor(DarkYellowSpeed,0xffffffff);
  160. TextDrawSetOutline(DarkYellowSpeed,1);
  161. TextDrawSetProportional(DarkYellowSpeed,1);
  162. TextDrawSetShadow(DarkYellowSpeed,1);
  163.  
  164. Marker = TextDrawCreate(511.000000,382.000000,"l");
  165. TextDrawAlignment(Marker,0);
  166. TextDrawBackgroundColor(Marker,0x000000ff);
  167. TextDrawFont(Marker,1);
  168. TextDrawLetterSize(Marker,0.099999,1.000000);
  169. TextDrawColor(Marker,0xffffffff);
  170. TextDrawSetOutline(Marker,1);
  171. TextDrawSetProportional(Marker,1);
  172. TextDrawSetShadow(Marker,1);
  173.  
  174. Exclamation = TextDrawCreate(579.000000,351.000000,"~r~!");
  175. TextDrawAlignment(Exclamation,0);
  176. TextDrawBackgroundColor(Exclamation,0x000000ff);
  177. TextDrawFont(Exclamation,2);
  178. TextDrawLetterSize(Exclamation,1.200000,3.399999);
  179. TextDrawColor(Exclamation,0xffffffff);
  180. TextDrawSetOutline(Exclamation,1);
  181. TextDrawSetProportional(Exclamation,1);
  182. TextDrawSetShadow(Exclamation,1);
  183.  
  184. CheckStatusTimer = SetTimer("CheckStatus", 1000, 1);
  185. }
  186.  
  187. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  188.  
  189. public OnFilterScriptExit()
  190. {
  191. KillTimer(CheckStatusTimer);
  192.  
  193. TextDrawDestroy(Text:Black0);
  194. TextDrawDestroy(Text:White1);
  195. TextDrawDestroy(Text:White2);
  196. TextDrawDestroy(Text:BlackHealth);
  197. TextDrawDestroy(Text:DarkRedHealth);
  198. TextDrawDestroy(Text:BlackSpeed);
  199. TextDrawDestroy(Text:DarkYellowSpeed);
  200. TextDrawDestroy(Text:Marker);
  201. TextDrawDestroy(Text:Exclamation);
  202. for(new i=0; i<MAX_PLAYERS; i++)
  203. {
  204. TextDrawDestroy(Text:VHS[i]);
  205. TextDrawDestroy(Text:LightRedHealth[i]);
  206. TextDrawDestroy(Text:LightYellowSpeed[i]);
  207. }
  208. }
  209.  
  210. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  211.  
  212. public OnPlayerConnect(playerid)
  213. {
  214. TextDrawsShown[playerid] = false;
  215. VHSCreated[playerid] = false;
  216. LightRedHealthCreated[playerid] = false;
  217. LightYellowSpeedCreated[playerid] = false;
  218. }
  219.  
  220. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  221.  
  222. public CheckStatus()
  223. {
  224. for(new i=0; i<MAX_PLAYERS; i++)
  225. {
  226. if(IsPlayerConnected(i))
  227. {
  228. if(IsPlayerInAnyVehicle(i))
  229. {
  230.  
  231. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  232.  
  233. if(TextDrawsShown[i] == false)
  234. {
  235. TextDrawShowForPlayer(i, Text:Black0);
  236. TextDrawShowForPlayer(i, Text:White1);
  237. TextDrawShowForPlayer(i, Text:White2);
  238. TextDrawShowForPlayer(i, Text:BlackHealth);
  239. TextDrawShowForPlayer(i, Text:DarkRedHealth);
  240. TextDrawShowForPlayer(i, Text:BlackSpeed);
  241. TextDrawShowForPlayer(i, Text:DarkYellowSpeed);
  242. TextDrawShowForPlayer(i, Text:Marker);
  243. TextDrawsShown[i] = true;
  244. }
  245.  
  246. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  247.  
  248. new String[128];
  249. new Float:X, Float:Y, Float:Z, Float:Distance;
  250. GetPlayerPos(i, X, Y, Z);
  251. Distance = floatsqroot(floatadd(floatadd(floatpower(floatsub(X, OldX[i]), 2), floatpower(floatsub(Y, OldY[i]), 2)), floatpower(floatsub(Z, OldZ[i]), 2)));
  252. new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
  253. PlayerVehicleModelID -= 400;
  254. format(String,sizeof(String),"~b~Vozilo:~n~~w~%s~n~~b~Ostecenost:~n~~n~Brzina:~n~~w~%im/h~n~%ikm/h", PlayerVehicle[PlayerVehicleModelID], floatround(floatmul(floatdiv(Distance, 1.609344), 2.0), floatround_floor), floatround(floatmul(Distance, 2.0), floatround_floor));
  255. if(VHSCreated[i] == true)
  256. {
  257. TextDrawDestroy(VHS[i]);
  258. }
  259. VHS[i] = TextDrawCreate(485.000000,355.000000,String);
  260. TextDrawAlignment(VHS[i],0);
  261. TextDrawBackgroundColor(VHS[i],0x000000ff);
  262. TextDrawFont(VHS[i],1);
  263. TextDrawLetterSize(VHS[i],0.299999,1.000000);
  264. TextDrawColor(VHS[i],0xffffffff);
  265. TextDrawSetOutline(VHS[i],1);
  266. TextDrawSetProportional(VHS[i],1);
  267. TextDrawSetShadow(VHS[i],1);
  268. TextDrawShowForPlayer(i, VHS[i]);
  269. VHSCreated[i] = true;
  270.  
  271. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  272.  
  273. new Float:CarHealth;
  274. GetVehicleHealth(GetPlayerVehicleID(i), CarHealth);
  275. if(LightRedHealthCreated[i] == true)
  276. {
  277. TextDrawDestroy(LightRedHealth[i]);
  278. }
  279. LightRedHealth[i] = TextDrawCreate(488.000000,386.000000,"_");
  280. TextDrawUseBox(LightRedHealth[i],1);
  281. TextDrawBoxColor(LightRedHealth[i],0xff000099);
  282. TextDrawTextSize(LightRedHealth[i], floatadd(484.0, floatdiv(CarHealth, 9.5238095238)),0.000000);
  283. TextDrawAlignment(LightRedHealth[i],0);
  284. TextDrawBackgroundColor(LightRedHealth[i],0x000000ff);
  285. TextDrawFont(LightRedHealth[i],3);
  286. TextDrawLetterSize(LightRedHealth[i],1.000000,0.199999);
  287. TextDrawColor(LightRedHealth[i],0xffffffff);
  288. TextDrawSetOutline(LightRedHealth[i],1);
  289. TextDrawSetProportional(LightRedHealth[i],1);
  290. TextDrawSetShadow(LightRedHealth[i],1);
  291. TextDrawShowForPlayer(i, LightRedHealth[i]);
  292. LightRedHealthCreated[i] = true;
  293. if(CarHealth < 250)
  294. {
  295. if(ExclamationShown[i] == true)
  296. {
  297. TextDrawHideForPlayer(i, Text:Exclamation);
  298. ExclamationShown[i] = false;
  299. }
  300. else
  301. {
  302. TextDrawShowForPlayer(i, Text:Exclamation);
  303. ExclamationShown[i] = true;
  304. }
  305. }
  306. else if(CarHealth > 250)
  307. {
  308. if(ExclamationShown[i] == true)
  309. {
  310. TextDrawHideForPlayer(i, Text:Exclamation);
  311. ExclamationShown[i] = false;
  312. }
  313. }
  314.  
  315. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  316.  
  317. if(LightYellowSpeedCreated[i] == true)
  318. {
  319. TextDrawDestroy(LightYellowSpeed[i]);
  320. }
  321. LightYellowSpeed[i] = TextDrawCreate(537.000000,404.000000,"_");
  322. TextDrawUseBox(LightYellowSpeed[i],1);
  323. TextDrawBoxColor(LightYellowSpeed[i],0xffff0066);
  324. if(Distance >= 75)
  325. {
  326. TextDrawTextSize(LightYellowSpeed[i],589.000000,0.000000);
  327. }
  328. else
  329. {
  330. TextDrawTextSize(LightYellowSpeed[i], floatadd(533.0, floatdiv(Distance, 1.33928571428)),0.000000);
  331. }
  332. TextDrawAlignment(LightYellowSpeed[i],0);
  333. TextDrawBackgroundColor(LightYellowSpeed[i],0x000000ff);
  334. TextDrawFont(LightYellowSpeed[i],3);
  335. TextDrawLetterSize(LightYellowSpeed[i],1.000000,1.200000);
  336. TextDrawColor(LightYellowSpeed[i],0xffffffff);
  337. TextDrawSetOutline(LightYellowSpeed[i],1);
  338. TextDrawSetProportional(LightYellowSpeed[i],1);
  339. TextDrawSetShadow(LightYellowSpeed[i],1);
  340. TextDrawShowForPlayer(i, LightYellowSpeed[i]);
  341. LightYellowSpeedCreated[i] = true;
  342.  
  343. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  344.  
  345. OldX[i] = X; OldY[i] = Y; OldZ[i] = Z;
  346.  
  347. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  348.  
  349. }
  350. else
  351. {
  352. if(TextDrawsShown[i] == true)
  353. {
  354. TextDrawHideForPlayer(i, Text:Black0);
  355. TextDrawHideForPlayer(i, Text:White1);
  356. TextDrawHideForPlayer(i, Text:White2);
  357. TextDrawHideForPlayer(i, Text:BlackHealth);
  358. TextDrawHideForPlayer(i, Text:DarkRedHealth);
  359. TextDrawHideForPlayer(i, Text:BlackSpeed);
  360. TextDrawHideForPlayer(i, Text:DarkYellowSpeed);
  361. TextDrawHideForPlayer(i, Text:Marker);
  362. TextDrawHideForPlayer(i, Text:Exclamation);
  363. TextDrawsShown[i] = false;
  364. }
  365. TextDrawHideForPlayer(i, Text:VHS[i]);
  366. TextDrawHideForPlayer(i, Text:LightRedHealth[i]);
  367. TextDrawHideForPlayer(i, Text:LightYellowSpeed[i]);
  368. }
  369. }
  370. }
  371. }
  372.  
  373. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment