Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added canUse virtual method #282

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

Dliix66
Copy link
Contributor

@Dliix66 Dliix66 commented Jan 21, 2024

This PR adds the CBaseEntity_TakeDamageOldFunc virtual function with its signature in gamedata.json

Usage:

public void Load(bool hotReload)
{
  VirtualFunctions. CBaseEntity_TakeDamageOldFunc.Hook(OnWeaponCanUsePre, HookMode.Pre);
{


private HookResult OnWeaponCanUse(DynamicHook hook)
{
    var weaponservices = hook.GetParam<CCSPlayer_WeaponServices>(0);
    var clientweapon = hook.GetParam<CBasePlayerWeapon>(1);

    var client = new CCSPlayerController(weaponservices!.Pawn.Value.Controller.Value!.Handle);

    if (clientweapon.DesignerName == "weapon_awp")
    {
        client.PrintToChat("No awp for you :v ");
        hook.SetReturn(false);
        return HookResult.Handled;
    }

    return HookResult.Continue;
}

@roflmuffin roflmuffin merged commit 4f805b1 into roflmuffin:main Jan 22, 2024
4 checks passed
@Dliix66 Dliix66 deleted the feature/canUseMethod branch January 22, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants