Raised This Month: $51 Target: $400
 12% 

[TF2] Hooking use_action_slot_item?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pawn 3-pg
Senior Member
Join Date: Jul 2009
Old 05-29-2011 , 19:07   [TF2] Hooking use_action_slot_item?
Reply With Quote #1

I'm trying to trigger something when a player uses the new taunt that is triggered with the action button. The console command is use_action_slot_item, but neither AddCommandListener nor RegConsoleCmd recognize when it is pressed.

Any ideas?
Pawn 3-pg is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-29-2011 , 19:26   Re: [TF2] Hooking use_action_slot_item?
Reply With Quote #2

Looks like that exists as a command on the client which does some checking and then sends use_action_slot_item_server as a command.

Code:
__text:0055D5E3 ; use_action_slot_item(CCommand  const&)
__text:0055D5E3 __ZL20use_action_slot_itemRK8CCommand proc near ; DATA XREF: sub_728F5+92o
__text:0055D5E3                 push    ebp
__text:0055D5E4                 mov     ebp, esp
__text:0055D5E6                 push    edi
__text:0055D5E7                 push    esi
__text:0055D5E8                 push    ebx
__text:0055D5E9                 sub     esp, 1Ch
__text:0055D5EC                 call    ___i686_get_pc_thunk_bx
__text:0055D5F1                 mov     edi, ds:(_engine_ptr - 55D5F1h)[ebx]
__text:0055D5F7                 mov     eax, [edi]
__text:0055D5F9                 mov     edx, [eax]
__text:0055D5FB                 mov     [esp], eax
__text:0055D5FE                 call    dword ptr [edx+68h]
__text:0055D601                 test    al, al
__text:0055D603                 jnz     short loc_55D60D
__text:0055D605
__text:0055D605 loc_55D605:                             ; CODE XREF: use_action_slot_item(CCommand  const&)+31j
__text:0055D605                                         ; use_action_slot_item(CCommand  const&)+99j
__text:0055D605                 add     esp, 1Ch
__text:0055D608                 pop     ebx
__text:0055D609                 pop     esi
__text:0055D60A                 pop     edi
__text:0055D60B                 pop     ebp
__text:0055D60C                 retn
__text:0055D60D ; ---------------------------------------------------------------------------
__text:0055D60D
__text:0055D60D loc_55D60D:                             ; CODE XREF: use_action_slot_item(CCommand  const&)+20j
__text:0055D60D                 call    __ZN10C_TFPlayer16GetLocalTFPlayerEv ; C_TFPlayer::GetLocalTFPlayer(void)
__text:0055D612                 test    eax, eax
__text:0055D614                 jz      short loc_55D605
__text:0055D616                 mov     dword ptr [esp+4], 9
__text:0055D61E                 mov     [esp], eax
__text:0055D621                 call    __ZN20CTFPlayerSharedUtils28GetEconItemViewByLoadoutSlotEP10C_TFPlayeri ; CTFPlayerSharedUtils::GetEconItemViewByLoadoutSlot(C_TFPlayer *,int)
__text:0055D626                 mov     esi, eax
__text:0055D628                 test    eax, eax
__text:0055D62A                 jz      short loc_55D641
__text:0055D62C                 mov     [esp], eax
__text:0055D62F                 call    __ZN14C_EconItemView13GetStaticDataEv ; C_EconItemView::GetStaticData(void)
__text:0055D634                 test    eax, eax
__text:0055D636                 jz      short loc_55D641
__text:0055D638                 test    byte ptr [eax+0A4h], 40h
__text:0055D63F                 jnz     short loc_55D660
__text:0055D641
__text:0055D641 loc_55D641:                             ; CODE XREF: use_action_slot_item(CCommand  const&)+47j
__text:0055D641                                         ; use_action_slot_item(CCommand  const&)+53j ...
__text:0055D641                 mov     eax, [edi]
__text:0055D643                 mov     ecx, [eax]
__text:0055D645                 lea     edx, (aUse_action_s_0 - 55D5F1h)[ebx] ; "use_action_slot_item_server\n"
__text:0055D64B                 mov     [esp+4], edx
__text:0055D64F                 mov     [esp], eax
__text:0055D652                 call    dword ptr [ecx+1A8h]
__text:0055D658                 add     esp, 1Ch
__text:0055D65B                 pop     ebx
__text:0055D65C                 pop     esi
__text:0055D65D                 pop     edi
__text:0055D65E                 pop     ebp
__text:0055D65F                 retn
__text:0055D660 ; ---------------------------------------------------------------------------
__text:0055D660
__text:0055D660 loc_55D660:                             ; CODE XREF: use_action_slot_item(CCommand  const&)+5Cj
__text:0055D660                 mov     [esp], esi
__text:0055D663                 call    __ZN14C_EconItemView15GetItemQuantityEv ; C_EconItemView::GetItemQuantity(void)
__text:0055D668                 test    eax, eax
__text:0055D66A                 jle     short loc_55D641
__text:0055D66C                 mov     dword ptr [esp+4], 0
__text:0055D674                 mov     [esp], esi
__text:0055D677                 call    __Z17UseConsumableItemP14C_EconItemViewPN4vgui5PanelE ; UseConsumableItem(C_EconItemView *,vgui::Panel *)
__text:0055D67C                 jmp     short loc_55D605
__text:0055D67C __ZL20use_action_slot_itemRK8CCommand endp
psychonic is offline
Pawn 3-pg
Senior Member
Join Date: Jul 2009
Old 05-29-2011 , 21:31   Re: [TF2] Hooking use_action_slot_item?
Reply With Quote #3

Thank you! Using use_action_slot_item_server works perfectly.
Pawn 3-pg 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 15:41.


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