OnVehicleRespawn
#1

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!
Reply
#2

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
Reply
#3

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:
Reply
#4

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(vehicleidxyz);
    
    if(
DistantaCar <= range) return 1;
    return 
0;

EDIT:jlalt and oMa37 were faster xD
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)