Guest User

Untitled

a guest
May 24th, 2012
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. //-----------------------------------------------------------------------------------|
  2. // [svCoordinates] |
  3. // |
  4. // |
  5. // - You may not remove these credits |
  6. // - You may not claim this script as yours |
  7. // |
  8. // |
  9. // |
  10. // [VERSION 1.0] Created by SuperViper |
  11. //-----------------------------------------------------------------------------------|
  12.  
  13. #include <a_samp>
  14.  
  15. // ==================================== SETTINGS ================================== //|
  16. // //|
  17. /* Comment this line if you want all players to be able to use this command */ //|
  18. #define ONLY_RCON_ADMINS //|
  19. // //|
  20. // ================================================================================ //|
  21. // DO NOT TOUCH ANYTHING BELOW THIS //|
  22. // ================================================================================ //|
  23.  
  24. forward svCoordinates_UpdateCoordinates();
  25.  
  26. new bool: svCoordinates_PlayerToggle[MAX_PLAYERS];
  27. new PlayerText: PlayerCoordinates;
  28.  
  29. public svCoordinates_UpdateCoordinates()
  30. {
  31. #if defined USE_FOREACH
  32. foreach(new playerid: Player)
  33. {
  34. #if defined ONLY_RCON_ADMINS
  35. if(IsPlayerAdmin(playerid))
  36. {
  37. if(svCoordinates_PlayerToggle[playerid] == true)
  38. {
  39. new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
  40. GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
  41. format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
  42. PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
  43. }
  44. }
  45. #else
  46. if(svCoordinates_PlayerToggle[playerid] == true)
  47. {
  48. new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
  49. GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
  50. format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
  51. PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
  52. }
  53. #endif
  54. }
  55. #else
  56. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  57. {
  58. #if defined ONLY_RCON_ADMINS
  59. if(IsPlayerAdmin(playerid))
  60. {
  61. if(svCoordinates_PlayerToggle[playerid] == true)
  62. {
  63. new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
  64. GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
  65. format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
  66. PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
  67. }
  68. }
  69. #else
  70. if(IsPlayerConnected(playerid))
  71. {
  72. if(svCoordinates_PlayerToggle[playerid] == true)
  73. {
  74. new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
  75. GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
  76. format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
  77. PlayerTextDrawSetString(playerid, PlayerCoordinates, string);
  78. }
  79. }
  80. #endif
  81. }
  82. #endif
  83. return 1;
  84. }
  85.  
  86. public OnFilterScriptInit()
  87. {
  88. SetTimer("svCoordinates_UpdateCoordinates", 1500, 1);
  89. return 1;
  90. }
  91.  
  92. public OnPlayerCommandText(playerid, cmdtext[])
  93. {
  94. if(!strcmp(cmdtext, "/coordinates", true) || !strcmp(cmdtext, "/coords", true))
  95. {
  96. #if defined ONLY_RCON_ADMINS
  97. if(IsPlayerAdmin(playerid))
  98. {
  99. if(svCoordinates_PlayerToggle[playerid] == false)
  100. {
  101. new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
  102. svCoordinates_PlayerToggle[playerid] = true;
  103. GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
  104. format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
  105. PlayerCoordinates = CreatePlayerTextDraw(playerid, 320.000000, 428.000000, string);
  106. PlayerTextDrawAlignment(playerid, PlayerCoordinates, 2);
  107. PlayerTextDrawBackgroundColor(playerid, PlayerCoordinates, 255);
  108. PlayerTextDrawFont(playerid, PlayerCoordinates, 2);
  109. PlayerTextDrawLetterSize(playerid, PlayerCoordinates, 0.190000, 1.000000);
  110. PlayerTextDrawColor(playerid, PlayerCoordinates, -1);
  111. PlayerTextDrawSetOutline(playerid, PlayerCoordinates, 1);
  112. PlayerTextDrawSetProportional(playerid, PlayerCoordinates, 1);
  113. PlayerTextDrawUseBox(playerid, PlayerCoordinates, 1);
  114. PlayerTextDrawBoxColor(playerid, PlayerCoordinates, 48);
  115. PlayerTextDrawTextSize(playerid, PlayerCoordinates, 0.000000, 191.000000);
  116. PlayerTextDrawShow(playerid, PlayerCoordinates);
  117. }
  118. else
  119. {
  120. svCoordinates_PlayerToggle[playerid] = false;
  121. PlayerTextDrawDestroy(playerid, PlayerCoordinates);
  122. }
  123. }
  124. #else
  125. if(svCoordinates_PlayerToggle[playerid] == false)
  126. {
  127. new string[128], Float: rPos[3], rInterior = GetPlayerInterior(playerid), rVirtualWorld = GetPlayerVirtualWorld(playerid);
  128. svCoordinates_PlayerToggle[playerid] = true;
  129. GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
  130. format(string, sizeof(string), "~y~X~w~: %.3f, ~y~Y~w~: %.3f, ~y~Z~w~: %.3f~n~~y~Interior~w~: %d, ~y~Virtual World~w~: %d", rPos[0], rPos[1], rPos[2], rInterior, rVirtualWorld);
  131. PlayerCoordinates = CreatePlayerTextDraw(playerid, 320.000000, 428.000000, string);
  132. PlayerTextDrawAlignment(playerid, PlayerCoordinates, 2);
  133. PlayerTextDrawBackgroundColor(playerid, PlayerCoordinates, 255);
  134. PlayerTextDrawFont(playerid, PlayerCoordinates, 2);
  135. PlayerTextDrawLetterSize(playerid, PlayerCoordinates, 0.190000, 1.000000);
  136. PlayerTextDrawColor(playerid, PlayerCoordinates, -1);
  137. PlayerTextDrawSetOutline(playerid, PlayerCoordinates, 1);
  138. PlayerTextDrawSetProportional(playerid, PlayerCoordinates, 1);
  139. PlayerTextDrawUseBox(playerid, PlayerCoordinates, 1);
  140. PlayerTextDrawBoxColor(playerid, PlayerCoordinates, 48);
  141. PlayerTextDrawTextSize(playerid, PlayerCoordinates, 0.000000, 191.000000);
  142. PlayerTextDrawShow(playerid, PlayerCoordinates);
  143. }
  144. else
  145. {
  146. svCoordinates_PlayerToggle[playerid] = false;
  147. PlayerTextDrawDestroy(playerid, PlayerCoordinates);
  148. }
  149. #endif
  150. }
  151. return 0;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment