01.07.2011, 16:03
I have two usefull stocks for you:
and
pawn Код:
stock GetPlayerDistanceToVehicle(playerid, tovehicleid, &Float:Distance)
{
new Float:pX, Float:pY, Float:pZ, Float:vX, Float:vY, Float:vZ;
GetPlayerPos(playerid,pX,pY,pZ);
GetVehiclePos(tovehicleid,vX,vY,vZ);
Distance = floatsqroot((vX-pX)*(vX-pX)+(vY-pY)*(vY-pY)+(vZ-pZ)*(vZ-pZ));
}
pawn Код:
stock IsPlayerInRangeOfVehicle(playerid, tovehicleid, Float:Range)
{
new Float:vX, Float:vY, Float:vZ;
GetPlayerPos(playerid,pX,pY,pZ);
GetVehiclePos(tovehicleid,vX,vY,vZ);
if(IsPlayerInRangeOfPoint(playerid,Range,vX,vY,vZ)) return true;
return false;
}