SA-MP Forums Archive
IsVehicleInRangeOfPoint - 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: IsVehicleInRangeOfPoint (/showthread.php?tid=615710)



IsVehicleInRangeOfPoint - MerryDeer - 26.08.2016

Hi,

I want to make that vehicle can't not by move from specific coordinates, so range i can specife 0.1, 0.05? i'am making that if it's not in range i teleport to right coordinates.


Re: IsVehicleInRangeOfPoint - Konstantinos - 26.08.2016

https://sampwiki.blast.hk/wiki/OnUnoccupiedVehicleUpdate

Take a look at the example shown.


Re: IsVehicleInRangeOfPoint - SickAttack - 26.08.2016

This would require the callback OnUnoccupiedVehicleUpdate, which would most likely cause lag if you have a lot of vehicles. Especially with those hacks that throw vehicles around, by the ton.


Re: IsVehicleInRangeOfPoint - MerryDeer - 27.08.2016

But this callback sometimes bugged.. I'am suggest to choose smth simplier, using vehiclerangeofpoint, getvehiclepos


Re: IsVehicleInRangeOfPoint - WhiteGhost - 27.08.2016

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
This would require the callback OnUnoccupiedVehicleUpdate, which would most likely cause lag if you have a lot of vehicles. Especially with those hacks that throw vehicles around, by the ton.
god of car.


Re: IsVehicleInRangeOfPoint - SoLetsGO - 27.08.2016

PHP код:
stock IsVehicleInRangeOfPoint(vehicleid,Float:range,Float:x,Float:y,Float:z)
{
    return 
range >= GetVehicleDistanceFromPoint(vehicleidx,y,z);




Re: IsVehicleInRangeOfPoint - Scriptery - 16.10.2016

PHP код:
stock IsVehicleRangeOfPoint(vehicleid,Float:range,Float:x,Float:y,Float:z)
{
    if(
vehicleid == INVALID_VEHICLE_ID) return 0;
    
    new 
Float:DistantaCar GetVehicleDistanceFromPoint(vehicleidxyz);
    
    if(
DistantaCar <= range) return 1;
    return 
0;