SA-MP Forums Archive
Force login? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Force login? (/showthread.php?tid=331929)



Force login? - HarrySidwell - 06.04.2012

Hello,
How would I force someone to spawn at the newb spawn once they have entered there password?

Thanks.


Re: Force login? - ReneG - 06.04.2012

SetPlayerPos?


Re: Force login? - HarrySidwell - 06.04.2012

No I mean,
they get a dialog telling them to enter there password, and then they press login but after pressing login they have to press the "Spawn" button, I don't want that to happen :/


Re: Force login? - 2KY - 06.04.2012

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.


Re: Force login? - HarrySidwell - 06.04.2012

Right, you see by default the buttons at the bottom "< > spawn" are in-game and you spawn in LV.

Well,

the dialog box shows up,
you type your password and then press "Login"
and I want them to spawn right away.
How can this happen?


Re: Force login? - 2KY - 06.04.2012

Using SpawnPlayer when they hit login. (Be sure to use SetPlayerSpawn or set their position OnPlayerSpawn)


Re: Force login? - HarrySidwell - 06.04.2012

Works if your just registering but not when you already have an account! ://


Re: Force login? - Scripter12345 - 06.04.2012

Quote:
Originally Posted by HarrySidwell
Посмотреть сообщение
Works if your just registering but not when you already have an account! ://
Show us your registeration bit of code and your login code


Re: Force login? - Harish - 07.04.2012

force player after login was simple

just use SetSpawnInfo before spawn player onPlayerConnect || onPlayerRequestClass

[Tut]https://sampwiki.blast.hk/wiki/SetSpawnInfo