SA-MP Forums Archive
Server Closed Connection when spawning? - 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 Closed Connection when spawning? (/showthread.php?tid=322979)



Server Closed Connection when spawning? - Azze - 04.03.2012

Hey, I am currently scripting a RP script from scratch. And when i spawn, i get Server Closed connection. There is no errors in the script or the logs. The server dosent close it self, i just get dced from the server.

This is my OnPlayerSpawn code:

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerColor(playerid,COLOR_WHITE);
    new cash = PlayerInfo[playerid][pCash];
    new score = PlayerInfo[playerid][pScore];
    GivePlayerMoney(playerid,cash);
    SetPlayerScore(playerid,score);
    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
    TogglePlayerSpectating(playerid, 0);
    SetPlayerPos(playerid, 1007.0414,-1387.0471,13.3421);
    return 1;
}
OnPlayerRequestClass code:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    TogglePlayerSpectating(playerid, 1);
    return 1;
}
dont know whats wrong.

If you need some other codes, write below.

Thankful for help, cant figure out whats wrong.


Re: Server Closed Connection when spawning? - Jakku - 04.03.2012

There are like hundreds of such topics;

https://sampforum.blast.hk/showthread.php?tid=320794

Just use SetSpawnInfo before using SpawnPlayer and you should be alright