Advertisement
Guest User

Untitled

a guest
Apr 14th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. forward ProxDetector( Float:radi, playerid, string[ ], col1, col2, col3, col4, col5 );
  2. public ProxDetector( Float:radi, playerid, string[ ], col1, col2, col3, col4, col5 )
  3. {
  4.     if ( IsPlayerConnected( playerid ) )
  5.     {
  6.         new Float:posx, Float:posy, Float:posz;
  7.         new Float:oldposx, Float:oldposy, Float:oldposz;
  8.         new Float:tempposx, Float:tempposy, Float:tempposz;
  9.         GetPlayerPos( playerid, oldposx, oldposy, oldposz ) ;
  10.         for ( new i = 0; i < MAX_PLAYERS; i++ )
  11.         {
  12.             if ( IsPlayerConnected(i) && (GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld(i) ))
  13.             {
  14.                 GetPlayerPos(i, posx, posy, posz ) ;
  15.                 tempposx = ( oldposx -posx ) ;
  16.                 tempposy = ( oldposy -posy ) ;
  17.                 tempposz = ( oldposz -posz ) ;
  18.                 if ( ((tempposx < radi/16) && (tempposx > -radi/16) ) && ((tempposy < radi/16) && (tempposy > -radi/16) ) && ((tempposz < radi/16) && (tempposz > -radi/16) ))
  19.                 {
  20.                     SendClientMessage(i, col1, string ) ;
  21.                 }
  22.                 else if ( ((tempposx < radi/8) && (tempposx > -radi/8) ) && ((tempposy < radi/8) && (tempposy > -radi/8) ) && ((tempposz < radi/8) && (tempposz > -radi/8) ))
  23.                 {
  24.                     SendClientMessage(i, col2, string ) ;
  25.                 }
  26.                 else if ( ((tempposx < radi/4) && (tempposx > -radi/4) ) && ((tempposy < radi/4) && (tempposy > -radi/4) ) && ((tempposz < radi/4) && (tempposz > -radi/4) ))
  27.                 {
  28.                     SendClientMessage(i, col3, string ) ;
  29.                 }
  30.                 else if ( ((tempposx < radi/2) && (tempposx > -radi/2) ) && ((tempposy < radi/2) && (tempposy > -radi/2) ) && ((tempposz < radi/2) && (tempposz > -radi/2) ))
  31.                 {
  32.                     SendClientMessage(i, col4, string ) ;
  33.                 }
  34.                 else if ( ((tempposx < radi) && (tempposx > -radi) ) && ((tempposy < radi) && (tempposy > -radi) ) && ((tempposz < radi) && (tempposz > -radi) ))
  35.                 {
  36.                     SendClientMessage(i, col5, string ) ;
  37.                 }
  38.             }
  39.             else
  40.             {
  41.                 SendClientMessage(i, col1, string ) ;
  42.             }
  43.         }
  44.     }
  45.     return 1;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement