28.07.2011, 22:02
For dialogs: Yes, Im using gamer's include for making dialogs faster if you have > 100 those, at this moment I have +-200
For GetClosestVehicle:
I found ^ somewhere in this forum.
For GetClosestVehicle:
pawn Код:
stock GetClosestVehicle(playerid)
{
new Float:distance = 99980001, vehicleid = Cars, Float:pPos[3];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
for(new vehid = 1; vehid != Cars; ++vehid)
{
new Float:vPos[3];
GetVehiclePos(vehid, vPos[0], vPos[1], vPos[2]);
if(vPos[0] == 0.000 && vPos[1] == 0.000 && vPos[2] == 0.000) continue;
else
{
new Float:newdistance;
vPos[0] -= pPos[0];
vPos[1] -= pPos[1];
vPos[2] -= vPos[2];
newdistance = vPos[0] * vPos[0] + vPos[1] * vPos[1] + vPos[2] * vPos[2];
if(newdistance < distance)
{
vehicleid = vehid;
distance = newdistance;
return vehicleid;
}
}
}
return INVALID_VEHICLE_ID;
}