Preloaded Vehicles
#1

I understand what it means. 0 = Not Preloaded , 1 = Preloaded

But, all my vehicles are preloaded 0.
I have tried many methods such as:
AddVehicle() On GameModeInit
AddVehicle() On PlayerConnect
Even moving around the function.
Still, preloaded 0 when I connect.

Basically, I don't understand how to make the vehicles preloaded.
Will I have to NOT use a streamer?
Right now I am using Double-O-Stream.
I also have a customized 1 line AddVehicle command.
Код:
Format: AddVehicle(ID, ModelID, X, Y, Z, Rotation, Color1, Color2, Respawn Delay, Faction, Price) ~Faction has to be 0 for buyable car
The problem I'm having with it being not preloaded is that with the streamer, I type /dl
and the Vehicle ID's will change randomly with the streamer when I go from place to place
(Obviously because the streamer is creating the vehicle when near the spawn)
How can I change this? Because when I enter the vehicle it comes up with it's custom ID, but it does not match the actual /dl Vehicle ID.

A little frustrated at this point. Help is highly appreciated.


Here is an example:
Код:
AddVehicle(0, 439, 1834.8577, -1871.7354, 13.2839, 180, 25, 78, 0, 0, 560); // LS - 24/7 || STALLION ||
AddVehicle(1, 439, 1836.6917, -1853.4697, 13.2858, 359, 25, 78, 0, 0, 560); // LS - 24/7 || STALLION ||
AddVehicle(2, 445, 1841.4594, -1871.6487, 13.2647, 179, 39, 39, 0, 0, 120); // LS - 24/7 || ADMIRAL ||
Basically there are written ID's for the cars in a .ini file, but they do not match the real in-game Vehicle ID.
I want them to match, but I'm unsure if it's possible without pre-loading(Which I am wanting to do)
The first number in the example is the custom ID (%d.ini)
It's loaded in order so the in-game ID's should be in order as well.
Reply
#2

Sorry for the bump, but nobody knows how to make it preload the vehicle?
Reply
#3

Is this from a plugin? The server should just load and unload the vehicles from the client w/o changing the IDs.
Reply
#4

With preloaded, do you mean like cars in a .cfg file? like cars.cfg and u load them from there?
Reply
#5

Why on earth do you need more than 2000 vehicles anyway? Even with a full 500 player server and each player driving a car, there will be 1500 empty vehicles.
Reply
#6

@ Dowster

Yeah, thats what I thought too, but my vehicles say "Preloaded: 0"
Which is abnormal.
Here is a simple example of what I am using:
Код:
AddVehicle(customid, zvehicleid, Float:Carx, Float:Cary, Float:Carz, Float:vrotation, color1, color2, respawn_delay, carfaction, price)
{
	new VehicleFile[256];
	format(VehicleFile, sizeof(VehicleFile), "Vehicles/%d.ini",customid);
	if(!dini_Exists(VehicleFile))
        {
        //Loads up all the vehicle info and creates the vehicle with this cmd:
        vInfo[customid][Car] = printf("vehicleid: %d", CreateStreamVehicle(vInfo[customid][ZVehicleID], Carx, Cary, Carz, vrotation, color1, color2, respawn_delay));
         }
}
The cmd works well, and all. But all the vehicles ID's are out of sync, constantly.
Using Double-O-Stream.

I am planning on only having about 3-400 vehicles anyway

Every vehicle has it's OWN File. %d.ini
%d = It's Custom ID number
The script loads every vehicle IN ORDER starting from 0
So why are the vehicles not in order with real ID's?
They also change when I go a far distance and come back to the vehicle.
(The /dl ID, Custom ID always stays the same, which is good)

-No I am not using a plug-in for the vehicles.
-Yes I am using a streamer (Double-O)
-Yes it does load the dini file of the vehicle to spawn the vehicle with the info.

Thanks for the help so far, +REP Given for even replying with a legitimate question/answer
Reply
#7

For that small amount of vehicles I'd reccomend you don't have that many vehicles, and instead assign vehicle IDs to an array.
Код:
customVehId[CreateVehicle(blahblahblah)] = 65 //where 65 is the custom ID
This would mean that whenever something happens with that vehicle, you can get the ID the server has for it, and just translate it to your custom ID. Just make a textfile of all your vehicles and their properties that get loaded, then i believe you can use the line numbers (starting with 1) to get the vehicle ID numbers they will have in the server.

Sidenote: Having separate files for vehicles can cause some waiting when loading/saving, I experienced this with my filterscript, and ended getting a 26.5x speed increase by using a single file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)