Loading Factions - 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: Loading Factions (
/showthread.php?tid=167486)
Loading Factions -
westre - 12.08.2010
pawn Код:
public SaveFactionsEx()
{
new file[128];
for(new factionid = 0; factionid < 100; factionid++)
{
format(file, sizeof(file), "/server/factions/%d.cfg", fInfo[factionid][fID]);
if (!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file,"fid",fInfo[factionid][fID]);
dini_IntSet(file,"ftaken",fInfo[factionid][fTaken]);
dini_Set(file,"fname",fInfo[factionid][fName]);
dini_Set(file,"fleader",fInfo[factionid][fLeader]);
dini_IntSet(file,"fmembers",fInfo[factionid][fMembers]);
}
}
return 1;
}
pawn Код:
public LoadFactionEx()
{
new file[128], string[256];
for(new factionid = 0; factionid < 100; factionid++)
{
format(file, sizeof(file), "/server/factions/%d.cfg", fInfo[factionid][fID]);
if (dini_Exists(file))
{
fInfo[factionid][fID] = dini_Int(file, "fid");
fInfo[factionid][fTaken] = dini_Int(file, "ftaken");
string = dini_Get(file, "fname");
strmid(fInfo[factionid][fName], string, 0, strlen(string), 255);
string = dini_Get(file, "fleader");
strmid(fInfo[factionid][fLeader], string, 0, strlen(string), 255);
fInfo[factionid][fMembers] = dini_Int(file, "fmembers");
printf("Family: %d Taken: %d Name: %s Leader: %s Members: %d",
fInfo[factionid][fID],
fInfo[factionid][fTaken],
fInfo[factionid][fName],
fInfo[factionid][fLeader],
fInfo[factionid][fMembers]);
}
}
return 1;
}
The problem is is that it saves but it doesn't load. Help will be appreciated, thanks.
Re: Loading Factions -
westre - 13.08.2010
Anyone who knows this?
Re: Loading Factions -
wups - 13.08.2010
Shouldn't this:
Код:
format(file, sizeof(file), "/server/factions/%d.cfg", fInfo[factionid][fID]);
be this: ?
Код:
format(file, sizeof(file), "/server/factions/%d.cfg", factionid);