SA-MP Forums Archive
Is vehicle valid. - 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: Is vehicle valid. (/showthread.php?tid=355737)



Is vehicle valid. - CoaPsyFactor - 01.07.2012

Hi there,

Is there any way to check is some vehicle id valid, I looked for function but I found only IsVehicleStreamedIn, and it returns just is vehicle spawned for that player, I need something that could say vehicle with that id is spawned, example, I have 5 cars, and I want to check is there car with id 9.

If anyone know something please help

Thanks in advance.


Re: Is vehicle valid. - Beginerinprogress - 01.07.2012

I think You should try making a Specvehicle command

https://sampforum.blast.hk/showthread.php?tid=108247 a specvehicle fs

Hope i helped you


Re: Is vehicle valid. - Yuryfury - 01.07.2012

What I've done in the past is do GetVehicleModel(vid), if it equaled zero, that meant there is no such vehicleid.


Re: Is vehicle valid. - ReneG - 01.07.2012

INVALID_VEHICLE_ID is defined in the samp include.
pawn Код:
stock IsVehicleValid(vehicleid)
{
    if(vehicleid != INVALID_VEHICLE_ID) return 1;
    else return 0;
}



Re: Is vehicle valid. - JaTochNietDan - 01.07.2012

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
INVALID_VEHICLE_ID is defined in the samp include.
pawn Код:
stock IsVehicleValid(vehicleid)
{
    if(vehicleid != INVALID_VEHICLE_ID) return 1;
    else return 0;
}
Have you tested that code? Do you think it would return 0 if I had 0 vehicles in my server and I did this:

pawn Код:
printf("Return value: %i", IsVehicleValid(5));
Test it out with a vehicle ID that isn't valid and tell me if it works.

In the meantime, a good answer that works was provided by Yuryfury.


Re: Is vehicle valid. - pasha97 - 01.07.2012

IsValideVehicle exists:https://sampforum.blast.hk/showthread.php?tid=304999


Re: Is vehicle valid. - CoaPsyFactor - 01.07.2012

thanks pasha