OnPlayerLogin
#1

pawn Код:
public OnPlayerLogin(playerid,password[])
{
new string2[64];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "users/%s.ini", playername2);
new File: file = fopen(string2, io_read);
if (file)
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( file , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "pPassword" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pPassword],password, true ) == 0 )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( file , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Level" , true ) == 0 ){val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val );}
if( strcmp( key , "Sex" , true ) == 0 ){val = ini_GetValue( Data ); PlayerInfo[playerid][pSex] = strval( val );}
if( strcmp( key , "Age" , true ) == 0 ){val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val );}
if( strcmp( key , "Admin" , true ) == 0 ){val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val );}
if( strcmp( key , "Supporter" , true ) == 0 ){val = ini_GetValue( Data ); PlayerInfo[playerid][pSupporter] = strval( val );}
if( strcmp( key , "Cash" , true ) == 0 ){val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val );
}
fclose(file);
gPlayerLogged[playerid] = 1;
format(string2, sizeof(string2), "SERVER: Welcome %s.",playername2);
SendClientMessage(playerid, COLOR_WHITE,string2);
return 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "{0084FF}Login:", "{FF0000}WRONG PASSWORD!\n{FFFFFF} Please enter your password below", "Login", "Cancel");
fclose(file);
}
}
return 1;
}

Okay. I created an account system, however I' cannot get OnPlayerLogin to work.

I can type ANYTHING in, and it'll log me in, it shouldn't happen, help me please?
Reply


Messages In This Thread
OnPlayerLogin - by iLcke - 26.09.2012, 03:31
Re: OnPlayerLogin - by iLcke - 26.09.2012, 03:55
Re: OnPlayerLogin - by Rimeau - 26.09.2012, 09:25
Re: OnPlayerLogin - by ejul - 26.09.2012, 11:17

Forum Jump:


Users browsing this thread: 1 Guest(s)