[Tool/Web/Other] [Function]IsPlayerNearPlayer
#3

The way you did your code made the else statement useless in your forward, you could of just done it this way:

pawn Код:
stock PlayerToPlayer(playerid,targetid,Float:distance)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    if(IsPlayerInRangeOfPoint(targetid,distance,x,y,z))
    {
        return true;
    }
    return false;
}

public OnPlayerCommandText(playerid, cmdtext[]){
  new idx, cmd[256];
  cmd = strtok(cmdtext, idx);
  if(strcmp(cmd, "/near")){
    if(PlayerToPlayer(playerid,5, 10.0)){
      SendClientMessage(playerid, COLOR_WHITE, "You are near player with id 5 Radius is 10");
      return 1;
    }else{
      SendClientMessage(playerid, COLOR_WHITE, "You are NOT near player with id 5 Radius is 10");
      return 1;
    }
  }
}
Reply


Messages In This Thread
[Function]IsPlayerNearPlayer - by CoaPsyFactor - 31.07.2010, 05:08
Re: [Function]IsPlayerNearPlayer - by nuriel8833 - 31.07.2010, 06:40
Re: [Function]IsPlayerNearPlayer - by FreshKilla - 31.07.2010, 07:08
Re: [Function]IsPlayerNearPlayer - by DarkPower - 31.07.2010, 09:08
Re: [Function]IsPlayerNearPlayer - by CoaPsyFactor - 01.08.2010, 22:44
Re: [Function]IsPlayerNearPlayer - by ScottCFR - 02.08.2010, 02:21
Re: [Function]IsPlayerNearPlayer - by Young_Monaays - 05.08.2010, 19:00
Re: [Function]IsPlayerNearPlayer - by dice7 - 05.08.2010, 19:03
Re: [Function]IsPlayerNearPlayer - by CoaPsyFactor - 02.01.2011, 19:42

Forum Jump:


Users browsing this thread: 2 Guest(s)