Replace this login
[pawn]else if ( strcmp( cmd, "login", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) return SendClientMessage( playerid, COLOR_GREEN, "Usage: /login [Password]" );
if ( IsRegistered( playerid ) ) return SendClientMessage( playerid, COLOR_RED, "Error: Your nick-name is not registered." );
if ( IsLoggedIn( playerid ) ) return SendClientMessage( playerid, COLOR_RED, "Error: You have already logged-in." );
new pass_confirm[ 256 ];
pass_confirm = dini_Get( file, "Password" );
if ( strcmp( encrypt( tmp ), pass_confirm, true ) == 0 )
{
format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
new level, stats, nogoto, noloc, cash, szMsg[ 128 ], IP[ 24 ];
level = dini_Int( file, "Level" );
stats = dini_Int( file, "Stats" );
nogoto = dini_Int( file, "NoGoto" );
noloc = dini_Int( file, "NoLoc" );
cash = dini_Int( file, "Cash" );
GetPlayerIp( playerid, IP, 24 );
PlayerInfo[ playerid ][ Logged ] = 1;
PlayerInfo[ playerid ][ Level ] = level;
PlayerInfo[ playerid ][ Stats ] = stats;
PlayerInfo[ playerid ][ NoGoto ] = nogoto;
PlayerInfo[ playerid ][ NoLoc ] = noloc;
UpDateFile( USERS_FILE, gPlayers[ playerid ], "Login", "1" );
UpDateFile( USERS_FILE, gPlayers[ playerid ], "Ip", IP );
SendClientMessage( playerid, COLOR_GREEN, "You have logged-in sucessfully." );
format( szMsg, sizeof( szMsg ), "Nick:[ %s ] Level:[ %d ] Status:[ %s ]", gPlayers[ playerid ], level, StatusTag( level ) );
SendClientMessage( playerid, COLOR_BLUE, "Do not spam flood, Hacks, Abused" );
SendClientMessage( playerid, COLOR_BLUE, "See Hackers, Cheaters report to admin !report [nick/id] [reason]" );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
SetPlayerMoney( playerid, cash );
}
else
{
PlayerInfo[ playerid ][ FalseLogins ]++;
if ( PlayerInfo[ playerid ][ FalseLogins ] >= LOGIN_ATTEMPTS )
{
format(str, sizeof( str ), "%s has been kicked. Reason:[ Invalid Login Attempts ]", gPlayers[ playerid ] );
SendClientMessageToAll( COLOR_RED, str );
PlayerInfo[ playerid ][ FalseLogins ] = 0;
Kick( playerid );
}
else
{
SendClientMessage( playerid, COLOR_RED, "Error: Incorrect password." );
}
}
return 1;
}[/pawn]
REGISTER
[pawn]if ( strcmp( cmd, "register", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREEN, "Usage: /c register [Password]" );
else if ( IsPlayerRegistered( gPlayers[ playerid ] ) )
{
format( str, sizeof( str ), "Error: %s is already a registered nick.", gPlayers[ playerid ] );
SendClientMessage( playerid, COLOR_RED, str );
}
else if( IsValidNick ( gPlayers[ playerid ] ) )
{
format( str, sizeof( str ), "Error: Your nick-name containes illegal characters. Please remove them." );
SendClientMessage( playerid, COLOR_RED, str );
}
else
{
format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
new string[ 24 ], IP[ 24 ], szMsg[ 128 ];
GetPlayerIp( playerid, IP, 24 );
format( string, 24, "%s", IP );
dini_Create( file );
dini_Set( file, "Password", encrypt( tmp ) );
dini_Set( file, "Login", "1" );
dini_Set( file, "Bank", "0" );
dini_Set( file, "Cash", "0" );
dini_Set( file, "Level", "1" );
dini_Set( file, "Stats", "1" );
dini_Set( file, "Ip", string );
SendClientMessage( playerid, COLOR_GREEN, "You have registered successfully." );
format( szMsg, sizeof( szMsg ), "Dont Forget Your Password:[ %s ]", tmp );
SendClientMessage( playerid, COLOR_BLUE, "Do not spam flood, Hacks, Abused" );
SendClientMessage( playerid, COLOR_BLUE, "See Hackers, Cheaters report to admin !report [nick/id] [reason]" );
SendClientMessage( playerid, COLOR_GREEN, szMsg );
PlayerInfo[ playerid ][ Logged ] = 1;
PlayerInfo[ playerid ][ Level ] = 1;
PlayerInfo[ playerid ][ Stats ] = 1;
}
return 1;
}[/pawn]
Use this pawno
http://www.4shared.com/zip/pC2m6UvOce/VCMP_-_Pawno_By_MUZAMMIL_SADIQ.html