06.04.2012, 15:52
How I do it: (I use an auto-login based on IP)
Of course, OnPlayerSpawn (using this method) you will have to set their position, ect.
pawn Код:
public OnPlayerConnect(playerid)
{
new p_IP [ 16 ];
if( fexist( GetAccountPath( playerid ) ) ) //They have been here before!
{
GetPlayerIp( playerid, p_IP, sizeof( p_IP ) );
INI_ParseFile( GetAccountPath( playerid ), "LoadUser_%s", .bExtra = true, .extra = playerid );
if( strcmp( p_IP, accInfo [ playerid ] [ RegisteredIP ], false ) == 0) //Their IP matches!
{
INI_ParseFile( GetAccountPath( playerid ), "LoadUser_%s", .bExtra = true, .extra = playerid );
SendClientMessage( playerid, c_orange, "-> "#WHITE"You have been automatically logged in." );
SpawnPlayer( playerid );
}
else
{
ShowPlayerDialog( playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""#ORANGE"Welcome to Zone DM - SA:MP!", "\n\nPlease enter your password in order to play!", "Submit", "Quit" );
}
}
else
{
ShowPlayerDialog( playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""#ORANGE"Welcome to Zone DM - SA:MP!", "\n\nPlease create an account in order to play!", "Submit", "Quit" );
}
TogglePlayerClock( playerid, 1 );
accStatus [ playerid ] = 0;
return 1;
}