OnVehicleRespawn - 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: OnVehicleRespawn (
/showthread.php?tid=642667)
OnVehicleRespawn -
Kraeror - 04.10.2017
Hello guys! Is there something like OnVehicleRespawn and IsVehicleInRangeOfPoint, because I want to get the vehicle pos, before the vehicle is respawned and check if vehicle was in garage, than cancel the respawn! Can I do it?
Edit: Actually I don't need IsVehicleInRangeOfPoint, I will use the virtual world!
Re: OnVehicleRespawn -
jlalt - 04.10.2017
You can use OnVehicleSpawn callback for that purpose ->
https://sampwiki.blast.hk/wiki/OnVehicleSpawn
and also you can use GetVehicleDistanceFromPoint to check if vehicle is in range of point or no.
https://sampwiki.blast.hk/wiki/GetVehicleDistanceFromPoint [
an ex ]
@ rip oma : p
Re: OnVehicleRespawn -
oMa37 - 04.10.2017
OnVehicleSpawn
Quote:
Originally Posted by SA-MP Wiki
This callback is called when a vehicle respawns.
|
IsVehicleInRangeOfPoint is pretty easy to make, either make it yourself or search and you will find it.
EDIT: jlalt was faster than me D:
Re: OnVehicleRespawn -
Zeth - 04.10.2017
Actually, there is no OnVehicleRespawn but you can get the vehicle id and then set its properties on OnVehicleSpawn after it is getting destroyed.
and here is a stock i found for IsVehicleInRangeofPoint
PHP код:
stock IsVehicleRangeOfPoint(vehicleid,Float:range,Float:x,Float:y,Float:z)
{
if(vehicleid == INVALID_VEHICLE_ID) return 0;
new Float:DistantaCar = GetVehicleDistanceFromPoint(vehicleid, x, y, z);
if(DistantaCar <= range) return 1;
return 0;
}
EDIT:jlalt and oMa37 were faster xD
Re: OnVehicleRespawn -
Kraeror - 04.10.2017
Guys why when I exit from the server, the vehicle from my garage dissapere and it is going to random coordinates?
EDIT: FIXED WITH jlalt's help! Thank you jlalt!!! You are nice scripter, you are helping a lot people!