Force login?
#1

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

Thanks.
Reply
#2

SetPlayerPos?
Reply
#3

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 :/
Reply
#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
#5

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?
Reply
#6

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

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

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
Reply
#9

force player after login was simple

just use SetSpawnInfo before spawn player onPlayerConnect || onPlayerRequestClass

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


Forum Jump:


Users browsing this thread: 1 Guest(s)