Advertisement
artyom_triodin1

SAMP SPEEDOMETER SCRIPT

Oct 14th, 2014
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Text:R[MAX_PLAYERS];
  4. new Text:S[MAX_PLAYERS];
  5. new Text:S2[MAX_PLAYERS];
  6.  
  7. #if defined FILTERSCRIPT
  8.  
  9. #endif
  10.  
  11. forward SPED(playerid);
  12.  
  13. public SPED(playerid)
  14. {
  15. new car, Float:x, Float:y, Float:z, Float:speed, str[256], init;
  16. car = GetPlayerVehicleID(playerid);
  17. if(car != 0)
  18. {
  19. GetVehicleVelocity(car, x, y, z);
  20. speed = floatsqroot(((x*x)+(y*y))+(z*z))*175.4445;
  21. init = floatround(speed, floatround_round);
  22. format(str, 256, "KM/H: %i", init);
  23. TextDrawSetString(S[playerid], str);
  24. }
  25. else
  26. {
  27. TextDrawSetString(S[playerid], " ");
  28. }
  29. return 1;
  30. }
  31.  
  32. forward SPED2(playerid);
  33.  
  34. public SPED2(playerid)
  35. {
  36. new car, Float:x, Float:y, Float:z, Float:speed, str[256], init;
  37. car = GetPlayerVehicleID(playerid);
  38. if(car != 0)
  39. {
  40. GetVehicleVelocity(car, x, y, z);
  41. speed = floatsqroot(((x*x))+((y*y))+(z*z))*96.77745;
  42. init = floatround(speed, floatround_round);
  43. format(str, 256, "MP/H: %i", init);
  44. TextDrawSetString(S2[playerid], str);
  45. }
  46. else
  47. {
  48. TextDrawSetString(S2[playerid], " ");
  49. }
  50. return 1;
  51. }
  52.  
  53. forward RP(playerid);
  54.  
  55. public RP(playerid)
  56. {
  57. new car, Float:x, Float:y, Float:z, Float:speed, str[256], init;
  58. car = GetPlayerVehicleID(playerid);
  59. if(car != 0)
  60. {
  61. GetVehicleVelocity(car, x, y, z);
  62. speed = floatsqroot((x*x)+((y*y))+(z*z))*4.454;
  63. init = floatround(speed, floatround_round);
  64. format(str, 256, "RMP/H: %i", init);
  65. TextDrawSetString(R[playerid], str);
  66. }
  67. else
  68. {
  69. TextDrawSetString(R[playerid], " ");
  70. }
  71. return 1;
  72. }
  73.  
  74. public OnFilterScriptInit()
  75. {
  76. SetTimer("SPED", 5, true);
  77. SetTimer("SPED2", 5, true);
  78. SetTimer("RP", 5, true);
  79. return 1;
  80. }
  81.  
  82. public OnPlayerConnect(playerid)
  83. {
  84. S[playerid] = TextDrawCreate(250.0, 405.0, " ");
  85. TextDrawLetterSize(S[playerid], 0.6, 0.8);
  86. TextDrawSetOutline(S[playerid], 1);
  87. TextDrawColor(S[playerid], 0x00FFFFFF);
  88. TextDrawShowForPlayer(playerid, S[playerid]);
  89. R[playerid] = TextDrawCreate(250.0, 385.0, " ");
  90. TextDrawLetterSize(R[playerid], 0.6, 0.8);
  91. TextDrawSetOutline(R[playerid], 1);
  92. TextDrawColor(R[playerid], 0x0080C0FF);
  93. TextDrawShowForPlayer(playerid, R[playerid]);
  94. S2[playerid] = TextDrawCreate(250.0, 425.0, " ");
  95. TextDrawLetterSize(S2[playerid], 0.6, 0.8);
  96. TextDrawColor(S2[playerid], 0xFFFF00FF);
  97. TextDrawSetOutline(S2[playerid], 1);
  98. TextDrawShowForPlayer(playerid, S2[playerid]);
  99. return 1;
  100. }
  101.  
  102. public OnPlayerDeath(playerid, killerid, reason)
  103. {
  104. TextDrawDestroy(S[playerid]);
  105. TextDrawDestroy(S2[playerid]);
  106. TextDrawDestroy(R[playerid]);
  107. return 1;
  108. }
  109.  
  110. public OnVehicleDeath(vehicleid, killerid)
  111. {
  112. new playerid;
  113. TextDrawDestroy(S[playerid]);
  114. TextDrawDestroy(S2[playerid]);
  115. TextDrawDestroy(R[playerid]);
  116. return 1;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement