PDA

View Full Version : TogglePlayerSpectating, spawning then closing server connection. [REP++]


Hoborific
12/05/2013, 01:53 AM
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?

jakejohnsonusa
12/05/2013, 02:09 AM
If the server closes connection, it's probably kicking them. Look for that code.

Hoborific
12/05/2013, 02:23 AM
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.


public OnGameModeInit()
{

AddPlayerClass(-snip-);

}




public OnPlayerRequestClass(playerid, classid)
{
TogglePlayerSpectating(playerid,1);
....
if(!fexist(File) )
{
ShowPlayerDialog(
}
}







public OnPlayerSpawn(playerid)
{
IsPlayerSpawned[playerid] = 1;
HUDCreate(playerid);
SpawnShit(playerid);
return 1;
}



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);

Hoborific
13/05/2013, 12:13 AM
bamp

DaTa[X]
13/05/2013, 12:27 AM
SetSpawnInfo(playerid,1,90,0,0,0,0,0,0,0,0,0,0);
otherwise the server will kick ya :)