SA-MP Forums Archive
TogglePlayerSpectating, spawning then closing server connection. [REP++] - 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: TogglePlayerSpectating, spawning then closing server connection. [REP++] (/showthread.php?tid=436599)



TogglePlayerSpectating, spawning then closing server connection. [REP++] - Hoborific - 12.05.2013

So yeah, I TogglePlayerSpectating() when OnPlayerRequestClass is called, and I call it again to toggle it off after a dialog, it spawns them fine but the server closes connection instantly, ideas?


Re: TogglePlayerSpectating, spawning then closing server connection. [REP++] - jakejohnsonusa - 12.05.2013

If the server closes connection, it's probably kicking them. Look for that code.


Re: TogglePlayerSpectating, spawning then closing server connection. [REP++] - Hoborific - 12.05.2013

No instances found. I just checked for that, it has something to do with TogglePlayerSpectating, I had a similar problem a while ago with SetSpawnInfo();

These are all the relevant things.

pawn Код:
public OnGameModeInit()
{

    AddPlayerClass(-snip-);

}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    TogglePlayerSpectating(playerid,1);
....
    if(!fexist(File) )
    {
        ShowPlayerDialog(
        }
}
pawn Код:
 
pawn Код:
public OnPlayerSpawn(playerid)
{
    IsPlayerSpawned[playerid] = 1;
    HUDCreate(playerid);
    SpawnShit(playerid);
    return 1;
}
pawn Код:
if(dialogid == Register_Dialog)
    {
    if(response)
        {
        TogglePlayerSpectating(playerid,0);
        //SpawnPlayer(playerid);
        clearchat(playerid);

Now if I uncomment SpawnPlayer, they're not kicked but they spawn twice, doubling everything they get from SpawnShit(playerid);


Re: TogglePlayerSpectating, spawning then closing server connection. [REP++] - Hoborific - 13.05.2013

bamp


Re : TogglePlayerSpectating, spawning then closing server connection. [REP++] - DaTa[X] - 13.05.2013

pawn Код:
SetSpawnInfo(playerid,1,90,0,0,0,0,0,0,0,0,0,0);
otherwise the server will kick ya