Raised This Month: $ Target: $400
 0% 

Ham_Item_Holster : Bad arg count.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2009 , 04:24   Ham_Item_Holster : Bad arg count.
Reply With Quote #1

[HAMSANDWICH] Bad arg count. Expected 3, got 2.

That's the runtime error i got (WIN32, listenserver).

My code :
Code:
ExecuteHam(Ham_Item_Holster, pActiveItem)
HLSDK code :
Code:
m_pActiveItem->Holster( );
ham_const description :
Code:
	/**
	 * Description:		Whether or not the entity (usually weapon) can be holstered.
	 * Forward params:	function(this)
	 * Return type:		Integer (boolean).
	 * Execute params:	ExecuteHam(Ham_Item_Holster, this);
	 */
	Ham_Item_Holster,
hamdata.ini is default one, last amxx release.

Any idea ? hamdata.ini would be false for win32 ? listenserver related ?


If someone wnat to try out the code :
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Strip"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

//#define WEAPON_ALLWEAPONS        (~(1<<WEAPON_SUIT))

const MAX_ITEM_TYPES 6
const MAX_AMMO_SLOTS 14 // real is 32 but cs uses only 14

const m_rgpPlayerItems_Slot0 367
const m_pActiveItem 373
const m_pLastItem 375
const m_rgAmmo_Slot0 376

const EXTRAOFFSET_WEAPONS 4
const m_pNext 42

new gmsgCurWeapon

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
gmsgCurWeapon get_user_msgid("CurWeapon")

    
register_clcmd("drop""drop")
}

public 
dropid )
{
    
RemoveAllItems(id)
    return 
PLUGIN_HANDLED
}

RemoveAllItems(id/*, bool: removeSuit*/)
{
    new 
pActiveItem get_pdata_cbase(idm_pActiveItem)
    if(
pActiveItem 0)
    {
        
ExecuteHam(Ham_Item_HolsterpActiveItem)
        
set_pdata_cbase(idm_pActiveItem, -1)
    }

    
set_pdata_cbase(idm_pLastItem, -1)
    
//set_pdata_int(id, m_pLastItem, 0) ?

    
new rgpPlayerItemspPendingItem;
    for(
rgpPlayerItems m_rgpPlayerItems_Slot0rgpPlayerItems m_rgpPlayerItems_Slot0 MAX_ITEM_TYPESrgpPlayerItems++)
    {
        
pActiveItem get_pdata_cbase(idrgpPlayerItems)
        while(
pActiveItem)
        {
            
pPendingItem get_pdata_cbase(pActiveItemm_pNextEXTRAOFFSET_WEAPONS)
            
ExecuteHam(Ham_Item_DroppActiveItem)
            
pActiveItem pPendingItem
        
}
        
set_pdata_cbase(idrgpPlayerItems, -1)
    }
    
//m_pActiveItem = NULL;

    
set_pev(idpev_viewmodel0)
    
set_pev(idpev_weaponmodel0)
    
/*    if ( removeSuit )
    {
*/    
set_pev(idpev_weapons0)
/*    }
    else
    {
        set_pev(id, pev_weapons, pev(id, pev_weapons) & ~WEAPON_ALLWEAPONS)
    }
*/
    
for(new m_rgAmmo m_rgAmmo_Slot0m_rgAmmo m_rgAmmo_Slot0 MAX_AMMO_SLOTSm_rgAmmo++)
    {
        
set_pdata_int(idm_rgAmmo0)
    }

//    ExecuteHamB(Ham_Player_UpdateClientData, id) // crash ?
    
dllfunc(DLLFunc_UpdateClientDataid)

    
message_begin(MSG_ONE_UNRELIABLEgmsgCurWeapon_id)
    
write_byte(0)
    
write_byte(0)
    
write_byte(0)
    
message_end()

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 04-14-2009 , 04:37   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #2

I suggest creating a forward with that, if you get that error... Try to see what the third argument is ... (in case of the forward the second one ...)
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2009 , 04:45   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #3

Can't believe what i see !!

PHP Code:
    RegisterHam(Ham_Item_Holster"weapon_knife""Knife_Holster")
    
RegisterHam(Ham_Item_Holster"weapon_glock18""Glock_Holster")
    
RegisterHam(Ham_Item_Holster"weapon_ak47""Ak47_Holster")

    
register_clcmd("drop""drop")
}

public 
dropid )
{
    
RemoveAllItems(id)
    return 
PLUGIN_HANDLED
}

public 
Knife_Holster(iEntwhatisthis)
{
    
client_print(0print_chat"Knife %d %d"iEntwhatisthis)
}

public 
Glock_Holster(iEntFloat:whatisthis)
{
    
client_print(0print_chat"Glock %d %f"iEntwhatisthis)
}

public 
Ak47_Holster(iEntwhatisthis[]) // o_O
{
    
client_print(0print_chat"Ak47 %d %s"iEntwhatisthis)

Code:
Knife 108 0
Glock 109 0.000000
Ak47 110 HamFilter
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 04-14-2009 , 04:47   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #4

I'm sure that makes sense :-S
purple_pixie is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2009 , 04:50   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #5

May be it makes sense for sawce.

So :

ExecuteHam(Ham_Item_Holster, pActiveItem, 0) works.
ExecuteHam(Ham_Item_Holster, pActiveItem, "HamFilter") also works.

Found only this :
Code:
// This is the callback from the module, this handles any fatal errors.
// This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists.
// Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing.
// Any other return value will fail the plugin.
// You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin.
// Do not modify this!
public __fatal_ham_error(Ham:id, HamError:err, const reason[])
{
	
	new func=get_func_id("HamFilter", -1);
	new bool:fail=true;
	
	if (func != -1 && callfunc_begin_i(func, -1)==1)
	{
		callfunc_push_int(_:id);
		callfunc_push_int(_:err);
		callfunc_push_str(reason, false);
		if (callfunc_end()==PLUGIN_HANDLED)
		{
			fail=false;
		}
	}
	if (fail)
	{
		set_fail_state(reason);
	}
	
}
Waiting for sawce explainations.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-14-2009 at 04:53.
ConnorMcLeod is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 04-14-2009 , 04:49   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #6

LOL o.O
Edit: Try adding that string to HamExecute ).
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 04-14-2009 , 04:51   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #7

I'm also interested in seeing why did the developers put that...
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-14-2009 , 05:10   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #8

the third arg seems to be skiplocal. HLSDK says skiplocal is 1 if client is predicting weapon animations.

ExecuteHam(Ham_Item_Holster, pActiveItem, 0) or ExecuteHam(Ham_Item_Holster, pActiveItem, 1)


I guess "HamFilter" appears because the arg type is not valid.

Using ExecuteHam(Ham_Item_Holster, pActiveItem, "HamFilter") will not work and you will get "[HAMSANDWICH] Entity out of range (-1)"

Last edited by Arkshine; 04-14-2009 at 05:23.
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2009 , 05:15   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #9

Quote:
Originally Posted by arkshine View Post
the third arg seems to be skiplocal.
Thanks, but how have you found that ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 04-14-2009 , 05:23   Re: Ham_Item_Holster : Bad arg count.
Reply With Quote #10

I think by seems he meant that he is not sure ...
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 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 02:27.


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