y-ini loading help
#1

Hello everyone i am trying to make a group system everything works fine group saves in a file butt he problem is its not loading

here is my code:

PHP код:

stock SaveGroups
(id)
{
    new 
file[64];
    
format(filesizeof(file), "Groups/%d.ini"id);
    new 
INI:fHandle INI_Open(file);
    if(
fHandle != INI_NO_FILE)
    {
           
INI_SetTag(fHandle"GroupsData");
        
INI_WriteString(fHandle"GroupName"GroupInfo[id][gName]);
        
INI_WriteString(fHandle"LeaderName"GroupInfo[id][gLeaderName]);
        
INI_WriteInt(fHandle,"Active"GroupInfo[id][gActive]);
        
INI_Close(fHandle);
    }
    return 
1;
}
forward LoadGroups(idname[], value[]);
public 
LoadGroups(idname[], value[])
{
    
INI_String("GroupName"GroupInfo[id][gName],75);
    
INI_String("LeaderName"GroupInfo[id][gLeaderName], MAX_PLAYER_NAME);
    
INI_Int("Active"GroupInfo[id][gActive]);
    return 
1;
}
// loading code in GameModeInit
    
new gfile[64];
    for(new 
iMAX_GROUPSi++)
    {
        
format(gfilesizeof(gfile), "Groups/%d.ini"i);
        if(
fexist(gfile))
        {
            
INI_ParseFile(file"LoadGroups", .bExtra true, .extra i);
        }
    } 
this is group ini save file
PHP код:
[GroupsData]
GroupName the test
LeaderName 
salman97
Active 

i have one more question its not related with problem:

this is my saving code i call it in gamemode exit:
PHP код:
    for(new iMAX_GROUPSi++)
    {
        if(
GroupInfo[i][gActive] == 1){SaveGroups(i);}
    } 
my question is: should i put it in onplayerdisconnect or its not needed?
Reply


Messages In This Thread
y-ini loading help - by SalmaN97 - 20.11.2015, 23:45
Re: y-ini loading help - by Misiur - 21.11.2015, 00:26
Re: y-ini loading help - by SalmaN97 - 21.11.2015, 01:34
Re: y-ini loading help - by Yochui - 21.11.2015, 07:14
Re: y-ini loading help - by SalmaN97 - 21.11.2015, 11:26

Forum Jump:


Users browsing this thread: 3 Guest(s)