Advertisement
Guest User

[Filterscripts] Speedometer , Date , Time , Ping : JonyNguye

a guest
Oct 31st, 2014
756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.14 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #define FILTERSCRIPT
  4. #define VERSION "1.0"
  5. #define COLOR_LIGHTBLUE 0x33CCFFAA
  6. new Text:Time, Text:Cay, Text:Ping, Text:FPS, Text:Textdraw1, Text:Textdraw3, Text:Textdraw4, Text:Speed, Text:Textdraw2, Text:Date;
  7. new pFPS[MAX_PLAYERS];
  8. forward settime(playerid);
  9.  
  10. public OnFilterScriptInit()
  11. {
  12. print("\n--------------------------------------");
  13. print(" Speedometer , Date , Time , Ping , FPS : JonyNguyen Version "VERSION"!!!");
  14. print("--------------------------------------\n");
  15.  
  16.  
  17. SetTimer("settime",1000,true);
  18.  
  19. Speed = TextDrawCreate(490.000000, 160.000000, "--");
  20. TextDrawBackgroundColor(Speed, 255);
  21. TextDrawFont(Speed, 1);
  22. TextDrawLetterSize(Speed, 0.350000, 1.200000);
  23. TextDrawColor(Speed, -1);
  24. TextDrawSetOutline(Speed, 1);
  25. TextDrawSetProportional(Speed, 1);
  26. TextDrawSetSelectable(Speed, 0);
  27.  
  28. Textdraw1 = TextDrawCreate(544.000000, 361.000000, "~r~-");
  29. TextDrawBackgroundColor(Textdraw1, 255);
  30. TextDrawFont(Textdraw1, 2);
  31. TextDrawLetterSize(Textdraw1, 0.290000, 1.200000);
  32. TextDrawColor(Textdraw1, -1);
  33. TextDrawSetOutline(Textdraw1, 1);
  34. TextDrawSetProportional(Textdraw1, 1);
  35. TextDrawSetSelectable(Textdraw1, 0);
  36.  
  37. Textdraw2 = TextDrawCreate(560.000000, 373.000000, "~r~-");
  38. TextDrawBackgroundColor(Textdraw2, 255);
  39. TextDrawFont(Textdraw2, 1);
  40. TextDrawLetterSize(Textdraw2, 0.210000, 1.200000);
  41. TextDrawColor(Textdraw2, -16776961);
  42. TextDrawSetOutline(Textdraw2, 1);
  43. TextDrawSetProportional(Textdraw2, 1);
  44. TextDrawSetSelectable(Textdraw2, 0);
  45.  
  46. Textdraw3 = TextDrawCreate(527.000000, 384.000000, "-");
  47. TextDrawBackgroundColor(Textdraw3, 255);
  48. TextDrawFont(Textdraw3, 1);
  49. TextDrawLetterSize(Textdraw3, 5.000000, 1.000000);
  50. TextDrawColor(Textdraw3, -1);
  51. TextDrawSetOutline(Textdraw3, 0);
  52. TextDrawSetProportional(Textdraw3, 1);
  53. TextDrawSetShadow(Textdraw3, 1);
  54. TextDrawSetSelectable(Textdraw3, 0);
  55.  
  56. Textdraw4 = TextDrawCreate(521.000000, 392.000000, "Facebook.com/naqui9x");
  57. TextDrawBackgroundColor(Textdraw4, -1);
  58. TextDrawFont(Textdraw4, 1);
  59. TextDrawLetterSize(Textdraw4, 0.230000, 1.200000);
  60. TextDrawColor(Textdraw4, 255);
  61. TextDrawSetOutline(Textdraw4, 1);
  62. TextDrawSetProportional(Textdraw4, 1);
  63. TextDrawSetSelectable(Textdraw4, 0);
  64.  
  65.  
  66. Ping = TextDrawCreate(524.000000, 374.000000, "--");
  67. TextDrawBackgroundColor(Ping, 255);
  68. TextDrawFont(Ping, 1);
  69. TextDrawLetterSize(Ping, 0.200000, 1.200000);
  70. TextDrawColor(Ping, -16776961);
  71. TextDrawSetOutline(Ping, 1);
  72. TextDrawSetProportional(Ping, 1);
  73. TextDrawSetSelectable(Ping, 0);
  74.  
  75. FPS = TextDrawCreate(570.000000, 374.000000, "--");
  76. TextDrawBackgroundColor(FPS, 255);
  77. TextDrawFont(FPS, 1);
  78. TextDrawLetterSize(FPS, 0.200000, 1.200000);
  79. TextDrawColor(FPS, -16776961);
  80. TextDrawSetOutline(FPS, 1);
  81. TextDrawSetProportional(FPS, 1);
  82. TextDrawSetSelectable(FPS, 0);
  83.  
  84.  
  85. Date = TextDrawCreate(552.000000, 361.000000,"--");
  86. TextDrawBackgroundColor(Date, 255);
  87. TextDrawFont(Date, 2);
  88. TextDrawLetterSize(Date, 0.200000, 1.200000);
  89. TextDrawColor(Date, -1);
  90. TextDrawSetOutline(Date, 1);
  91. TextDrawSetProportional(Date, 1);
  92. TextDrawSetSelectable(Date, 0);
  93.  
  94. Time = TextDrawCreate(516.000000, 361.000000,"--");
  95. TextDrawBackgroundColor(Time, 255);
  96. TextDrawFont(Time, 2);
  97. TextDrawLetterSize(Time, 0.200000, 1.200000);
  98. TextDrawColor(Time, -1);
  99. TextDrawSetOutline(Time, 1);
  100. TextDrawSetProportional(Time, 1);
  101. TextDrawSetSelectable(Time, 0);
  102.  
  103. Cay = TextDrawCreate(487.000000, 344.000000, "~r~V~w~ietnam~r~R~w~oleplay");
  104. TextDrawBackgroundColor(Cay, 255);
  105. TextDrawFont(Cay, 1);
  106. TextDrawLetterSize(Cay, 0.509999, 1.600000);
  107. TextDrawColor(Cay, -1);
  108. TextDrawSetOutline(Cay, 1);
  109. TextDrawSetProportional(Cay, 1);
  110. TextDrawSetSelectable(Cay, 0);
  111. return 1;
  112. }
  113.  
  114. public OnFilterScriptExit()
  115. {
  116. return 1;
  117. }
  118.  
  119. public OnPlayerSpawn(playerid)
  120. {
  121. TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date), TextDrawShowForPlayer(playerid, Cay), TextDrawShowForPlayer(playerid, Ping), TextDrawShowForPlayer(playerid, FPS), TextDrawShowForPlayer(playerid, Textdraw1), TextDrawShowForPlayer(playerid, Textdraw2), TextDrawShowForPlayer(playerid, Textdraw3), TextDrawShowForPlayer(playerid, Textdraw4);
  122.  
  123.  
  124. return 1;
  125. }
  126.  
  127. public OnPlayerDisconnect(playerid, reason)
  128. {
  129. TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date), TextDrawHideForPlayer(playerid, Cay), TextDrawHideForPlayer(playerid, Ping), TextDrawHideForPlayer(playerid, FPS), TextDrawHideForPlayer(playerid, Textdraw1), TextDrawHideForPlayer(playerid, Textdraw2), TextDrawHideForPlayer(playerid, Textdraw3), TextDrawHideForPlayer(playerid, Textdraw4);
  130. return 1;
  131. }
  132.  
  133. public settime(playerid)
  134. {
  135. new string[256],year,month,day,hours,minutes,seconds;
  136. getdate(year, month, day), gettime(hours, minutes, seconds);
  137. format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
  138. TextDrawSetString(Date, string);
  139. format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
  140. TextDrawSetString(Time, string);
  141. format(string, sizeof string, "~r~Ping: ~w~%d", GetPlayerPing(playerid));
  142. TextDrawSetString(Ping, string);
  143. format(string, sizeof string, "~r~LAG: ~w~No", pFPS[playerid]);
  144. TextDrawSetString(FPS, string);
  145. format(string, sizeof string, "~w~SPEED: ~r~%d ~w~KM/h.", GetSpeed(playerid));
  146. TextDrawSetString(Speed, string);
  147. }
  148.  
  149. stock GetSpeed(playerid)
  150. {
  151. new Float: Pos[4];
  152. GetVehicleVelocity(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
  153. return floatround(1.61 * floatsqroot(floatabs(floatpower(Pos[0] + Pos[1] + Pos[2], 2))) * 100);
  154. }
  155.  
  156.  
  157. CMD:speedo_on(playerid, params[])
  158. {
  159. if(!IsPlayerInAnyVehicle(playerid)) {
  160. return SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You need to be in a car.");
  161. }
  162. SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You're turn on speed clock");
  163. TextDrawShowForPlayer(playerid, Text:Speed);
  164. return 1;
  165. }
  166.  
  167. CMD:speedo_off(playerid, params[])
  168. {
  169. if(!IsPlayerInAnyVehicle(playerid)) {
  170. return SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You need to be in a car.");
  171. }
  172. SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You're turn off speed clock.");
  173. TextDrawHideForPlayer(playerid, Text:Speed);
  174. return 1;
  175. }
  176.  
  177. public OnPlayerExitVehicle(playerid, vehicleid)
  178. {
  179. TextDrawHideForPlayer(playerid, Text:Speed);
  180. return 1;
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement