SA-MP Forums Archive
Getting id of vehicle - 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: Getting id of vehicle (/showthread.php?tid=464235)



Getting id of vehicle - Yako - 15.09.2013

Hello, I want to ask for help. How I can get the id of ownership vehicle.

This is cmd:
Код:
if(!strcmp(option, "park", true))
{
new vehicleid = GetPlayerVehicleID(playerid);
vehicleid returns me 111, but I need to get vInfo[something here][Id] which is 1, how I can get it? The vehicle is created like this:
Код:
vInfo[i][Vehicle] = CreateVehicle(vInfo[i][Model], vInfo[i][Pos][0], vInfo[i][Pos][1], vInfo[i][Pos][2]+0.5, vInfo[i][Pos][3], vInfo[i][Color][0], vInfo[i][Color][1], -1);



Re: Getting id of vehicle - Eyce - 15.09.2013

Have you tried something like
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
print("%d", vInfo[vehicleid][Id]);



Re: Getting id of vehicle - Yako - 15.09.2013

Yeah, it returns 0


Re: Getting id of vehicle - Kirollos - 15.09.2013

make a for loop

i.e:

pawn Код:
for(new i = 0; i < 100; i++)
{
    if(GetPlayerVehicleID(playerid) == vInfo[i][Vehicle])
    {
        // Here it is
    }
}



Re: Getting id of vehicle - Yako - 16.09.2013

Thanks, got it working