GetClosestVehicleFromVehicle ?? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetClosestVehicleFromVehicle ?? (
/showthread.php?tid=449476)
GetClosestVehicleFromVehicle ?? -
Opah - 09.07.2013
Can Somebody show me to create that function ??
Re: GetClosestVehicleFromVehicle ?? -
Jefff - 09.07.2013
pawn Код:
GetClosestVehicleFromVehicle(vehicleid)
{
new
Float:X,
Float:Y,
Float:Z,
Float:Distance,
Float:DefaultDistance = 999999999.9,
vID = INVALID_VEHICLE_ID;
GetVehiclePos(vehicleid,X,Y,Z);
for(new carid = 1; carid != MAX_VEHICLES; carid++)
if(IsValidVehicle(carid))
{
Distance = GetVehicleDistanceFromPoint(carid, X, Y, Z);
if(Distance < DefaultDistance)
{
DefaultDistance = Distance;
vID = carid;
}
}
return vID;
}
+
https://sampwiki.blast.hk/wiki/IsValidVehicle
Re: GetClosestVehicleFromVehicle ?? -
Opah - 09.07.2013
Thank You So Much
Re: GetClosestVehicleFromVehicle ?? -
Opah - 09.07.2013
sorry this returns the vehicleid id the player is in
Re: GetClosestVehicleFromVehicle ?? -
Opah - 09.07.2013
sorry messed up again it works thanx man