Advertisement
yousaki22

rp_commands pawn

Feb 14th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.44 KB | None | 0 0
  1. ///------includes-------///
  2. #include <a_samp>
  3. #include <zcmd>
  4. #include <sscanf2>
  5. #include <foreach>
  6. ///------Color defines------///
  7. #define COLOR_GREY 0xAFAFAFAA
  8. #define COLOR_PURPLE 0xC2A2DAAA
  9. #define GetName
  10. ///---------forward function--------////
  11. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  12. ///---------/me command-----------///
  13. CMD:me(playerid, params[])
  14. {
  15.     if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "Use: /me [acao]");
  16.     new string[128];
  17.     format(string, sizeof(string), "* %s %s", GetPlayerNameEx(playerid), params);
  18.     ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  19.     return 1;
  20. }
  21. //-------------------------/b command------------///
  22.  
  23.  CMD:b(playerid, params[])
  24. {
  25.     new text[128], string[128];
  26.  
  27.     if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0x808080AA, "Use: /b [descrever]");
  28.  
  29.     format(string, sizeof(string), "(( [%d] %s: %s ))", playerid, GetPlayerNameEx(playerid), text);
  30.     SendNearbyMessage(playerid, 0xB3B3B3FF, string, 5.0);
  31.  
  32.     return true;
  33. }
  34.  
  35. //------------------------/pm command-------------///
  36. CMD:pm(playerid, params[])
  37. {
  38.     new str[128], text[128], targetid;
  39.  
  40.     if(sscanf(params, "us[128]", targetid, text)) return SendClientMessage(playerid, -1, "Usage: /pm [player] [text]");
  41.     if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Usage: Player isn't connected!");
  42.  
  43.     format(str, sizeof(str), "PM To %s (%d): %s", GetPlayerNameEx(targetid), targetid, text);
  44.     SendClientMessage(playerid, 0xE0E800FF, str);
  45.  
  46.     format(str, sizeof(str), "PM From %s (%d): %s", GetPlayerNameEx(playerid), playerid, text);
  47.     SendClientMessage(targetid, 0xE8C900FF, str);
  48.  
  49.     return true;
  50. }
  51. ///----------/do command----------///
  52. CMD:do(playerid, params[])
  53. {
  54.     if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "Use: /do [ambiente]");
  55.     new string[128];
  56.     format(string, sizeof(string), "* %s (( %s ))", params, GetPlayerNameEx(playerid));
  57.     ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  58.     return 1;
  59. }
  60. ///---------ProxDetector---------///
  61. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  62. {
  63.     if(IsPlayerConnected(playerid))
  64. {
  65.     new Float:posx, Float:posy, Float:posz;
  66.     new Float:oldposx, Float:oldposy, Float:oldposz;
  67.     new Float:tempposx, Float:tempposy, Float:tempposz;
  68.     GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  69.     for(new i = 0; i < MAX_PLAYERS; i++)
  70. {
  71.     if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  72. {
  73.     GetPlayerPos(i, posx, posy, posz);
  74.     tempposx = (oldposx -posx);
  75.     tempposy = (oldposy -posy);
  76.     tempposz = (oldposz -posz);
  77.     if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz <radi/16) && (tempposz > -radi/16)))
  78. {
  79.     SendClientMessage(i, col1, string);
  80. }
  81.     else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  82. {
  83.     SendClientMessage(i, col2, string);
  84. }
  85.     else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  86. {
  87.     SendClientMessage(i, col3, string);
  88. }
  89.     else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  90. {
  91.     SendClientMessage(i, col4, string);
  92. }
  93.     else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  94. {
  95.     SendClientMessage(i, col5, string);
  96. }
  97. }
  98.     else
  99. {
  100.     SendClientMessage(i, col1, string);
  101. }
  102. }
  103. }
  104.     return 1;
  105. }
  106. ///--------GetPlayerNameEx----------///
  107. stock GetPlayerNameEx(playerid)
  108. {
  109.      new pName[25];
  110.      GetPlayerName(playerid, pName, sizeof(pName));
  111.      return pName;
  112. }
  113. ///---------The End---------///
  114.  
  115. ///---------SendNearbyMessage--------///
  116. stock SendNearbyMessage(playerid, color, string[], Float: range)
  117. {
  118.     new Float: cX, Float: cY, Float: cZ;
  119.     GetPlayerPos(playerid, cX, cY, cZ);
  120.  
  121.     for(new i = 0; i < MAX_PLAYERS; i ++)
  122.     {
  123.         if(IsPlayerInRangeOfPoint(i, range, cX, cY, cZ))
  124.         {
  125.             SendClientMessage(i, color, string);
  126.         }
  127.     }
  128.  
  129.     return true;
  130. }
  131. ///----------The End----------------///
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement