SA-MP Forums Archive
How to load player file - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to load player file (/showthread.php?tid=89409)



How to load player file - Dj_maryo1993 - 01.08.2009

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


Re: How to load player file - Dj_maryo1993 - 02.08.2009

UP !


Re: How to load player file - Deat_Itself - 02.08.2009

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


Re: How to load player file - Dj_maryo1993 - 02.08.2009

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 .


Re: How to load player file - MadeMan - 02.08.2009

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