This small code makes the client instanly close connection? - 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: This small code makes the client instanly close connection? (
/showthread.php?tid=636822)
This small code makes the client instanly close connection? -
Meller - 04.07.2017
This video shows the issue: --
This little code is making the client close the connection?
PHP Code:
case DIALOG_PLAY: {
if(response) {
switch(listitem) {
case 0: { // Competitive
Player[playerid][pStatus] = STATUS_COMP;
Player[playerid][pDead] = true;
for(new id = 0; id < 19; id++)
PlayerTextDrawDestroy(playerid, HomeMenuTextdraws[playerid][id]);
for(new id = 0; id < 10; id++)
PlayerTextDrawDestroy(playerid, MenuTextdraws[playerid][id]);
CancelSelectTextDraw(playerid);
Player[playerid][pTeam] = GetCompTeam();
if(IsCompWarmup()) {
SendClientMessage(playerid, 0xD7D7D7FF, "WARMUP: The competitive requires atleast 2 players, so far there'll be a warmup.");
Player[playerid][pDead] = false;
TogglePlayerSpectating(playerid, false);
SendClientMessage(playerid, 0xD7D7D7FF, "MAP: The current map is de_dust2 made by JamesT85.");
TogglePlayerControllable(playerid, false);
if(Player[playerid][pTeam] == TEAM_CT)
SetPlayerPos(playerid, -717.606933, 2577.695800, 241.739685);
SetTimerEx("UnfreezePlayer", 2000, false, "i", playerid);
}
}
case 1: { // Shooting Range
}
case 2: { // Missions
}
case 3: { // Dueling
}
}
}
else
SelectTextDraw(playerid, -673720321);
}
Re: This small code makes the client instanly close connection? -
Meller - 04.07.2017
After some debugment, this is the line that shuts the clients connection.
TogglePlayerSpectating(playerid, false);
Re: This small code makes the client instanly close connection? -
Meller - 04.07.2017
Fixed by forcing the player to spawn before letting him load in.