Help with saving function
#7

That's the code in general
PHP код:
//Somewhere on your code put this, more likely at the top
#define VEH_PATH "%d.ini" //The path of the file
#define MAXPVEHS 100 //The maximum private vehicles

//This Function will help set a proper name for your data storing file, it will be named according to the vehicle ID the stored data belong
VehPth(vid){
    new 
str[3];
    
format(strsizeof(str), VEH_PATHvid);
    return 
str;
}

//A loop that will go thought all the files and create vehicles, this should be on OnGamemodeInIt/OnFilterScriptInIt
for(i=0;i<MAX_PVEHS;i++){
     
INI_ParseFile(VehPth(i), "VehicleLoad", .bExtra true, .extra i); //This will call the loading function to extract data
     
CreateVehicle(vehicletypeFloat:xFloat:yFloat:zFloat:rotationcolor1color2respawn_delayaddsiren=0);
     
SetVehicleNumberPlate(iVehicleInfo[i][vPlate])
     
//The rest is up to you
}

//Data loading function
LoadVehicles(vehid,name[],value[]) 

    
INI_String("Owner"VehicleInfo[vehid][vOwner], MAX_PLAYER_NAME);  
    
INI_Int("ID",VehicleInfo[veid][vID]); 
    
INI_String("Plate"VehicleInfo[vehid][vPlate], 10);  
    return 
1

Reply


Messages In This Thread
Help with saving function - by AndreiWow - 23.01.2017, 15:30
Re: Help with saving function - by AndreiWow - 24.01.2017, 15:37
Re: Help with saving function - by Amads - 24.01.2017, 15:39
Re: Help with saving function - by AndreiWow - 24.01.2017, 15:42
Re: Help with saving function - by Eoussama - 24.01.2017, 15:42
Re: Help with saving function - by AndreiWow - 24.01.2017, 16:13
Re: Help with saving function - by Eoussama - 24.01.2017, 16:52
Re: Help with saving function - by AndreiWow - 24.01.2017, 19:11
Re: Help with saving function - by Eoussama - 24.01.2017, 19:25
Re: Help with saving function - by AndreiWow - 24.01.2017, 19:41

Forum Jump:


Users browsing this thread: 1 Guest(s)