Question about saving vehicle id - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question about saving vehicle id (
/showthread.php?tid=645793)
Question about saving vehicle id -
jasperschellekens - 04.12.2017
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
Re: Question about saving vehicle id -
jasperschellekens - 04.12.2017
bump