users/.ini
#1

my server saves players account that are written in users folder and %s.ini, But the problem is, it saves all players account, but only few players stats are saved, and other stats are not saved, can anyone help me pls?
Reply
#2

There should be a length problem within the string, I had the same thing before. Check your string length, which is written in '[]'
For example where's

pawn Код:
new string[128];
You change the [128] to [256] or more.
Reply
#3

Please, post you code here so we can help!
Reply
#4

Quote:
Originally Posted by GangsTa_
Посмотреть сообщение
There should be a length problem within the string, I had the same thing before. Check your string length, which is written in '[]'
For example where's

pawn Код:
new string[128];
You change the [128] to [256] or more.
Not Working. It saves all peoples account, but saves only few players stats, for some people it asks to register even when player is registered and account saved.
Reply
#5

Quote:
Originally Posted by GangsTa_
Посмотреть сообщение
There should be a length problem within the string, I had the same thing before. Check your string length, which is written in '[]'
For example where's

pawn Код:
new string[128];
You change the [128] to [256] or more.
Click this

OT:

Could you show us the code?
Reply
#6

pawn Код:
GetPlayerName(playerid, plname, sizeof(plname));
    format(string, sizeof(string), "users/%s.ini", plname);
if(fexist(string))
    {
        gPlayerAccount[playerid] = 1;
    }
    else
    {
        gPlayerAccount[playerid] = 0;
    }
    return 1;
}
pawn Код:
new string3[256];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "users/%s.ini", playername3);
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
pawn Код:
new string3[256];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "users/%s.ini", playername3);
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
pawn Код:
new tmp2[256];
    new string2[256];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    format(string2, sizeof(string2), "users/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
        new PassData[256];
        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 ) ) )
                {
Reply
#7

help me please.
Reply
#8

The problem is in 256 string cells! Read this: https://sampforum.blast.hk/showthread.php?tid=55261
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)