Raised This Month: $32 Target: $400
 8% 

[HELP] Writing a module hooking CBasePlayer::SetAnimation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wiwi249
Member
Join Date: Oct 2013
Old 04-11-2015 , 14:02   [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #1

Hello.
After a lot of trying with orpheu in this topic: https://forums.alliedmods.net/showthread.php?p=2282651 I've decided to write a new module to hook the CBasePlayer::SetAnimation, because it's the last thing I can do in that case. The problem is, that I've never written a module. I've got basic knowledge in C++ though. So:
1. Is there any tutorial or something written to help me learn module coding? I've been trying to search the forum but I didn't find it. Or maybe is there some basic code I can use to learn on (I don't need much, that will do).
2. How to hook the CBasePlayer::SetAnimation event in my module? In amxx it was (almost) all about byte signature in orpheu. How to make it with a module only?
3. How to make an AMXX Forward based on the functions I want to hook? If I "hook" this function, I think that I should make a hookable forward with AMXX and then supercede it (that's what I need to do, unfortunately). If you have any other ideas, can you tell me?

Thanks in advance and sorry for a problem. I just need to hook this function finally.
wiwi249 is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 04-11-2015 , 14:37   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #2

Are you sure you need it?

https://forums.alliedmods.net/showpo...87&postcount=2
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
wiwi249
Member
Join Date: Oct 2013
Old 04-11-2015 , 17:25   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #3

Yes, I'm pretty sure.
Check the link I've provided in the first post. HLDS has been updated and It's much harder to hook it now.
wiwi249 is offline
wiwi249
Member
Join Date: Oct 2013
Old 04-12-2015 , 06:15   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #4

Alright, an update.
I've managed to open the example module (dod_mm) and find a tutorial.
It seems to make sense ;)
Now how to hook the SetAnimation functions?

Last edited by wiwi249; 04-12-2015 at 06:20.
wiwi249 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-12-2015 , 06:29   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #5

Maybe look at how orpheu or okapi does that ? It may help, idk.
__________________
HamletEagle is offline
wiwi249
Member
Join Date: Oct 2013
Old 04-12-2015 , 07:22   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #6

I was trying to understand how Arkshine did it in the AdminFreeLook module ( https://github.com/Arkshine/AdminFre.../master/module ), but I don't understand shit. I think I have to wait until he explains something.
By the way, Orpheu is much more complicated, especially that it hooks functions registered in signatures and used in plugins. I just cant get to read that thing in the code and I dont know what is what in the Orpheu source.
wiwi249 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-14-2015 , 06:27   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #7

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.
Attached Files
File Type: zip setanimation-files.zip (62.1 KB, 525 views)
File Type: zip setanimation-source.zip (128.7 KB, 489 views)
__________________

Last edited by Arkshine; 04-14-2015 at 13:23.
Arkshine is offline
wiwi249
Member
Join Date: Oct 2013
Old 04-14-2015 , 13:24   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #8

It's just impossible not to love Arkshine! Thank you master, I'll give it a try tommorow.
For now, do you know what's the animations limit per 1 model? I remember that it was somewhere in SDK but I cant find it now :/
wiwi249 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-14-2015 , 13:27   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #9

Please define "animation limit per 1 model" ; I have no idea what it means.
__________________

Last edited by Arkshine; 04-14-2015 at 13:27.
Arkshine is offline
wiwi249
Member
Join Date: Oct 2013
Old 04-14-2015 , 13:47   Re: [HELP] Writing a module hooking CBasePlayer::SetAnimation
Reply With Quote #10

I mean how many animations can one mdl file contain. (Player models have something like 117 animations if I remember well).
wiwi249 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode