AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HAMSANDWICH] Invalid HamHook handle. (https://forums.alliedmods.net/showthread.php?t=236855)

proffs 03-12-2014 09:21

[HAMSANDWICH] Invalid HamHook handle.
 
I am getting this error from server logs:

Code:

L 03/12/2014 - 12:35:42: [HAMSANDWICH] Invalid HamHook handle.
L 03/12/2014 - 12:35:42: [AMXX] Displaying debug trace (plugin "now.amxx")
L 03/12/2014 - 12:35:42: [AMXX] Run time error 10: native error (native "DisableHamForward")
L 03/12/2014 - 12:35:42: [AMXX]    [0] now.sma::StopGame (line 2256)
L 03/12/2014 - 12:35:42: [AMXX]    [1] now.sma::LogEvent_RoundEnd (line 889)

PHP Code:

register_logevent"LogEvent_RoundEnd",     2"1=Round_End"     );
    
RegisterHamHam_Killed"player""Fwd_PlayerKilled"); 

PHP Code:

if(runningStatus)
            {
                
runningStatus 0
                
                unregister_forward
(FM_SetModelintSetModel)
                
unregister_forward(FM_CmdStartintCmdStart)
                
unregister_forward(FM_UpdateClientDataintCliendData)
                
unregister_forward(FM_TouchintTouch)
                
DisableHamForward(Forward_Killed);
                
DisableHamForward(Forward_TakeDamage);
                
unregister_forward(FM_TouchForward_Touch2);
                
unregister_forward(FM_PlayerPreThinkForward_PlayerPreThink);
                
unregister_forward(FM_AddToFullPackForward_Toggle0);
                
                for (new 
1<= g_pbcounta++)
                {
                    if (
g_pbstatus[a] != 0)
                    {
                        
paint_reset(g_paintballs[a]+1000);
                    }
                }
            } 

PHP Code:

public LogEvent_RoundEnd()
{    
    
StopGame();
    
    new 
players[32], num;
    
get_playersplayersnum"a" );
    
    for( new 
0numi++ )
    
show_menu00"^n");
    


What Am I doing wrong?

Arkshine 03-12-2014 09:25

Re: [HAMSANDWICH] Invalid HamHook handle.
 
I don't see Forward_Killed/Forward_TakeDamage set.

proffs 03-12-2014 10:17

Re: [HAMSANDWICH] Invalid HamHook handle.
 
PHP Code:

new     Forward_Touch2,
    
HamHook:Forward_Killed,
    
HamHook:Forward_TakeDamage,
    
Forward_PlayerPreThink,
    
Forward_Toggle 

PHP Code:

EnableHamForward(Forward_Killed)
EnableHamForward(Forward_TakeDamage


Arkshine 03-12-2014 10:22

Re: [HAMSANDWICH] Invalid HamHook handle.
 
Forward_Killed/Forward_TakeDamage are not set. You create the variables, but default value is 0, empty so. You are supposed to filled these variables with RegisterHam return value, otherwise how you can expect the module to know?

proffs 03-12-2014 11:32

Re: [HAMSANDWICH] Invalid HamHook handle.
 
Quote:

Originally Posted by Arkshine (Post 2110863)
Forward_Killed/Forward_TakeDamage are not set. You create the variables, but default value is 0, empty so. You are supposed to filled these variables with RegisterHam return value, otherwise how you can expect the module to know?

So I need to return it?
I dont get a shit, sorry.
Can you move this to request section and help me with it?
Thanks

Arkshine 03-12-2014 11:41

Re: [HAMSANDWICH] Invalid HamHook handle.
 
Forward_Killed = RegisterHam( Ham_Killed, "player", "Fwd_PlayerKilled", 1 );

Forward_Killed will contain an handle which can be used with EnableHamForward().

What you were doing was creating empty variable, so basically doing EnableHamForward(0) ; do you think module will be able to know what forward you're talking about?

proffs 03-12-2014 12:01

Re: [HAMSANDWICH] Invalid HamHook handle.
 
Quote:

Originally Posted by Arkshine (Post 2110887)
Forward_Killed = RegisterHam( Ham_Killed, "player", "Fwd_PlayerKilled", 1 );

Forward_Killed will contain an handle which can be used with EnableHamForward().

What you were doing was creating empty variable, so basically doing EnableHamForward(0) ; do you think module will be able to know what forward you're talking about?

So I should remove the all of the variables
and have
PHP Code:

Forward_Killed RegisterHamHam_Killed"player""Fwd_PlayerKilled"); 

in plugin unit? So the module knows what Forward I am trying to enable?

ConnorMcLeod 03-12-2014 15:48

Re: [HAMSANDWICH] Invalid HamHook handle.
 
If there is a public function Fwd_PlayerKilled in code and if you want to use it as a callback of function CBasePlayer::Killed, you need to set it using RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled", 0 or 1)

Once this is done, consider EnableHamForward and DisableHamForward as additional features.


All times are GMT -4. The time now is 10:21.

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