SA-MP Forums Archive
Problem with SpawnPlayer - 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: Problem with SpawnPlayer (/showthread.php?tid=354315)



Problem with SpawnPlayer - Dodo9655 - 26.06.2012

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);
            }
        }



Re: Problem with SpawnPlayer - Dodo9655 - 26.06.2012

Bump, please help it's kinda urgent.


Re: Problem with SpawnPlayer - AdamCooper - 26.06.2012

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


Re: Problem with SpawnPlayer - Dodo9655 - 26.06.2012

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.


Re: Problem with SpawnPlayer - Roko_foko - 26.06.2012

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


Re: Problem with SpawnPlayer - JonnyDeadly - 26.06.2012

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


Re: Problem with SpawnPlayer - KosmasRego - 26.06.2012

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


Re: Problem with SpawnPlayer - Dodo9655 - 26.06.2012

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