[HELP] y_ini
#1

I have problem with y_ini,
my stats doesn't save and i got this in console



I tried with new YSI but same...
Reply
#2

so It's up to me or?

How can I fix that
Reply
#3

ahh okay, here is my script, i put it in include
pawn Код:
native WP_Hash(buffer[], len, const str[]);

forward LoadUserData(playerid, name[], value[]);

#define INI_Exists(%0)  fexist(%0)
#define SetPVarIntEx(%0,%1,%2,%3)  SetPVarInt(%0, %1, GetPVarInt(%0, %1) %2 %3)

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN    2

#define USER_FILE       "Korisnici/%s.ini"
#define VERSION         "1.0.0"


public LoadUserData(playerid, name[], value[])
{
    if(!strcmp(name, "Lozinka"))
    {
        new
            hashPassword[129];
   
        WP_Hash(hashPassword, 129, value);
        SetPVarString(playerid, "Lozinka", hashPassword);
    }
    if(!strcmp(name, "Admin")) SetPVarInt(playerid, "Admin", strval(value));
    if(!strcmp(name, "Money")) SetPVarInt(playerid, "Money", strval(value));
    if(!strcmp(name, "Score")) SetPVarInt(playerid, "Score", strval(value));
    if(!strcmp(name, "Kills")) SetPVarInt(playerid, "Kills", strval(value));
    if(!strcmp(name, "Deaths")) SetPVarInt(playerid, "Deaths", strval(value));
    if(!strcmp(name, "Skin")) SetPVarInt(playerid, "Skin", strval(value));
}

OnPlayerRegister(playerid, password[])
{
    new
        hashPassword[129],
        uFile[35];

    format(uFile, 35, USER_FILE, GetName(playerid));

    new
        INI:playerFile = INI_Open(uFile);
       
    WP_Hash(hashPassword, 129, password);

    INI_WriteString(playerFile, "Lozinka", hashPassword);
    INI_WriteInt(playerFile, "Admin", 0);
    INI_WriteInt(playerFile, "Money", 200);
    INI_WriteInt(playerFile, "Score", 0);
    INI_WriteInt(playerFile, "Kills", 0);
    INI_WriteInt(playerFile, "Deaths", 0);
    INI_WriteInt(playerFile, "Skin", 0);

    INI_Close(playerFile);
   
    SetPVarInt(playerid, "Registered", 1);
    SetPVarInt(playerid, "Logged", 1);
    return 1;
}

OnPlayerLogin(playerid, password[])
{
    new
        hashPassword[129],
        Password[129],
        uFile[35];

    format(uFile, 35, USER_FILE, GetName(playerid));

    INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
   
    GetPVarString(playerid, "Lozinka", Password, 129);
    WP_Hash(hashPassword, 129, password);

    if(!strcmp(Password, hashPassword, false, 35))
    {
        if(GetPVarInt(playerid, "LoginTries") == 3) Kick(playerid);
        {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "iStunt - Logiranje", "{FF00EA}Upisali ste pogrešnu lozinku!\n\n\n{F81414}Molimo pokušajte ponovo!", "Login", "Leave");
        SetPVarIntEx(playerid, "LoginTries", +, 1);
        }
    }
    return 1;
}

OnPlayerLogout(playerid)
{
    new
        uFile[35];

    format(uFile, 35, USER_FILE, GetName(playerid));

    new
        INI:playerFile = INI_Open(uFile);

    INI_WriteInt(playerFile, "Admin", GetPVarInt(playerid, "Admin"));
    INI_WriteInt(playerFile, "Money", GetPlayerMoney(playerid));
    INI_WriteInt(playerFile, "Score", GetPlayerScore(playerid));
    INI_WriteInt(playerFile, "Kills", GetPVarInt(playerid, "Kills"));
    INI_WriteInt(playerFile, "Deaths", GetPVarInt(playerid, "Deaths"));
    INI_WriteInt(playerFile, "Skin", GetPVarInt(playerid, "Skin"));

    INI_Close(playerFile);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)