Trunk Saving Problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Trunk Saving Problem (
/showthread.php?tid=192301)
Trunk Saving Problem -
TheHoodRat - 22.11.2010
So I'm implementing a trunk system for my server, but the problem is that when I set the file name to the vehicle ID integer (eg. 4) it always shows up as 0.cfg.
So when I put a shotgun in my trunk in vehicle ID 4, then the file would always be 0.cfg, but it's supposed to be 4.cfg, please help.
Re: Trunk Saving Problem -
Retardedwolf - 22.11.2010
Show the code?
Re: Trunk Saving Problem -
TheHoodRat - 22.11.2010
Quote:
Originally Posted by Retardedwolf
Show the code?
|
Sorry, was a bit busy.
pawn Код:
stock RegisterTrunk(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
new File[128];
format(File, sizeof(File), "Server Data/Trunk/%i.cfg",vehicleid);
dini_Create(File);
dini_IntSet(File, "Slot 1", 0);
dini_IntSet(File, "Slot 1 Ammo", 0);
return 1;
}
stock SaveTrunk(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
new File[128];
format(File, sizeof(File), "Server Data/Trunk/%i.cfg",vehicleid);
dini_IntSet(File, "Slot 1",VehicleInfo[vehicleid][TrunkSlot1]);
dini_IntSet(File, "Slot 1 Ammo", VehicleInfo[vehicleid][TrunkSlot1Ammo]);
return 1;
}
stock LoadTrunk(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
new File[128];
format(File, sizeof(File), "Server Data/Trunk/%i.cfg",vehicleid);
VehicleInfo[vehicleid][TrunkSlot1] = dini_Int(File, "Slot 1");
VehicleInfo[vehicleid][TrunkSlot1Ammo] = dini_Int(File, "Slot 1 Ammo");
return 1;
}
and under OnGameModeInit...
pawn Код:
if(!dini_Exists(File)) {
return RegisterTrunk(playerid);
}
else if(dini_Exists(File)) {
return LoadTrunk(playerid);
}
Re: Trunk Saving Problem -
TheHoodRat - 22.11.2010
Fixed, ty.