Server sends me back to class selection - 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: Server sends me back to class selection (
/showthread.php?tid=459528)
Server sends me back to class selection -
newbienoob - 23.08.2013
I'm making a custom class selection. Server should spawn me after I click a textdraw. But it sends me back to class selection.
pawn Code:
else if(playertextid == tID[playerid][9])
{
ClearTD(playerid); //removes all textdraws
CancelSelectTextDraw(playerid);
TogglePlayerSpectating(playerid,0); //I set it to 1 under OnPlayerConnect and setting it back to 0 after they've done choosing a skin.
SetPlayerSkin(playerid, (Player[playerid][Team] == CTerror) ? 285 : 28); //Sets player's skin
Player[playerid][Skin] = GetPlayerSkin(playerid);
SpawnPlayer(playerid); //Spawns them
SetCameraBehindPlayer(playerid);
}
Re: Server sends me back to class selection -
Cypress - 23.08.2013
When you toggle player spectating off, it automatically forces player to spawn, so you don't have to use SpawnPlayer function.
Code:
Note: When the spectating is turned off, OnPlayerSpawn will automatically be called.
Also check your OnPlayerSpawn callback, maybe there is an issue there, however first try removing the SpawnPlayer as I said before.
AW: Server sends me back to class selection -
Nero_3D - 23.08.2013
Use SetSpawnInfo before toggling off spectating
Re: Server sends me back to class selection -
Vanter - 23.08.2013
use
pawn Code:
ForceClassSelection(playerid);
Re: Server sends me back to class selection -
newbienoob - 23.08.2013
@Cypress: Did that. No luck. Also, there's nothing in my OnPlayerSpawn except SetPlayerSkin.
@Nero_3D: You mean, SetSpawnInfo(..) and then TogglePlayerSpectating(0)? If so, will try.
@Vanter: Maybe you should read again