View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-25-2018 , 06:02   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #21

Quote:
Originally Posted by Arkshine View Post
Try that.

Unzip setanimation-files in /dlls (1.8.2) or /modules (1.8.3-dev)

In your plugin use the OnSetAnimation forward:

Code:
public OnSetAnimation(player, anim) {     // return PLUGIN_HANDLED to block the call }

EDIT: I guess I could add a native later.
Any chance you could add the ability to call SetAnimation with a native? I tried to add it but I get a crash as soon as it gets called.
PHP Code:
 cell AMX_NATIVE_CALL CallSetAnimation(AMX Handlecell Parameter)
{

    
int id       Parameter[1];
    
int anim   Parameter[2];

    const 
void *pvPlayer reinterpret_cast<const void*>((INDEXENT(id)->pvPrivateData));

    
SetAnimationDetour->DisableDetour();
    
SetAnimationOrig(pvPlayeranim);
    
SetAnimationDetour->EnableDetour();

    return 
1;

Testing on windows.
__________________

Last edited by HamletEagle; 08-25-2018 at 06:05.
HamletEagle is offline