Raised This Month: $ Target: $400
 0% 

Ham_Item_Deploy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-18-2009 , 14:06   Ham_Item_Deploy
Reply With Quote #1

shouldnt this work or did i leave something out by mistake? iam testing on DoD, but it doesnt work. the classnames is registered right, i dont get any errors.. is it an offset or something i missed?

Code:
 
new const Knife_Names[][] = { "weapon_amerknife", "weapon_spade", "weapon_gerknife" }
 
public plugin_init() 
{
for (new i = 0; i < sizeof Knife_Names; i++)
 RegisterHam(Ham_Item_Deploy, Knife_Names[i], "current_wpn", 1) 
}
 
public current_wpn(id)
{ 
client_print(id,3, "knife is forward")
}
- cheers!
__________________
Dr.G is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-18-2009 , 14:08   Re: Ham_Item_Deploy
Reply With Quote #2

You have missed the fact that the forward won't pass any player id, but weapon id.
Either you find the weapon offset m_pPlayer (could be the same as for cs1.6), either you retrieve the id using pev_owner.


Try using

RegisterHam(Ham_Item_Deploy, Knife_Names[i], "Knife_Deploy", 1)

PHP Code:
public Knife_DeployiEnt )
{
    new 
id pev(iEntpev_owner)
    for( new 
i=1i<=100i++)
    {
        if( 
get_pdata_cbase_safe(iEnti) )
        {
            
client_print(idprint_chat"Weapon Offset m_pPlayer could be %d"i)
        }
    }


Try this on windows, when you have found the offset, you can use this to retrieve player id :


Code:
#define m_pPlayer ??? // value you have found


public Knife_Deploy( iEnt )
{
    new id = get_pdata_cbase(iEnt, m_pPlayer, 4) // you will have to check that diff between win32 and linux is 4 for weapons entities
On cs1.6, value is 41, could be the same on dod.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-18-2009 at 14:15.
ConnorMcLeod is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-18-2009 , 14:14   Re: Ham_Item_Deploy
Reply With Quote #3

lmao ok..
__________________
Dr.G is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-18-2009 , 14:23   Re: Ham_Item_Deploy
Reply With Quote #4

If you only want to detect knife, register CurWeapon with right args in the registering line should be enough.

If it's the same as in cs1.6, there's no other CurWeapon messages sent than the deployed one.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-18-2009 , 14:43   Re: Ham_Item_Deploy
Reply With Quote #5

thanks ill test it later, and post the result.. thanks!

edit

btw what i wanted was to leave out the CurWeapon thing, i use that now..
__________________

Last edited by Dr.G; 03-18-2009 at 14:48.
Dr.G 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 08:58.


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