Saving gangs to different files, code only saving one - 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: Saving gangs to different files, code only saving one (
/showthread.php?tid=593582)
Saving gangs to different files, code only saving one -
MrTinder - 07.11.2015
Hi. I'm trying to make INI based gang save system but it doesnt work.What i mean - it's saving only the 1st faction(Civilian).Here are the codes:
Save code:
http://pastebin.com/aMX3LyZ1
GangPath stock:
http://pastebin.com/9etJYx2g
Gangs enum:
http://pastebin.com/Pi1ph6zq
Also i've set "#define MAX_GANGS 3" and i have defined ganks:
"#define TEAM_CIVILIAN 0
#define TEAM_GROVE 1
#define TEAM_BALLAS 2"
Re: Saving gangs to different files, code only saving one -
Sellize - 07.11.2015
I believe you need to use a for loop.
PHP код:
forward SaveFaction();
public SaveFaction()
{
new idx;
for(idx < sizeof(TeamInfo); i++)
{
new INI:File = INI_Open(GangPath(idx));
INI_WriteString(File, "Name", TeamInfo[idx][TeamName]);
INI_WriteString(File, "Rank1", TeamInfo[idx][fRank1]);
INI_WriteString(File, "Rank2", TeamInfo[idx][fRank2]);
INI_WriteString(File, "Rank3", TeamInfo[idx][fRank3]);
INI_WriteString(File, "Rank4", TeamInfo[idx][fRank4]);
INI_WriteString(File, "Rank5", TeamInfo[idx][fRank5]);
INI_WriteString(File, "Rank6", TeamInfo[idx][fRank6]);
INI_Close(File);
return 1;
}
return 1;
}
Re: Saving gangs to different files, code only saving one -
MrTinder - 07.11.2015
F:\gw mode\gamemodes\gwbycrunks.pwn(326) : warning 215: expression has no effect
F:\gw mode\gamemodes\gwbycrunks.pwn(326) : error 017: undefined symbol "i"
doesn't work ;s
Re: Saving gangs to different files, code only saving one -
MrTinder - 07.11.2015
Guys any ideas? i need this asap...
Re: Saving gangs to different files, code only saving one -
Sellize - 07.11.2015
Try again
PHP код:
forward SaveFaction();
public SaveFaction()
{
new idx;
for(idx < sizeof(TeamInfo); idx++)
{
new INI:File = INI_Open(GangPath(idx));
INI_WriteString(File, "Name", TeamInfo[idx][TeamName]);
INI_WriteString(File, "Rank1", TeamInfo[idx][fRank1]);
INI_WriteString(File, "Rank2", TeamInfo[idx][fRank2]);
INI_WriteString(File, "Rank3", TeamInfo[idx][fRank3]);
INI_WriteString(File, "Rank4", TeamInfo[idx][fRank4]);
INI_WriteString(File, "Rank5", TeamInfo[idx][fRank5]);
INI_WriteString(File, "Rank6", TeamInfo[idx][fRank6]);
INI_Close(File);
return 1;
}
return 1;
}