SA-MP Forums Archive
load accounts[+rep] - 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: load accounts[+rep] (/showthread.php?tid=571877)



load accounts[+rep] - aboa - 23.04.2015

I'm working on a new project and I have a problem with load account
sometimes when you login your account doesn't load so you get everything reseted
I'm using load way like in the gf


Re : load accounts[+rep] - StreetRP - 23.04.2015

Mysql Ini ?


Re: load accounts[+rep] - aboa - 23.04.2015

pawn Код:
stock OnPlayerLogin(playerid,password[])
{
    new tmp2[128];
    new string2[256];
    format(string2, sizeof(string2), "%s.ini",PlayerName(playerid));
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
        new PassData[128];
        new keytmp[256], valtmp[256];
        fread( UserFile , PassData , sizeof( PassData ) );
        keytmp = ini_GetKey( PassData );
        if( strcmp( keytmp , "Key" , true ) == 0 )
        {
            valtmp = ini_GetValue( PassData );
            strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
        }
            if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
        {
           
            new key[ 256 ] , val[ 256 ];
            new Data[ 256 ];
            while ( fread( UserFile , Data , sizeof( Data ) ) )
            {
                key = ini_GetKey( Data );
                if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }