diff --git a/managed/CounterStrikeSharp.API/Core/Model/CBaseEntity.cs b/managed/CounterStrikeSharp.API/Core/Model/CBaseEntity.cs index d42d09874..a759e2bda 100644 --- a/managed/CounterStrikeSharp.API/Core/Model/CBaseEntity.cs +++ b/managed/CounterStrikeSharp.API/Core/Model/CBaseEntity.cs @@ -12,21 +12,17 @@ public partial class CBaseEntity public void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null) { Guard.IsValidEntity(this); - + if (position == null && angles == null && velocity == null) throw new ArgumentNullException("No valid argument"); - + nint _position = position?.Handle ?? 0; nint _angles = angles?.Handle ?? 0; nint _velocity = velocity?.Handle ?? 0; nint _handle = Handle; - if (this is CCSPlayerController player && player.PlayerPawn.Value is CCSPlayerPawn playerPawn) - { - _handle = playerPawn.Handle; - } - - VirtualFunction.CreateVoid(_handle, GameData.GetOffset("CBaseEntity_Teleport"))(_handle, _position, _angles, _velocity); + VirtualFunction.CreateVoid(_handle, GameData.GetOffset("CBaseEntity_Teleport"))(_handle, _position, + _angles, _velocity); } /// Entity is not valid diff --git a/managed/CounterStrikeSharp.API/Core/Model/CCSPlayerController.cs b/managed/CounterStrikeSharp.API/Core/Model/CCSPlayerController.cs index 76700911a..989c5bb44 100644 --- a/managed/CounterStrikeSharp.API/Core/Model/CCSPlayerController.cs +++ b/managed/CounterStrikeSharp.API/Core/Model/CCSPlayerController.cs @@ -340,4 +340,11 @@ public VoiceFlags VoiceFlags NativeAPI.SetClientVoiceFlags(Handle, (Byte)value); } } + + [Obsolete( + "You are trying to call Teleport on a non-physical player. Maybe you mean Pawn? (See: https://docs.cssharp.dev/docs/guides/referencing-players.html#controllers--pawns)")] + public new void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null) + { + base.Teleport(position, angles, velocity); + } }