How can I set the ID of a vehicle? -
jakejohnsonusa - 28.01.2013
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);
}
}
Re: How can I set the ID of a vehicle? -
Riddick94 - 28.01.2013
You mean unique id for each vehicle?
Re: How can I set the ID of a vehicle? -
Maraudeur - 28.01.2013
nvm misunderstood the question.
Re: How can I set the ID of a vehicle? -
Scenario - 28.01.2013
You want to use the CreateVehicle() function, not AddStaticVehicleEx().
Re: How can I set the ID of a vehicle? -
jakejohnsonusa - 29.01.2013
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...
Re: How can I set the ID of a vehicle? -
Threshold - 29.01.2013
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).
|
Re: How can I set the ID of a vehicle? -
jakejohnsonusa - 29.01.2013
I know it's possible... Anyone know?
Re: How can I set the ID of a vehicle? -
Threshold - 29.01.2013
EDIT: That's funny, when I'm one of the only people helping you... a thanks would have been nice...
good luck fixing it...
Re: How can I set the ID of a vehicle? -
jakejohnsonusa - 29.01.2013
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?
Re: How can I set the ID of a vehicle? -
[ABK]Antonio - 30.01.2013
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.