Spawn Issue
#1

Hey.. I used one of the register/login by Y_INI tutorial, and I'm having a problem that after you enter your password you don't spawn, it keeps you on the enterance view, with the left right arrow and the spawn bottom..

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Level",1);
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Helper",0);
                INI_WriteInt(File,"Sex",0);
                INI_WriteInt(File,"Age",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Tutorial",0);
                INI_Close(File);
                SpawnPlayer(playerid);
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SpawnPlayer(playerid);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
Btw.. my public OnSpawnPlayer is set too..

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        SetPlayerPos(playerid,-1968.6703,111.2292,27.6875);
        SetPlayerHealth(playerid, 100.0);
        SetPlayerInterior(playerid, 0);
        if(PlayerInfo[playerid][pTut] == 0)
        {
            SetCameraBehindPlayer(playerid);
            SetPlayerPos(playerid, 1.808619,32.384357,1199.593750);
            SetPlayerInterior(playerid, 1);
            TogglePlayerControllable(playerid, 0);
            TutStep[playerid] = 1;
            SendClientMessage(playerid, COLOR_TUT, "Civilized Gangstaz - Role Play Tutorial");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Please read all the tutorial and the rules!");
            SendClientMessage(playerid, COLOR_TUT, "What is your gender? (male / female).");
        }
    }
    return 1;
}
Thanks!
Reply
#2

The SpawnPlayer function as it seems may sometimes spawn you. You may use SetSpawnInfo before the SpawnPlayer function and see if it resolves current issues.
Reply
#3

It is a way, but there isnt another way?
cuz I think that if I'll use SetSpawnInfo it will define a place.. and if I want some player to spawn in another spot? I mean, its not the right way to do it, I'm sure there is a way to fix all that...

Anyone else?? thanks..
Reply
#4

It won't "define the place" as you said because at OnPlayerSpawn you already use SetPlayerPos. So, after that it will ignore the SetSpawnInfo and set your position to the one you have at OnPlayerSpawn. Also remove the if(IsPlayerConnected(playerid)), a player can't be disconnected and spawn....(in these versions of sa-mp)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)