Question about saving vehicle id
#1

Hello there,
Before i start writing a script which wouldnt work after all i would like to ask if someone knows if you can save and load stats for vehicles?
I mean, if i save it with vehicleid, does the same vehicle load that vehicleid after server restart?
I really wonder if this would work before starting to write anything.
I want it to load the inventory when player is in range of the vehicle.
Example:
Код:
//saving
new file[64];
format(file, sizeof(file), "VehInventory/%s.ini", GetName(playerid));
if(!dini_Exists(file)) dini_Create(file);
dini_IntSet(file, "Slot0", InvVehInfo[vehicleid][iSlot][0]);
dini_IntSet(file, "Slot1", InvVehInfo[vehicleid][iSlot][1]);
dini_IntSet(file, "Slot2", InvVehInfo[vehicleid][iSlot][2]);
//loading 
	for(new a = 0; a < MAX_VEHICLES; a++)
	{
		GetVehiclePos(a, XV, YV, ZV);
		if(IsPlayerInRangeOfPoint(playerid, 4.0, XV, YV, ZV))
		{
		    new file[64];
			format(file, sizeof(file), "VehInventory/%s.ini", GetVehicleID(a));
			InvInfo[a][iSlot][0] = dini_Int(file,"Slot0");
			InvInfo[a][iSlot][1] = dini_Int(file,"Slot1");
			InvInfo[a][iSlot][2] = dini_Int(file,"Slot2");
		}
	}
Will this work?
Thanks in advance
Reply
#2

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)