17.01.2015, 03:33
Lynn helped me totally i actually use a load function. I use r39-2
Anyway yes Lynn i use OnAccountLoad function here it is:
Anyway yes Lynn i use OnAccountLoad function here it is:
pawn Code:
function OnPlayerLogin2( playerid, arg1[] ) // arg1 = Password passed
{
new
Hash[ 151 ],
a[ 2 ] = "a",
pname[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, pname, sizeof( pname ) );
WP_Hash( Hash, sizeof( Hash ), arg1 );
format( arg1, 2, "%s", a );
if( strcmp( Hash, pinfo[ playerid ][ Pass ] ) != 0 )
{
ShowPlayerDialog( playerid, dialog_login, DIALOG_STYLE_PASSWORD, "Login", "Please enter your password.", "Enter", "Exit" );
return 1;
}
mysql_format( MySQLTunnel, Hash, sizeof( Hash ), "SELECT * FROM `accounts` WHERE `pname` = '%e'", pname );
mysql_pquery( MySQLTunnel, Hash, "OnAccountLoad", "d", playerid );
return 1;
}
function OnAccountLoad( playerid )
{
if( cache_get_row_count( MySQLTunnel ) )
{
pinfo[ playerid ][ pMySQLID ] = cache_get_field_content_int( 0, "pid", MySQLTunnel );
pinfo[ playerid ][ Admin ] = cache_get_field_content_int( 0, "padmin", MySQLTunnel );
pinfo[ playerid ][ VIP ] = cache_get_field_content_int( 0, "pvip", MySQLTunnel );
pinfo[ playerid ][ Score ] = cache_get_field_content_int( 0, "pscore", MySQLTunnel );
pinfo[ playerid ][ Money ] = cache_get_field_content_int( 0, "pmoney", MySQLTunnel );
pinfo[ playerid ][ Kills ] = cache_get_field_content_int( 0, "pkills", MySQLTunnel );
pinfo[ playerid ][ Deaths ] = cache_get_field_content_int( 0, "pdeaths", MySQLTunnel );
pinfo[ playerid ][ Banned ] = cache_get_field_content_int( 0, "pbanned", MySQLTunnel );
pinfo[ playerid ][ Hours ] = cache_get_field_content_int( 0, "phours", MySQLTunnel );
pinfo[ playerid ][ Minutes ] = cache_get_field_content_int( 0, "pminutes", MySQLTunnel );
pinfo[ playerid ][ Terskill ] = cache_get_field_content_int( 0, "pterskill", MySQLTunnel );
pinfo[ playerid ][ Robskill ] = cache_get_field_content_int( 0, "probskill", MySQLTunnel );
pinfo[ playerid ][ Hitmanskill ] = cache_get_field_content_int( 0, "phitmanskill", MySQLTunnel );
pinfo[ playerid ][ WantedLevel ] = cache_get_field_content_int( 0, "pwantedlevel", MySQLTunnel );
pinfo[ playerid ][ Muted ] = cache_get_field_content_int( 0, "pmuted", MySQLTunnel );
pinfo[ playerid ][ TotalRobs ] = cache_get_field_content_int( 0, "ptotalrobs", MySQLTunnel );
pinfo[ playerid ][ Freezed ] = cache_get_field_content_int( 0, "pfreezed", MySQLTunnel );
pinfo[ playerid ][ Jailed ] = cache_get_field_content_int( 0, "pjailed", MySQLTunnel );
pinfo[ playerid ][ JailTime ] = cache_get_field_content_int( 0, "pjailtime", MySQLTunnel );
pinfo[ playerid ][ Cuffed ] = cache_get_field_content_int( 0, "pcuffed", MySQLTunnel );
pinfo[ playerid ][ pLogged ] = 1;
SetPlayerScore(playerid,pinfo[playerid][Score]);
GivePlayerMoney(playerid,pinfo[playerid][Money]);
SetPlayerWantedLevel(playerid,pinfo[playerid][WantedLevel]);
}
return 1;
}