31.07.2010, 07:08
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;
}
}
}