Skip to content

Commit

Permalink
fix: offsets for CBaseEntity derived classes
Browse files Browse the repository at this point in the history
Also adds test commands to test plugin for future validation
  • Loading branch information
roflmuffin committed Dec 14, 2023
1 parent 44e3f22 commit 74fd0e0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
12 changes: 6 additions & 6 deletions configs/addons/counterstrikesharp/gamedata/gamedata.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
},
"CCSPlayerController_Respawn": {
"offsets": {
"windows": 241,
"linux": 243
"windows": 242,
"linux": 244
}
},
"CCSPlayerPawn_Respawn": {
Expand Down Expand Up @@ -122,14 +122,14 @@
},
"CBasePlayerPawn_CommitSuicide": {
"offsets": {
"windows": 356,
"linux": 356
"windows": 357,
"linux": 357
}
},
"CBaseEntity_Teleport": {
"offsets": {
"windows": 148,
"linux": 147
"windows": 149,
"linux": 148
}
},
"CBaseEntity_TakeDamageOld": {
Expand Down
27 changes: 27 additions & 0 deletions managed/TestPlugin/TestPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,33 @@ public void OnKillme(CCSPlayerController? player, CommandInfo command)

player.PlayerPawn.Value.CommitSuicide(true, true);
}

[ConsoleCommand("css_stripweapons", "Removes player weapons")]
public void OnStripWeapons(CCSPlayerController? player, CommandInfo command)
{
if (player == null) return;
if (!player.PlayerPawn.IsValid) return;

player.RemoveWeapons();
}

[ConsoleCommand("css_teleportup", "Teleports the player up")]
public void OnTeleport(CCSPlayerController? player, CommandInfo command)
{
if (player == null) return;
if (!player.PlayerPawn.IsValid) return;

player.PlayerPawn.Value.Teleport(player.PlayerPawn.Value.AbsOrigin.With(z: player.PlayerPawn.Value.AbsOrigin.Z + 100), player.PlayerPawn.Value.AbsRotation, new Vector(IntPtr.Zero));
}

[ConsoleCommand("css_respawn", "Respawns the player")]
public void OnRespawn(CCSPlayerController? player, CommandInfo command)
{
if (player == null) return;
if (!player.PlayerPawn.IsValid) return;

player.Respawn();
}

[ConsoleCommand("cssharp_attribute", "This is a custom attribute event")]
public void OnCommand(CCSPlayerController? player, CommandInfo command)
Expand Down

0 comments on commit 74fd0e0

Please sign in to comment.