Way to save vehicle info
#1

Alright so i am making a system that allows you to put things in a vehicle's trunk, I want this option available to all of the vehicles not only the owned cars so i want a way to be able to save it to each vehicle.
So i made the variables and stuff, And i cant use like the id of the car that is saved to a players data, because it is different than the vehicle id ingame and it doesnt allow me to save to all of the vehicles, by saying save i mean saving and loading for saved vehicles but for the non owned vehicles it just saves in game not in data, so if a restart occurs they all are reset.
So how can i be able to save all of the cars.should i use the vehicle id like
pawn Код:
Vehiclestuff[vehicle id ingame][....]
or is there any better way because using the vehicle id might make problems because it changes in some cases.
Reply
#2

If you're creating vehicles into files, you need to grab the file ID and the in game ID in the file. That's how I do it at least and it works fine for saving, loading items like that. Example:

PHP код:
#define                 MAX_DYNAMIC_VEHICLES                1000
enum DynamicVehicles
{
    
vehicleID// File ID. 
    
vehicleIG // Ingame ID.
};
new 
FacVehicleData[MAX_DYNAMIC_VEHICLES][DynamicVehicles]; 
And an example of what I've done:
PHP код:
new vehicle GetPlayerVehicleID(playerid), carid IsFactionVehicle(vehicle);
if(
carid != -&& FacVehicleData[carid][vehicleFaction] > && FacVehicleData[carid][vehicleCopGuns] && PlayerData[playerid][pFaction] == FacVehicleData[carid][vehicleFaction])
        {
            
ShowPlayerDialog(playeridDIALOG_USEDIALOG_STYLE_LISTtitlestring"Ok""");
        } 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)