Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. /*
  4.  
  5. native CreateGangZoneInRange(playerid, Float: range = 10.0);
  6. native ReturnPlayerName(playerid, bool: underline = true);
  7. native ChatLocal(playerid, color, color1, color2, text[], Float: range = 30.0);
  8. native Comma(value, subs[] = ",");
  9. native SendClientMessageEx(playerid, color, text[], {Float,_}:...);
  10. native SendClientMessageToAllEx(color, text[], {Float,_}:...);
  11. native GetPlayerPosition(playerid, &Float: x, &Float: y, &Float: z, &Float: angle);
  12. native SetPlayerPosition(playerid, Float: x, Float: y, Float: z, Float: angle);
  13. native GetPlayerPositionEx(playerid, &Float: x, &Float: y, &Float: z, &Float: angle, &interior, &virtualworld);
  14. native SetPlayerPositionEx(playerid, Float: x, Float: y, Float: z, Float: angle, interior, virtualworld);
  15.  
  16. */
  17.  
  18. #define SendClientMessageEx(%0,%1,%2,%3) \
  19. format(include_string_global, sizeof(include_string_global), %2, %3) && SendClientMessage(%0, %1, include_string_global)
  20.  
  21. #define SendClientMessageToAllEx(%0,%1,%2) \
  22. format(include_string_global, sizeof(include_string_global), %1, %2) && SendClientMessageToAll(%0, include_string_global)
  23.  
  24. #define SetPlayerPosition(%0,%1,%2,%3,%4) \
  25. SetPlayerPos(%0,%1,%2,%3) && SetPlayerFacingAngle(%0,%4)
  26.  
  27. #define GetPlayerPosition(%0,%1,%2,%3,%4) \
  28. GetPlayerPos(%0,%1,%2,%3) && GetPlayerFacingAngle(%0,%4)
  29.  
  30. #define SetPlayerPositionEx(%0,%1,%2,%3,%4,%5,%6) \
  31. SetPlayerPos(%0,%1,%2,%3) && SetPlayerFacingAngle(%0,%4) \
  32. && SetPlayerInterior(playerid, %5) && SetPlayerVirtualWorld(playerid, %6)
  33.  
  34. #define GetPlayerPositionEx(%0,%1,%2,%3,%4,%5,%6) \
  35. GetPlayerPos(%0,%1,%2,%3) && GetPlayerFacingAngle(%0,%4);\
  36. %6 = GetPlayerVirtualWorld(playerid);\
  37. %5 = GetPlayerInterior(playerid)
  38.  
  39. new include_string_global[600];
  40. #pragma unused include_string_global
  41.  
  42. stock CreateGangZoneInRange(playerid, Float: range = 10.0)
  43. {
  44. static Float: minx, Float: miny, Float: maxx, Float: maxy;
  45. static Float: x, Float: y, Float: z;
  46.  
  47. GetPlayerPos(playerid, x, y, z);
  48.  
  49. minx = x - ( range * 2 );
  50. miny = y - ( range * 2 );
  51. maxx = x + ( range * 2 );
  52. maxy = y + ( range * 2 );
  53.  
  54. new zone = GangZoneCreate(minx, miny, maxx, maxy);
  55. GangZoneShowForPlayer(playerid, zone, 0xFFFFFFAA);
  56.  
  57. printf("GangZoneCreate(%f, %f, %f, %f);", minx, miny, maxx, maxy);
  58. return true;
  59. }
  60.  
  61. stock ReturnPlayerName(playerid, bool: underline = true)
  62. {
  63. new sendername[MAX_PLAYER_NAME];
  64. GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
  65.  
  66. if(underline)
  67. {
  68. new i = strfind(sendername, "_", true);
  69. strdel(sendername, i, i + 1);
  70. strins(sendername, " ", i);
  71. }
  72. return ( sendername );
  73. }
  74.  
  75. stock ChatLocal(playerid, color, color1, color2, text[], Float: range = 30.0)
  76. {
  77. static Float: x, Float: y, Float: z;
  78.  
  79. for(new i; i < MAX_PLAYERS; i++)
  80. {
  81. if(IsPlayerInRangeOfPoint(i, range, x, y, z))
  82. {
  83. SendClientMessage(i, color, text);
  84. }
  85. else if(IsPlayerInRangeOfPoint(i, range + 5.0, x, y, z))
  86. {
  87. SendClientMessage(i, color1, text);
  88. }
  89. else if(IsPlayerInRangeOfPoint(i, range + 10.0, x, y, z))
  90. {
  91. SendClientMessage(i, color2, text);
  92. }
  93. }
  94. return true;
  95. }
  96.  
  97. stock Comma(value, subs[] = ",")
  98. {
  99. new tmp[50];
  100. new result[50];
  101. new count = -1;
  102. valstr(tmp, value);
  103.  
  104. if(strlen(tmp) < 4)
  105. return ( tmp );
  106.  
  107. if(value < 0)
  108. {
  109. new i = strfind(tmp, "-", true);
  110. strdel(tmp, i, i+1);
  111. }
  112.  
  113. for(new i = strlen(tmp); i > 0; i--)
  114. {
  115. count++;
  116. if(count == 3)
  117. {
  118. strins(tmp, subs, i);
  119. count = 0;
  120. }
  121. }
  122.  
  123. if(value < 0)
  124. {
  125. format(result, strlen(tmp) + 5, "-%s,00", tmp);
  126. }
  127. else
  128. {
  129. format(result, strlen(tmp) + 4, "%s,00", tmp);
  130. }
  131.  
  132. return ( result );
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement