SA-MP Forums Archive
y_ini problem! - 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: y_ini problem! (/showthread.php?tid=379304)



y_ini problem! - Glint - 21.09.2012

Hello guys i have a CMD (using ZCMD) /register [password] it works fine it hashes passwords and everything afterwords i can even login, however one problem is the player file looks something like this :
Код:
Adminlevel = 0
Money = 0
Scores = 0
Kills = 0
Banned = 0
Hours = 0
Deaths = 0
[Destiny Gang Wars Player Informa]
Password = 523B1F27E81DF2C39FE06D9958F88C7D56F1C8669A822481845A0E3C84D68CCC13F69BD8A8A56ADE83D54230396EDA4A8CBA845B7F553D37E99EBCBFB1B6374C
AdminLevel = 0
Money = 0
Kills = 0
Banned = 0
PlayingTime = 0
Deaths = 0
Why ?


Re: y_ini problem! - [HK]Ryder[AN] - 21.09.2012

No Code no Help


Re: y_ini problem! - Glint - 21.09.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
No Code no Help
What part of code you want me to give you ?


Re: y_ini problem! - [HK]Ryder[AN] - 21.09.2012

Where it saves the INI..probably OnPlayerDisconnect
and also where it creates the INI..most probably OnPlayerConnect


Re: y_ini problem! - Glint - 21.09.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Where it saves the INI..probably OnPlayerDisconnect
and also where it creates the INI..most probably OnPlayerConnect
No it creates it using a cmd however
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    // - - General Stuff - - //
    aDuty[playerid] = 0;
    new pName[MAX_PLAYER_NAME], Str[64];
    GetPlayerName(playerid, pName, sizeof(pName));
    // - - Leaving Message - - //
    switch(reason)
    {
        case 0: format(Str, sizeof(Str), "{FF8000}>{C0C0C0} %s Has Left The Server {FF0000}(Timeout)", pName);
        case 1: format(Str, sizeof(Str), "{FF8000}>{C0C0C0} %s Has Left The Server {FF0000}(Leaving)", pName);
    }
    SendClientMessageToAll(-1, Str);
    // - - Saving Stats - - //
    if(fexist(UserPath(playerid)))
    {
        new INI:File = INI_Open(UserPath(playerid));
        INI_WriteInt(File, "Adminlevel", pInfo[playerid][Adminlevel]);
        INI_WriteInt(File, "Money", GetPlayerMoney(playerid));
        INI_WriteInt(File, "Scores", GetPlayerScore(playerid));
        INI_WriteInt(File, "Kills", pInfo[playerid][Kills]);
        INI_WriteInt(File, "Banned", pInfo[playerid][Banned]);
        INI_WriteInt(File, "Hours", pInfo[playerid][pPlayingTime]);
        INI_WriteInt(File, "Deaths", pInfo[playerid][Deaths]);
        INI_Close(File);
        return 1;
    }
    return 1;
}
And the register command /register [password]
pawn Код:
CMD:register(playerid, params[])
{
    if(fexist(UserPath(playerid))) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You Are Already Registered");
    if(isnull(params)) return SendClientMessage(playerid, -1, "{FF8000}USAGE: {FFFFFF}/register [password]");
    new pName[MAX_PLAYER_NAME], HashPass[129];
    GetPlayerName(playerid, pName, sizeof(pName));
    WP_Hash(HashPass, sizeof(HashPass), params);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File, "Destiny Gang Wars Player Information");
    INI_WriteString(File, "Password", HashPass);
    INI_WriteInt(File, "AdminLevel", 0);
    INI_WriteInt(File, "Money", 0);
    INI_WriteInt(File, "Kills", 0);
    INI_WriteInt(File, "Banned", 0);
    INI_WriteInt(File, "PlayingTime", 0);
    INI_WriteInt(File, "Deaths", 0);
    INI_Close(File);
    SendClientMessage(playerid, -1, "{FF8000}>>{FFFFFF} You Have Been {00FF00}Successfully{FFFFFF} Registered");
    return 1;
}



Re: y_ini problem! - Glint - 21.09.2012

I am sorry guys i fixed it please lock this topic admins.


Re: y_ini problem! - [HK]Ryder[AN] - 21.09.2012

I found out the problem. When the player does /register you are writing the values AFTER setting the tag whereas when the player is disconnecting you are writing them WITHOUT setting the tag so they are being saved differently.