Saving gangs to different files, code only saving one
#1

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"
Reply
#2

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;

Reply
#3

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
Reply
#4

Guys any ideas? i need this asap...
Reply
#5

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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)