vehicle id

Started by Coolkid, Jun 23, 2016, 04:41 PM

Previous topic - Next topic

Coolkid

how can i get vehicle id after creating it without sitting in it?

i am creating a vehicle system but i coulbot figure out how could i get vehicle id without sitting in it

Thanks in advance

Thijn

CreateVehicle returns the new vehicle created, so just get the .ID from that.

KAKAN

Take a look at this:-
local veh = CreateVehicle(...);
print( typeof veh );
Output: Instance
That means you can access/use all the properties/methods of that veh variable.
So, use: veh.ID to get its ID.
oh no

Coolkid

Quote from: KAKAN on Jun 23, 2016, 05:27 PMTake a look at this:-
local veh = CreateVehicle(...);
print( typeof veh );
Output: Instance
That means you can access/use all the properties/methods of that veh variable.
So, use: veh.ID to get its ID.
If I do vehicle count  then it will be also if I think

Thijn

Quote from: Coolkid on Jun 23, 2016, 08:07 PM
Quote from: KAKAN on Jun 23, 2016, 05:27 PMTake a look at this:-
local veh = CreateVehicle(...);
print( typeof veh );
Output: Instance
That means you can access/use all the properties/methods of that veh variable.
So, use: veh.ID to get its ID.
If I do vehicle count  then it will be also if I think
Why would you do that instead of just getting the ID directly? You have the vehicle instance...

Coolkid

I have 1 more question when vehicle explodes and respawn does it have same I'd or its is changes

DizzasTeR

ID remains same if it explodes and respawns

Coolkid

Quote from: Doom_Kill3R on Jun 23, 2016, 09:26 PMID remains same if it explodes and respawns
Thanks for sharing this info but thik in of I use vehicle count at the same time of creating vehicle will not it give me I'd exactly I am asking you this because I have already scripted whole car system and don't want to mess with it :(

Thijn

Quote from: Coolkid on Jun 23, 2016, 10:25 PM
Quote from: Doom_Kill3R on Jun 23, 2016, 09:26 PMID remains same if it explodes and respawns
Thanks for sharing this info but thik in of I use vehicle count at the same time of creating vehicle will not it give me I'd exactly I am asking you this because I have already scripted whole car system and don't want to mess with it :(
jesus. DON'T USE VEHICLE COUNT TO GET THE ID. USE Vehicle.ID

KAKAN

Well, that's because, Vehicle ID starts from 0 while vehicle count starts from one( I think so )
oh no

Xmair

Quote from: KAKAN on Jun 24, 2016, 08:30 AMWell, that's because, Vehicle ID starts from 0 while vehicle count starts from one( I think so )
Vehicle IDs start from 1 while GetVehicleCount starts from 0.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD