11.04.2013, 08:40
Hi all! I want to make a function but when i use it the return is my id. How can i pass my id from this loop? [ Rep++; ]
pawn Код:
GetClosestPlayer( toplayer, Float:range )
{
new Float:tpos[ 3 ], targetid = INVALID_PLAYER_ID;
GetPlayerPos( toplayer, tpos[ 0 ], tpos[ 1 ], tpos[ 2 ] );
foreach( Player, i )
{
if( IsPlayerInRangeOfPoint( i, range, tpos[ 0 ], tpos[ 1 ], tpos[ 2 ] ) )
targetid = i;
}
return targetid;
}