Guest User

DynamicMap

a guest
Mar 27th, 2018
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. /*
  2. Funções: (Include)
  3.  
  4. ShowPlayerDynamicMap
  5. HidePlayerDynamicMap
  6. IsPlayerInDynamicMap
  7.  
  8. By KoloradO
  9.  
  10. */
  11.  
  12. static
  13.  
  14. bool:map_Show [MAX_PLAYERS],
  15.  
  16. Text:map_Td1,
  17. Text:map_Td2,
  18. Text:map_Td3,
  19. Text:map_Td4,
  20.  
  21. PlayerText:map_Td5 [MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...},
  22. PlayerText:map_Td6 [MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
  23.  
  24. /*
  25. Callbacks
  26. */
  27. public OnGameModeInit()
  28. {
  29. map_Td1 = TextDrawCreate(124.000000, 115.866737, "samaps:gtasamapbit1");
  30. TextDrawLetterSize(map_Td1, 0.000000, 0.000000);
  31. TextDrawTextSize(map_Td1, 201.411544, 164.149963);
  32. TextDrawAlignment(map_Td1, 1);
  33. TextDrawColor(map_Td1, -1);
  34. TextDrawSetShadow(map_Td1, 0);
  35. TextDrawSetOutline(map_Td1, 0);
  36. TextDrawFont(map_Td1, 4);
  37.  
  38. map_Td2 = TextDrawCreate(325.470428, 116.283416, "samaps:gtasamapbit2");
  39. TextDrawLetterSize(map_Td2, 0.000000, 0.000000);
  40. TextDrawTextSize(map_Td2, 201.411544, 164.149963);
  41. TextDrawAlignment(map_Td2, 1);
  42. TextDrawColor(map_Td2, -1);
  43. TextDrawSetShadow(map_Td2, 0);
  44. TextDrawSetOutline(map_Td2, 0);
  45. TextDrawFont(map_Td2, 4);
  46.  
  47. map_Td3 = TextDrawCreate(123.646942, 280.033386, "samaps:gtasamapbit3");
  48. TextDrawLetterSize(map_Td3, 0.000000, 0.000000);
  49. TextDrawTextSize(map_Td3, 201.411544, 164.149963);
  50. TextDrawAlignment(map_Td3, 1);
  51. TextDrawColor(map_Td3, -1);
  52. TextDrawSetShadow(map_Td3, 0);
  53. TextDrawSetOutline(map_Td3, 0);
  54. TextDrawFont(map_Td3, 4);
  55.  
  56. map_Td4 = TextDrawCreate(325.117431, 280.450103, "samaps:gtasamapbit4");
  57. TextDrawLetterSize(map_Td4, 0.000000, 0.000000);
  58. TextDrawTextSize(map_Td4, 201.411544, 164.149963);
  59. TextDrawAlignment(map_Td4, 1);
  60. TextDrawColor(map_Td4, -1);
  61. TextDrawSetShadow(map_Td4, 0);
  62. TextDrawSetOutline(map_Td4, 0);
  63. TextDrawFont(map_Td4, 4);
  64.  
  65. SetTimer("UpdateMapPosition", 500, true); //Timer
  66.  
  67. #if defined mAP_OnGameModeInit
  68. return mAP_OnGameModeInit();
  69. #else
  70. return 1;
  71. #endif
  72. }
  73.  
  74. forward UpdateMapPosition();
  75. public UpdateMapPosition()
  76. {
  77. for (new i = 0; i < MAX_PLAYERS; i++)
  78. {
  79. if(map_Show[i] && IsPlayerConnected(i))
  80. {
  81. new Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME + 7];
  82.  
  83. GetPlayerPos(i, x, y, z);
  84. GetPlayerName(i, name, 24);
  85. format(string, sizeof(string), "%s (%d)", name, i);
  86.  
  87. new Float:map_x = 126.000000 + 402.352966 * (x + 3000.0) / 6000.0;
  88. new Float:map_y = 102.083335 + 328.999969 * (3000.0 - y) / 6000.0;
  89.  
  90. PlayerTextDrawDestroy(i, map_Td5[i]);
  91. PlayerTextDrawDestroy(i, map_Td6[i]);
  92.  
  93. map_Td5[i] = CreatePlayerTextDraw(i, map_x, map_y, string);
  94. PlayerTextDrawLetterSize(i, map_Td5[i], 0.285352, 1.166500);
  95. PlayerTextDrawAlignment(i, map_Td5[i], 2);
  96. PlayerTextDrawColor(i, map_Td5[i], 16711935);
  97. PlayerTextDrawSetShadow(i, map_Td5[i], 1);
  98. PlayerTextDrawSetOutline(i, map_Td5[i], 0);
  99. PlayerTextDrawBackgroundColor(i, map_Td5[i], 255);
  100. PlayerTextDrawFont(i, map_Td5[i], 1);
  101. PlayerTextDrawSetProportional(i, map_Td5[i], 1);
  102.  
  103. map_Td6[i] = CreatePlayerTextDraw(i, map_x, map_y, ".");
  104. PlayerTextDrawLetterSize(i, map_Td6[i], 0.537059, 2.008333);
  105. PlayerTextDrawAlignment(i, map_Td6[i], 1);
  106. PlayerTextDrawColor(i, map_Td6[i], 16711935);
  107. PlayerTextDrawSetShadow(i, map_Td6[i], 0);
  108. PlayerTextDrawSetOutline(i, map_Td6[i], 1);
  109. PlayerTextDrawBackgroundColor(i, map_Td6[i], 51);
  110. PlayerTextDrawFont(i, map_Td6[i], 1);
  111. PlayerTextDrawSetProportional(i, map_Td6[i], 1);
  112.  
  113. PlayerTextDrawShow(i, map_Td5[i]);
  114. PlayerTextDrawShow(i, map_Td6[i]);
  115. }
  116. }
  117. return 1;
  118. }
  119.  
  120. /*
  121. Funções
  122. */
  123.  
  124. stock ShowPlayerDynamicMap(playerid)
  125. {
  126. TextDrawShowForPlayer(playerid, map_Td1);
  127. TextDrawShowForPlayer(playerid, map_Td2);
  128. TextDrawShowForPlayer(playerid, map_Td3);
  129. TextDrawShowForPlayer(playerid, map_Td4);
  130.  
  131. map_Show[playerid] = true;
  132. }
  133.  
  134. stock HidePlayerDynamicMap(playerid)
  135. {
  136. TextDrawHideForPlayer(playerid, map_Td1);
  137. TextDrawHideForPlayer(playerid, map_Td2);
  138. TextDrawHideForPlayer(playerid, map_Td3);
  139. TextDrawHideForPlayer(playerid, map_Td4);
  140.  
  141. PlayerTextDrawDestroy(playerid, map_Td5[playerid]);
  142. PlayerTextDrawDestroy(playerid, map_Td6[playerid]);
  143.  
  144. map_Show[playerid] = false;
  145. }
  146.  
  147. stock IsPlayerInDynamicMap(playerid)
  148. {
  149. return map_Show[playerid];
  150. }
  151.  
  152. /*
  153. Hooks
  154. */
  155.  
  156. #if defined _ALS_OnGameModeInit
  157. #undef OnGameModeInit
  158. #else
  159. #define _ALS_OnGameModeInit
  160. #endif
  161. #define OnGameModeInit mAP_OnGameModeInit
  162.  
  163. #if defined mAP_OnGameModeInit
  164. forward mAP_OnGameModeInit();
  165. #endif
Advertisement
Add Comment
Please, Sign In to add comment