06.03.2018, 13:32
You might get more than one result and thus reward more than one player; so make sure you get the proper distance from point and then compare it with the next value, will be more accurate this way.
PHP код:
new Float:x8, Float:y8, Float:z8, Float:_distMax, _closePlayer;
GetObjectPos(Object_ID, x8, y8, z8);
for(new p,j=GetPlayerPoolSize(); p <=j; p++)
{
if(!IsPlayerConnected(p) || IsPlayerNPC(p)) continue;
if(IsPlayerInRangeOfPoint(p, 7.0, x8, y8, z8)) {
new Float:_distPlayer;
_distPlayer = GetPlayerDistanceFromPoint(p, x8, y8, z8);
if(_distPlayer > _distMax) {
_closePlayer = p;
}
}
}
GivePlayerMoneyA(_closerPlayer, 150);