How can I set the ID of a vehicle?
#1

Anyone know how I can set the ID of vehicles (using a variable too). Bellow is what I though it was, but it doesn't work since I changed the maximum ammount of possible owned cars in my gamemode.

Thanks in advance!

What I have Onder OnGameModeInt (Maybe I need to change somthing in the code or elsewhere/use somthing else):
pawn Код:
LoadCar();
    new string2[64];
    for(new h = 1; h < sizeof(CarInfo); h++)
    {
        format(string2, sizeof(string2), "LARP/Vehicles/%d.ini",h);
        if(dini_Exists(string2))
        {
            ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
            if(CarInfo[h][cPaintjob] != 999)
            {
                ChangeVehiclePaintjob(h, CarInfo[h][cPaintjob]);
            }
            SetVehicleVirtualWorld(h, CarInfo[h][cVirWorld]);
            SetVehicleModifications(h);
        }
    }
Reply
#2

You mean unique id for each vehicle?
Reply
#3

nvm misunderstood the question.
Reply
#4

You want to use the CreateVehicle() function, not AddStaticVehicleEx().
Reply
#5

Nope, didn't work. Same problem. Anyone else know?

And yes, when I say Vehicle ID I mean the unique ID... The GetPlayerVehicleID result. I need to set it to the vairable h...
Reply
#6

Not possible. The vehicle ID is only created in the function CreateVehicle, AddStaticVehicle or AddStaticVehicleEx.
Quote:
Originally Posted by SA-MP Wiki
Returns The ID of the vehicle created (NOTE: starts at 1).
Reply
#7

I know it's possible... Anyone know?
Reply
#8

EDIT: That's funny, when I'm one of the only people helping you... a thanks would have been nice...
good luck fixing it...
Reply
#9

Ok so here's my problem (I don't think the above will help), It's supposed to be where I all Owned Cars Load their Vehicle ID as the the Vehicle Profiles Number (EX: 13.ini the ID (GetPlayerVehicleID) should be 13), but if 13.ini is deleted/sold it loads 14.ini as Vehicle ID 13... And that messes EVERYTHING up.

So what can I do?
Reply
#10

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
Ok so here's my problem (I don't think the above will help), It's supposed to be where I all Owned Cars Load their Vehicle ID as the the Vehicle Profiles Number (EX: 13.ini the ID (GetPlayerVehicleID) should be 13), but if 13.ini is deleted/sold it loads 14.ini as Vehicle ID 13... And that messes EVERYTHING up.

So what can I do?
Don't use a system where it messes it up...That's the problem. As far as I know, there's no way to change the ID of a vehicle aside from some unconventional methods.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)