Advertisement
Guest User

RP_Commands

a guest
Jun 14th, 2013
1,561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.88 KB | None | 0 0
  1. ///------includes-------///
  2. #include <a_samp>
  3. #include <zcmd>
  4. ///------Color defines------///
  5. #define COLOR_GREY 0xAFAFAFAA
  6. #define COLOR_PURPLE 0xC2A2DAAA
  7. ///---------forward function--------////
  8. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  9. ///---------/me command-----------///
  10. CMD:me(playerid, params[])
  11. {
  12.     if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "SYNTAX: /me [action]");
  13.     new string[128];
  14.     format(string, sizeof(string), "* %s %s", GetPlayerNameEx(playerid), params);
  15.     ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  16.     return 1;
  17. }
  18. ///----------/do command----------///
  19. CMD:do(playerid, params[])
  20. {
  21.     if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "SYNTAX: /do [action]");
  22.     new string[128];
  23.     format(string, sizeof(string), "* %s (( %s ))", params, GetPlayerNameEx(playerid));
  24.     ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  25.     return 1;
  26. }
  27. ///---------ProxDetector---------///
  28. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  29. {
  30.     if(IsPlayerConnected(playerid))
  31. {
  32.     new Float:posx, Float:posy, Float:posz;
  33.     new Float:oldposx, Float:oldposy, Float:oldposz;
  34.     new Float:tempposx, Float:tempposy, Float:tempposz;
  35.     GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  36.     for(new i = 0; i < MAX_PLAYERS; i++)
  37. {
  38.     if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  39. {
  40.     GetPlayerPos(i, posx, posy, posz);
  41.     tempposx = (oldposx -posx);
  42.     tempposy = (oldposy -posy);
  43.     tempposz = (oldposz -posz);
  44.     if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  45. {
  46.     SendClientMessage(i, col1, string);
  47. }
  48.     else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  49. {
  50.     SendClientMessage(i, col2, string);
  51. }
  52.     else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  53. {
  54.     SendClientMessage(i, col3, string);
  55. }
  56.     else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  57. {
  58.     SendClientMessage(i, col4, string);
  59. }
  60.     else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  61. {
  62.     SendClientMessage(i, col5, string);
  63. }
  64. }
  65.     else
  66. {
  67.     SendClientMessage(i, col1, string);
  68. }
  69. }
  70. }
  71.     return 1;
  72. }
  73. ///--------GetPlayerNameEx----------///
  74. stock GetPlayerNameEx(playerid)
  75. {
  76.      new pName[25];
  77.      GetPlayerName(playerid, pName, sizeof(pName));
  78.      return pName;
  79. }
  80. ///---------The End---------///
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement