Advertisement
Guest User

Tacho Filterscript

a guest
Aug 17th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.07 KB | None | 0 0
  1. /* Tachosystem [S1] by ErikSon */
  2.  
  3. #include <a_samp>
  4.  
  5. /* Settings */
  6. #undef MAX_PLAYERS
  7. #define MAX_PLAYERS 5 //Server-Slotanzahl
  8. /* Settings */
  9.  
  10. #define formatEx(%0,%1,%2) format(%0,sizeof(%0),%1,%2)
  11.  
  12. enum T_EC{
  13. Text:Name,
  14. Text:Zustand,
  15. Text:StatusMotor,
  16. Text:StatusLicht,
  17. Text:Speed,
  18. _switch
  19. }
  20. new Tacho[MAX_PLAYERS][T_EC];
  21.  
  22. new VehName[][] ={
  23. "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
  24. "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
  25. "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
  26. "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
  27. "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
  28. "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
  29. "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
  30. "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
  31. "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
  32. "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
  33. "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
  34. "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
  35. "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
  36. "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
  37. "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin",
  38. "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
  39. "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
  40. "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
  41. "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
  42. "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
  43. "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
  44. "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
  45. "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
  46. "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum",
  47. "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
  48. "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
  49. "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
  50. "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  51. "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
  52. "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
  53. "Phoenix", "2. Gebrauchtwagen", "1. Gebrauchtwagen", "Luggage", "Luggage", "Stairs", "Boxville",
  54. "Tiller", "Utility Trailer"
  55. };
  56.  
  57.  
  58. public OnFilterScriptInit(){
  59. print("\n--------------------------------------");
  60. print(" Tachosystem [S1] by ErikSon");
  61. print("--------------------------------------\n");
  62. for(new i = 0; i<MAX_PLAYERS; i++){
  63. Tacho[i][StatusMotor] = TextDrawCreate(503.000000, 421.000000, "Motor: '-'");
  64. TextDrawBackgroundColor(Tacho[i][StatusMotor], 255);
  65. TextDrawFont(Tacho[i][StatusMotor], 1);
  66. TextDrawLetterSize(Tacho[i][StatusMotor], 0.200000, 1.000000);
  67. TextDrawColor(Tacho[i][StatusMotor], -1);
  68. TextDrawSetOutline(Tacho[i][StatusMotor], 0);
  69. TextDrawSetProportional(Tacho[i][StatusMotor], 1);
  70. TextDrawSetShadow(Tacho[i][StatusMotor], 1);
  71. TextDrawUseBox(Tacho[i][StatusMotor], 1);
  72. TextDrawBoxColor(Tacho[i][StatusMotor], 0x00000088);
  73. TextDrawTextSize(Tacho[i][StatusMotor], 631.000000, 295.000000);
  74. TextDrawSetSelectable(Tacho[i][StatusMotor], 0);
  75.  
  76.  
  77. Tacho[i][StatusLicht] = TextDrawCreate(570.000000, 420.000000, "Licht: '-'");
  78. TextDrawBackgroundColor(Tacho[i][StatusLicht], 255);
  79. TextDrawFont(Tacho[i][StatusLicht], 1);
  80. TextDrawLetterSize(Tacho[i][StatusLicht], 0.200000, 1.0000);
  81. TextDrawColor(Tacho[i][StatusLicht], -1);
  82. TextDrawSetOutline(Tacho[i][StatusLicht], 0);
  83. TextDrawSetProportional(Tacho[i][StatusLicht], 1);
  84. TextDrawSetShadow(Tacho[i][StatusLicht], 1);
  85. TextDrawSetSelectable(Tacho[i][StatusLicht], 0);
  86.  
  87. Tacho[i][Speed] = TextDrawCreate(503.000000, 390.000000, "Speed: - KM/H");
  88. TextDrawBackgroundColor(Tacho[i][Speed], 255);
  89. TextDrawFont(Tacho[i][Speed], 1);
  90. TextDrawLetterSize(Tacho[i][Speed], 0.400000, 1.000000);
  91. TextDrawColor(Tacho[i][Speed], -1);
  92. TextDrawSetOutline(Tacho[i][Speed], 0);
  93. TextDrawSetProportional(Tacho[i][Speed], 1);
  94. TextDrawSetShadow(Tacho[i][Speed], 1);
  95. TextDrawUseBox(Tacho[i][Speed], 1);
  96. TextDrawBoxColor(Tacho[i][Speed], 0x00000088);
  97. TextDrawTextSize(Tacho[i][Speed], 631.000000, 0.000000);
  98. TextDrawSetSelectable(Tacho[i][Speed], 0);
  99.  
  100. Tacho[i][Zustand] = TextDrawCreate(503.000000, 406.000000, "Zustand: -");
  101. TextDrawBackgroundColor(Tacho[i][Zustand], 255);
  102. TextDrawFont(Tacho[i][Zustand], 1);
  103. TextDrawLetterSize(Tacho[i][Zustand], 0.340000, 1.000000);
  104. TextDrawColor(Tacho[i][Zustand], -1);
  105. TextDrawSetOutline(Tacho[i][Zustand], 0);
  106. TextDrawSetProportional(Tacho[i][Zustand], 1);
  107. TextDrawSetShadow(Tacho[i][Zustand], 1);
  108. TextDrawUseBox(Tacho[i][Zustand], 1);
  109. TextDrawBoxColor(Tacho[i][Zustand], 0x00000088);
  110. TextDrawTextSize(Tacho[i][Zustand], 631.000000, -2.000000);
  111. TextDrawSetSelectable(Tacho[i][Zustand], 0);
  112.  
  113. Tacho[i][Name] = TextDrawCreate(503.000000, 374.000000, "-");
  114. TextDrawBackgroundColor(Tacho[i][Name], 255);
  115. TextDrawFont(Tacho[i][Name], 1);
  116. TextDrawLetterSize(Tacho[i][Name], 0.400000, 1.000000);
  117. TextDrawColor(Tacho[i][Name], 0xFF0000FF);
  118. TextDrawSetOutline(Tacho[i][Name], 0);
  119. TextDrawSetProportional(Tacho[i][Name], 1);
  120. TextDrawSetShadow(Tacho[i][Name], 1);
  121. TextDrawUseBox(Tacho[i][Name], 1);
  122. TextDrawBoxColor(Tacho[i][Name], 0x00000088);
  123. TextDrawTextSize(Tacho[i][Name], 631.000000, 0.000000);
  124. TextDrawSetSelectable(Tacho[i][Name], 0);
  125. }
  126. return SetTimer("TachoUpdate",50,true);
  127. }
  128.  
  129. public OnFilterScriptExit(){
  130. for(new i = 0; i<MAX_PLAYERS; i++){
  131. TextDrawHideForPlayer(i,Tacho[i][Name]);
  132. TextDrawHideForPlayer(i,Tacho[i][Zustand]);
  133. TextDrawHideForPlayer(i,Tacho[i][Speed]);
  134. TextDrawHideForPlayer(i,Tacho[i][StatusMotor]);
  135. TextDrawHideForPlayer(i,Tacho[i][StatusLicht]);
  136.  
  137. TextDrawDestroy(Tacho[i][Name]);
  138. TextDrawDestroy(Tacho[i][Zustand]);
  139. TextDrawDestroy(Tacho[i][Speed]);
  140. TextDrawDestroy(Tacho[i][StatusMotor]);
  141. TextDrawDestroy(Tacho[i][StatusLicht]);
  142. }
  143. return 1;
  144. }
  145.  
  146. public OnPlayerConnect(playerid){
  147. return 1;
  148. }
  149.  
  150. public OnPlayerDisconnect(playerid, reason){
  151. if(IsPlayerInAnyVehicle(playerid)){
  152. TextDrawHideForPlayer(playerid, Tacho[playerid][Name]);
  153. TextDrawHideForPlayer(playerid, Tacho[playerid][Zustand]);
  154. TextDrawHideForPlayer(playerid, Tacho[playerid][Speed]);
  155. TextDrawHideForPlayer(playerid, Tacho[playerid][StatusMotor]);
  156. TextDrawHideForPlayer(playerid,Tacho[playerid][StatusLicht]);
  157. }
  158. return 1;
  159. }
  160.  
  161. public OnPlayerStateChange(playerid, newstate, oldstate){
  162. if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER){
  163. TextDrawShowForPlayer(playerid, Tacho[playerid][Name]);
  164. TextDrawShowForPlayer(playerid, Tacho[playerid][Zustand]);
  165. TextDrawShowForPlayer(playerid, Tacho[playerid][Speed]);
  166. TextDrawShowForPlayer(playerid, Tacho[playerid][StatusMotor]);
  167. TextDrawShowForPlayer(playerid,Tacho[playerid][StatusLicht]);
  168. }
  169. if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER){
  170. TextDrawHideForPlayer(playerid, Tacho[playerid][Name]);
  171. TextDrawHideForPlayer(playerid, Tacho[playerid][Zustand]);
  172. TextDrawHideForPlayer(playerid, Tacho[playerid][Speed]);
  173. TextDrawHideForPlayer(playerid, Tacho[playerid][StatusMotor]);
  174. TextDrawHideForPlayer(playerid,Tacho[playerid][StatusLicht]);
  175. }
  176. return 1;
  177. }
  178.  
  179. forward TachoUpdate();
  180. public TachoUpdate(){
  181. for(new i = 0; i<MAX_PLAYERS; i++){
  182. if(!IsPlayerConnected(i))continue;
  183. if(!IsPlayerInAnyVehicle(i))continue;
  184.  
  185. new veh = GetPlayerVehicleID(i),str[64],Float:hp,speed = GetVehicleSpeed(veh);
  186. formatEx(str,"Speed: %d KM/H", speed);
  187. TextDrawSetString(Tacho[i][Speed],str);
  188. GetVehicleHealth(veh, hp); hp = (floatround(hp) / 10);
  189. formatEx(str,"Zustand: %.0f", hp);
  190. TextDrawSetString(Tacho[i][Zustand],str);
  191. formatEx(str,"%s", VehName[GetVehicleModel(veh)-400]), TextDrawSetString(Tacho[i][Name],str);
  192. new motor,lichter,objektiv,boot,bonnet,doors,alarm;
  193. GetVehicleParamsEx(veh,motor,lichter,alarm,doors,bonnet,boot,objektiv);
  194. if(IsNoTachoVeh(veh)){
  195. TextDrawSetString(Tacho[i][StatusMotor],"Motor: '-"),
  196. TextDrawSetString(Tacho[i][StatusLicht],"Licht: '-");
  197. }
  198. else{
  199. formatEx(str,"Motor: '%s'",(!motor) ? ("~r~Aus~w~") : ("~g~An~w~")), TextDrawSetString(Tacho[i][StatusMotor],str);
  200. formatEx(str,"Licht: '%s'",(!lichter) ? ("~r~Aus~w~") : ("~g~An~w~")),TextDrawSetString(Tacho[i][StatusLicht],str);
  201. }
  202. }
  203. return 1;
  204. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement