Advertisement
KaLu17

public PlayerToPlayer

Apr 10th, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.77 KB | None | 0 0
  1. forward PlayerToPlayer(Float:radi, playerid, targetid);
  2. public PlayerToPlayer(Float:radi, playerid, targetid)
  3. {
  4.     if(IsPlayerConnected(playerid) && IsPlayerConnected(targetid) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
  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.  
  11.         GetPlayerPos(targetid, posx, posy, posz);
  12.         tempposx = (oldposx -posx);
  13.         tempposy = (oldposy -posy);
  14.         tempposz = (oldposz -posz);
  15.  
  16.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  17.         {
  18.             return 1;
  19.         }
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement