PDA

View Full Version : loading account[REP+]


aboa
13/02/2015, 05:05 PM
I have a problem with my accounts saving that when I try to login it makes everything sould have a value 0
so it saves everything zero
I opened a file before it had everything for example:
it was before: Level=1
it become Level=0
**The password is the only thing still saving and working well
the start of my load

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[ 512 ];
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 ); }

aboa
14/02/2015, 11:13 AM
Any help??