Hi, when I start a game I have a scene loaded up with no players in it, each players screen shows a GUI menu of two buttons
- Start Server
- Refresh Hosts
If I then press button 1 it runs
function startServer(){
Network.InitializeServer(4,25001, !Network.HavePublicAddress);
MasterServer.RegisterHost(gameName, "Lab Multiplayer", "..");
}
then
function OnServerInitialized(){
spawnPlayer();
}
that runs my spawnPlayer() function that spawns my player becoming the server?
I then connect other devices and pressing button 2 they join the game as clients, all is well if any players kill other players up to 3 time as I have them to re spawn 3 times, I re spawn them by deactivating the gameObject for a X amount of time then moving it to a randomly chosen spawn poin reactivating the gameObject.
My problem is when killed the fourth time I use
networkView.RPC ("networkDisconect", RPCMode.Others);
Network.RemoveRPCs(Network.player);
Network.Destroy(player);
@RPC
function networkDisconect(){
Network.Disconnect();
}
and if its a client it works and goes back to see the GUI menu of 2 buttons, but If its player 1(server) everyone goes back the the GUI menu, do I have to start the server first as the level then join all players as clients or do I need to use different code to kill player 1?
Thanks.