Raised This Month: $62 Target: $400
 15% 

CBasePlayerItem help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 03-21-2018 , 15:26   CBasePlayerItem help
Reply With Quote #1

Working on a Metamod plugin, I am hooking AddPlayerItem in the same way Hamsandwich does.
The function takes three arguments as below

Code:
BOOL __fastcall HookAddPlayerItem(void *pthis, int i, CBasePlayerItem *pItem)
Hooking works fine and I am able to call the original function successfully from within the hook, but I do not know how to retrieve information of pItem (ie Weapon ID, classname, etc).

I have attempted to include HLTypeConversion.h and use cbase_to_int but the returned integer does not make sense, while cbase_to_edict returns the edict pointer but I am unable to retrieve any PvPrivateData, server crashes .

Any help is appreciated.
vitorrossi is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 03-26-2018 , 16:15   Re: CBasePlayerItem help
Reply With Quote #2

pItem it's a class and you should understand it's hierarchy.
Check hlsdk how it work.

Here's how it's related to parent classes.

Quote:
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CAK47
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CAUG
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CAWP
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CC4
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CDEAGLE
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CELITE
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CFamas
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CFiveSeven
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CFlashbang
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CG3SG1
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CGalil
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CGLOCK18
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CHEGrenade
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CKnife
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CM249
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CM3
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CM4A1
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CMAC10
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CMP5N
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CP228
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CP90
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CSCOUT
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CSG550
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CSG552
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CSmokeGrenade
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CTMP
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CUMP45
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CUSP
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CWeaponCycler
CBaseEntity:CBaseDelay:CBaseAnimating:CBasePl ayerItem:CBasePlayerWeapon:CXM1014
This is an old thread that can help you to access different elements by it's offset.

https://forums.alliedmods.net/showthread.php?t=173964
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 03-26-2018 at 16:18.
joropito is offline
Send a message via MSN to joropito
Reply


Thread Tools
Display Modes

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 20:30.


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