How to load player file
#1

I have an script , but i don't know how to read from file and give custom name.ini vallues for PlayerInfo[playerid][AdminLevel] ,PlayerInfo[playerid][Moneyl] , etc .
So far it writes me some things in name.ini(%s.ini)
Here is the full script on pastebin http://pastebin.com/m699b9e43
I tryed something at public playerenter(playerid) .( Ps I'm calling the public playerenter(playerid) with command /login )


Here is the playerenter , anything else work fine .
pawn Код:
public playerenter(playerid)
{
  new string2[64];
  new valtmp[256];
  new val[ 256 ];
  new PassData[256];
  new Data[ 256 ];
  new key[ 256 ];
    new playername2[MAX_PLAYER_NAME];
  GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
      valtmp = ini_GetValue( PassData );
      while ( fread( UserFile , Data , sizeof( Data ) ) )
      {
        if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][AdminLevel] = strval( val );}
      }
    }
    return 1;
}
And this is how an account looks like
Код:
AdminLevel=0
Money=0
Password=temppas
Logedin=0
Coordx=1156901832.1
Coordy=1151860981.1
Coordz=1098251876.1
Please don't say "use dini" coz i already tryed
Reply
#2

UP !
Reply
#3

Quote:
Originally Posted by Dj_maryo1993
UP !
may be my mistake u deleted some alphabets
Reply
#4

Quote:
Originally Posted by Death_Itself
Quote:
Originally Posted by Dj_maryo1993
UP !
may be my mistake u deleted some alphabets
Instead of complayning you could help me , sorry i'm not english , see my signature .
Reply
#5

Quote:
Originally Posted by Dj_maryo1993
Please don't say "use dini" coz i already tryed
And what happened?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)