Quote:
Originally Posted by GooMan
pawn Код:
public Naechstecar(playerid, Float:radius) { new Float:SpielerX, Float:SpielerY, Float:SpielerZ, Float:CarX, Float:CarZ, Float:CarY; GetPlayerPos(playerid, SpielerX, SpielerY, SpielerZ); for(new i = 1; i < MAX_VEHICLES; i++) { GetVehiclePos(i, CarX, CarY, CarZ); if((floatabs(SpielerX-CarX)<radius)&&(floatabs(SpielerY-CarY)<radius)&&(floatabs(SpielerZ-CarZ)<radius)) { return i; } } return false; }
^^
|
This will actually get the first car that is in radius of 5 points from the player, not the nearest.
And use..
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, radius, CarX, CarY, CarZ))
.. it's faster.