Skip to content

Commit

Permalink
CBaseEntity player teleport adjustment update (#661)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Wilson <[email protected]>
  • Loading branch information
schwarper and roflmuffin authored Nov 23, 2024
1 parent 8a063f4 commit c6d3988
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions managed/CounterStrikeSharp.API/Core/Model/CBaseEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ public void Teleport(Vector? position = null, QAngle? angles = null, Vector? vel
nint _position = position?.Handle ?? 0;
nint _angles = angles?.Handle ?? 0;
nint _velocity = velocity?.Handle ?? 0;

VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(Handle, GameData.GetOffset("CBaseEntity_Teleport"))(Handle, _position, _angles, _velocity);
nint _handle = Handle;

if (this is CCSPlayerController player && player.PlayerPawn.Value is CCSPlayerPawn playerPawn)
{
_handle = playerPawn.Handle;
}

VirtualFunction.CreateVoid<IntPtr, IntPtr, IntPtr, IntPtr>(_handle, GameData.GetOffset("CBaseEntity_Teleport"))(_handle, _position, _angles, _velocity);
}

/// <exception cref="InvalidOperationException">Entity is not valid</exception>
Expand Down

0 comments on commit c6d3988

Please sign in to comment.