Problem with SpawnPlayer
#1

When a player registers, SpawnPlayer is called, but it doesn't work, I still see the spawn screen, and I have to click Spawn manually to spawn. Why is that, since SpawnPlayer is called when a player registers.

Here's my register code
pawn Код:
case DIALOG_REGISTER:
        {
            if(!response)
            {
                SendErrorMessage(playerid, "You need to register in order to play!");
                Kick(playerid);
            }
            else
            {
                if(strlen(inputtext) < 4)
                {
                    SendErrorMessage(playerid, "Your password needs to have more than 3 characters.");
                    return SendPlayerDialog(playerid, DIALOG_REGISTER);
                }
                new password[129],
                    query[412];
                WP_Hash(password, sizeof(password), inputtext);
                format(query, sizeof(query), "INSERT INTO `Players` (`Name`, `Password`, `AdminLevel`, `Health`, `Armour`) VALUES ('%s', '%s', 0, 100.0, 0.0)", db_escape(GetName(playerid)), db_escape(password));
                db_free_result(db_query(Database, query));
                SendSuccessMessage(playerid, "You have registered!");
                                SetSpawnInfo(playerid, NO_TEAM, 299, 1677.6185, 1447.7749, 10.7757, 0, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
            }
        }
Reply
#2

Bump, please help it's kinda urgent.
Reply
#3

What's your problem again I didn't understand it.
Reply
#4

When someone register they are supposed to spawn, but they don't spawn.
After I register the dialog dissapears but I can still see the Spawn button and the class selections arrows, I have to click spawn manually if I want to spawn, but it's supposed to happen automatically, since there is "SpawnPlayer(playerid)" in the register dialog.
Reply
#5

You are in OnPlayerRequestClass callback I guess. If you want to skip the callback, put inside SpawnPlayer(playerid);
Reply
#6

Put the SetSpawnInfo under OnPlayerRequestClass or put SpawnPlayer(playerid); under it instead.
Reply
#7

move
pawn Код:
SetSpawnInfo(playerid, NO_TEAM, 299, 1677.6185, 1447.7749, 10.7757, 0, 0, 0, 0, 0, 0, 0);
to
pawn Код:
DIALOG_LOGIN:
It should work
Reply
#8

It looks like if I add a timer when displaying the dialog, it works fine.
Thanks for the help anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)