From 42d8f5fd948011f15205fd1b8d0f14a09b7ccd31 Mon Sep 17 00:00:00 2001 From: MrOkiDoki <0mrokidoki@gmail.com> Date: Tue, 29 Aug 2023 17:57:38 +0300 Subject: [PATCH] Teleport, Kickreason fixed. --- BattleBitAPI/Common/Conts.cs | 2 +- BattleBitAPI/Server/GameServer.cs | 8 ++++++++ BattleBitAPI/Server/Player.cs | 2 +- BattleBitAPI/Server/ServerListener.cs | 12 ++++++++---- CommunityServerAPI.csproj | 2 +- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/BattleBitAPI/Common/Conts.cs b/BattleBitAPI/Common/Conts.cs index cdd1f55..72efa1c 100644 --- a/BattleBitAPI/Common/Conts.cs +++ b/BattleBitAPI/Common/Conts.cs @@ -2,7 +2,7 @@ { public static class Const { - public static string Version = "1.0.4v"; + public static string Version = "1.0.5v"; // ---- Networking ---- /// diff --git a/BattleBitAPI/Server/GameServer.cs b/BattleBitAPI/Server/GameServer.cs index 0963f71..f3cc261 100644 --- a/BattleBitAPI/Server/GameServer.cs +++ b/BattleBitAPI/Server/GameServer.cs @@ -675,6 +675,14 @@ namespace BattleBitAPI.Server { PromoteSquadLeader(player.SteamID); } + public void Teleport(ulong steamID, Vector3 position) + { + ExecuteCommand("teleport " + steamID + " " + position.X+","+ position.Y+","+ position.Z); + } + public void Teleport(Player player, Vector3 position) + { + Teleport(player.SteamID, position); + } public void WarnPlayer(ulong steamID, string msg) { ExecuteCommand("warn " + steamID + " " + msg); diff --git a/BattleBitAPI/Server/Player.cs b/BattleBitAPI/Server/Player.cs index 650d0b6..65417c8 100644 --- a/BattleBitAPI/Server/Player.cs +++ b/BattleBitAPI/Server/Player.cs @@ -249,7 +249,7 @@ namespace BattleBitAPI } public void Teleport(Vector3 target) { - + GameServer.Teleport(this, target); } public void SpawnPlayer(PlayerLoadout loadout, PlayerWearings wearings, Vector3 position, Vector3 lookDirection, PlayerStand stand, float spawnProtection) { diff --git a/BattleBitAPI/Server/ServerListener.cs b/BattleBitAPI/Server/ServerListener.cs index 8a68220..2530598 100644 --- a/BattleBitAPI/Server/ServerListener.cs +++ b/BattleBitAPI/Server/ServerListener.cs @@ -1444,12 +1444,16 @@ namespace BattleBitAPI.Server } case NetworkCommuncation.GameTick: { - if (stream.CanRead(4 + 4 + 4)) + if (stream.CanRead(12 + 12 + 1)) { float decompressX = stream.ReadFloat(); float decompressY = stream.ReadFloat(); float decompressZ = stream.ReadFloat(); + float offsetX = stream.ReadFloat(); + float offsetY = stream.ReadFloat(); + float offsetZ = stream.ReadFloat(); + int playerCount = stream.ReadInt8(); while (playerCount > 0) { @@ -1491,9 +1495,9 @@ namespace BattleBitAPI.Server @internal.Position = new Vector3() { - X = com_posX * decompressX, - Y = com_posY * decompressY, - Z = com_posZ * decompressZ, + X = (com_posX * decompressX) - offsetX, + Y = (com_posY * decompressY) - offsetY, + Z = (com_posZ * decompressZ) - offsetZ, }; @internal.HP = newHP; @internal.Standing = standing; diff --git a/CommunityServerAPI.csproj b/CommunityServerAPI.csproj index 6470c51..23e1f89 100644 --- a/CommunityServerAPI.csproj +++ b/CommunityServerAPI.csproj @@ -18,7 +18,7 @@ https://github.com/MrOkiDoki/BattleBit-Community-Server-API https://github.com/MrOkiDoki/BattleBit-Community-Server-API BattleBit - 1.0.4.1 + 1.0.4.2