sync player spawning

This commit is contained in:
brausjonas
2022-05-13 12:34:41 +02:00
parent fee664a936
commit 4e625ea185
7 changed files with 242 additions and 119 deletions
+10 -3
View File
@@ -41,7 +41,7 @@ public class Server
//[0] = 2: world size
//[0] = 3: edit block
//[0] = 4: disconnect player
//[0] = 5:
//[0] = 5: create new player in client
//[0] = 6: player ready
//[0] = 7:
@@ -123,8 +123,15 @@ public class Server
{
int id = GetPlayerID(endPoint);
Console.WriteLine(playerNames[id] + " joined" + "\n");
foreach (IPEndPoint e in players)
{
if (id != GetPlayerID(e))
{
Send(new byte[]{5, (byte)GetPlayerID(e)}, endPoint);
Send(new byte[]{5, (byte)GetPlayerID(endPoint)}, e);
}
}
}
}
catch (Exception e)