原作者:oylsister (Oylsister)
public override void Load(bool hotReload)
{
MemoryFunctionWithReturn<CPlayer_WeaponServices, CBasePlayerWeapon, int, bool> CPlayer_WeaponServices_SwitchWeapon = new("55 48 89 E5 41 57 41 56 41 89 D6 41 55 41 54 49 89 F4");
CPlayer_WeaponServices_SwitchWeapon.Hook((hook) =>
{
var client = hook.GetParam<CPlayer_WeaponServices>(0);
var weapon = hook.GetParam<CBasePlayerWeapon>(1);
Server.PrintToChatAll($"{client.Pawn.Value.Controller.Value?.PlayerName} try switch to {weapon.DesignerName}.");
if (blocked)
{
Server.PrintToChatAll($"{client.Pawn.Value.Controller.Value?.PlayerName} got blocked switch");
hook.SetReturn(false);
return HookResult.Handled;
}
return HookResult.Continue;
}, HookMode.Pre);
}
针对此signature的寻找过程视频:Youtube Sigscan Weapon_Swtich for CS2