Force login?
#4

How I do it: (I use an auto-login based on IP)

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;
}
Of course, OnPlayerSpawn (using this method) you will have to set their position, ect.
Reply


Messages In This Thread
Force login? - by HarrySidwell - 06.04.2012, 15:39
Re: Force login? - by ReneG - 06.04.2012, 15:42
Re: Force login? - by HarrySidwell - 06.04.2012, 15:48
Re: Force login? - by 2KY - 06.04.2012, 15:52
Re: Force login? - by HarrySidwell - 06.04.2012, 15:55
Re: Force login? - by 2KY - 06.04.2012, 15:59
Re: Force login? - by HarrySidwell - 06.04.2012, 16:41
Re: Force login? - by Scripter12345 - 06.04.2012, 16:50
Re: Force login? - by Harish - 07.04.2012, 07:00

Forum Jump:


Users browsing this thread: 1 Guest(s)