KaLu17

[stock] ProxDetector(Float:radi, playerid, string[],col1,col

May 2nd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.25 KB | None | 0 0
  1. stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  2. {
  3.     if(IsPlayerConnected(playerid))
  4.     {
  5.         new Float:posx, Float:posy, Float:posz;
  6.         new Float:oldposx, Float:oldposy, Float:oldposz;
  7.         new Float:tempposx, Float:tempposy, Float:tempposz;
  8.  
  9.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  10.         for(new i = 0; i < MAX_PLAYERS; i++)
  11.         {
  12.             if(IsPlayerConnected(i))
  13.             {
  14.                 if(!AscoltaChat[i])
  15.                 {
  16.                     GetPlayerPos(i, posx, posy, posz);
  17.                     tempposx = (oldposx -posx);
  18.                     tempposy = (oldposy -posy);
  19.                     tempposz = (oldposz -posz);
  20.                     if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  21.                     {
  22.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  23.                         {
  24.                             SendClientMessage(i, col1, string);
  25.                         }
  26.                     }
  27.                     else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  28.                     {
  29.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  30.                         {
  31.                             SendClientMessage(i, col2, string);
  32.                         }
  33.                     }
  34.                     else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  35.                     {
  36.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  37.                         {
  38.                             SendClientMessage(i, col3, string);
  39.                         }
  40.                     }
  41.                     else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  42.                     {
  43.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  44.                         {
  45.                             SendClientMessage(i, col4, string);
  46.                         }
  47.                     }
  48.                     else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  49.                     {
  50.                         if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  51.                         {
  52.                             SendClientMessage(i, col5, string);
  53.                         }
  54.                     }
  55.         }
  56.                 else
  57.                 {
  58.                     SendClientMessage(i, col1, string);
  59.                 }
  60.             }
  61.         }
  62.     }
  63.     return 1;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment