SA-MP Forums Archive
SpawnPlayer Doesn't work. - 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: SpawnPlayer Doesn't work. (/showthread.php?tid=412693)



SpawnPlayer Doesn't work. - Lynn - 02.02.2013

I'm using SpawnPlayer(playerid); and it's not working.
I have both AddPlayerClass & SetSpawnInfo, but the function just isn't being called.
It keeps me at Skin selection screen. I feel like a newbie asking this question, but yeah what's going on here.


Re: SpawnPlayer Doesn't work. - Misiur - 02.02.2013

Could you show some more code? Where are you calling SpawnPlayer?


Re: SpawnPlayer Doesn't work. - Lynn - 02.02.2013

pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(response)
        {
            // Login Info here - Loads player files etc. Proceeds to spawn player below
 
                SendClientMessage(playerid,-1,"Thank you for coming back. You're now logged in.");
                SpawnPlayer(playerid);
            }
            else
            {
                format(string, sizeof(string), " {F81414}Welcome back {FFFFFF}%s\n{F81414}Please enter your current password below.", pName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}Welcome back to LSL:RP", string, "Login", "Leave");
            }
        }
        else {
            SendClientMessage(playerid, C_WHITE, " You've been kicked. Reason: Invalid Password.");
            Kick(playerid);
        }
    }



Re: SpawnPlayer Doesn't work. - Luis- - 02.02.2013

I don't see SetSpawnInfo above SpawnPlayer.


Re: SpawnPlayer Doesn't work. - Lynn - 02.02.2013

Quote:
Originally Posted by -Luis
Посмотреть сообщение
I don't see SetSpawnInfo above SpawnPlayer.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}



Re: SpawnPlayer Doesn't work. - Luis- - 02.02.2013

Try setting above SpawnPlayer worked for me when I tried it.


Re: SpawnPlayer Doesn't work. - T0pAz - 02.02.2013

pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(response)
        {
            // Login Info here - Loads player files etc. Proceeds to spawn player below
 
                SendClientMessage(playerid,-1,"Thank you for coming back. You're now logged in.");
                SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
            }
            else
            {
                format(string, sizeof(string), " {F81414}Welcome back {FFFFFF}%s\n{F81414}Please enter your current password below.", pName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}Welcome back to LSL:RP", string, "Login", "Leave");
            }
        }
        else {
            SendClientMessage(playerid, C_WHITE, " You've been kicked. Reason: Invalid Password.");
            Kick(playerid);
        }
    }
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SpawnPlayer(playerid);
    return 1;
}
Try that. Should work.


Re: SpawnPlayer Doesn't work. - Lynn - 02.02.2013

Nope didn't work.

EDIT: Didn't see your post Topaz, let me try that.


Re: SpawnPlayer Doesn't work. - Luis- - 02.02.2013

Tried what I said?


Respuesta: SpawnPlayer Doesn't work. - Marricio - 02.02.2013

Try placing SetSpawnInfo above SpawnPlayer( playerid ); in DIALOG_LOGIN. That should work.

pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(response)
        {
            // Login Info here - Loads player files etc. Proceeds to spawn player below
 
                SendClientMessage(playerid,-1,"Thank you for coming back. You're now logged in.");
                SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
                SpawnPlayer( playerid );
            }
            else
            {
                format(string, sizeof(string), " {F81414}Welcome back {FFFFFF}%s\n{F81414}Please enter your current password below.", pName(playerid));
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}Welcome back to LSL:RP", string, "Login", "Leave");
            }
        }
        else {
            SendClientMessage(playerid, C_WHITE, " You've been kicked. Reason: Invalid Password.");
            Kick(playerid);
        }
    }