yini not working?
#1

I use to use mysql to make accounts and such but that no longer works, so i am trying to use yini for the first time and its simply just not working. Any ideas?

pawn Код:
INI:myini[](name[], value[])
{
    INI_String("NAME", nameTest, sizeof(nameTest));
    INI_Int("SCORE", scoreTest);
    return 0; // This is now required.
}
public OnGameModeInit()
{
    new INI:ini = INI_Open("users/myini.ini");
    INI_WriteString(ini, "NAME", "******");
    INI_WriteInt(ini, "SCORE", 5);
    INI_WriteFloat(ini, "HEALTH", 34.5);
    INI_Close(ini);
   
    INI_Load("myini.ini");
   
    printf("string: %s", nameTest);
    printf("int: %i", scoreTest);
Reply
#2

pawn Код:
#define PATH "YOUR_PATH"
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_String("Name",PlayerInfo[playerid][pName],50);
    INI_String("IP",PlayerInfo[playerid][pIP],50);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}

//When Player Connects
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
       
//Save on disconnect
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteString(File,"Name",PlayerInfo[playerid][pName]);
    INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
    INI_WriteString(File,"IP",PlayerInfo[playerid][pIP]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}

//Creating New File
new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                GetPlayerName(playerid,PlayerInfo[playerid][pName],MAX_PLAYER_NAME);
                INI_WriteString(File,"Name",PlayerInfo[playerid][pName]);
                GetPlayerIp(playerid,PlayerInfo[playerid][pIP],20);
                INI_WriteString(File,"IP",PlayerInfo[playerid][pIP]);
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)