Is vehicle valid.
#1

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

I think You should try making a Specvehicle command

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

Hope i helped you
Reply
#3

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

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

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.
Reply
#6

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

thanks pasha
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)