From 4fc6d311c7aff9cdd018062d23b8d0dc40b5676c Mon Sep 17 00:00:00 2001 From: MrOkiDoki <0mrokidoki@gmail.com> Date: Fri, 18 Aug 2023 01:56:36 +0300 Subject: [PATCH] New changes, don't use yet --- BattleBitAPI/Server/GameServer.cs | 4 ++-- BattleBitAPI/Server/ServerListener.cs | 18 ++++++++++++++---- Program.cs | 8 +++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/BattleBitAPI/Server/GameServer.cs b/BattleBitAPI/Server/GameServer.cs index 904d689..34cda73 100644 --- a/BattleBitAPI/Server/GameServer.cs +++ b/BattleBitAPI/Server/GameServer.cs @@ -324,7 +324,7 @@ namespace BattleBitAPI.Server { } - public virtual async Task OnPlayerSpawning(TPlayer player, OnPlayerSpawnArguments request) + public virtual async Task OnPlayerSpawning(TPlayer player, OnPlayerSpawnArguments request) { return request; } @@ -542,7 +542,7 @@ namespace BattleBitAPI.Server SpawnPosition = position, LookDirection = lookDirection, SpawnStand = stand, - SpawnProtection = spawnProtection + SpawnProtection = spawnProtection, }; //Respond back. diff --git a/BattleBitAPI/Server/ServerListener.cs b/BattleBitAPI/Server/ServerListener.cs index 2c1773b..1790e4a 100644 --- a/BattleBitAPI/Server/ServerListener.cs +++ b/BattleBitAPI/Server/ServerListener.cs @@ -976,7 +976,7 @@ namespace BattleBitAPI.Server { ulong steamID = stream.ReadUInt64(); - var request = new OnPlayerSpawnArguments(); + OnPlayerSpawnArguments request = new OnPlayerSpawnArguments(); request.Read(stream); ushort vehicleID = stream.ReadUInt16(); @@ -984,15 +984,25 @@ namespace BattleBitAPI.Server { async Task mHandle() { - request = await server.OnPlayerSpawning((TPlayer)client, request); + var responseSpawn = await server.OnPlayerSpawning((TPlayer)client, request); //Respond back. using (var response = Common.Serialization.Stream.Get()) { response.Write((byte)NetworkCommuncation.SpawnPlayer); response.Write(steamID); - request.Write(response); - response.Write(vehicleID); + + if (responseSpawn != null) + { + response.Write(true); + request.Write(response); + response.Write(vehicleID); + } + else + { + response.Write(false); + } + server.WriteToSocket(response); } } diff --git a/Program.cs b/Program.cs index bb6f8b5..d4aec4f 100644 --- a/Program.cs +++ b/Program.cs @@ -56,9 +56,15 @@ class MyGameServer : GameServer } public override async Task OnTick() { + foreach (var item in AllPlayers) + { + item.GameServer.ForceStartGame(); + } } - public override async Task OnPlayerSpawning(MyPlayer player, OnPlayerSpawnArguments request) + public override async Task OnPlayerSpawning(MyPlayer player, OnPlayerSpawnArguments request) { + return null; + request.Wearings.Eye = "Eye_Zombie_01"; request.Wearings.Face = "Face_Zombie_01"; request.Wearings.Face = "Hair_Zombie_01";