AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   unregister_forward (https://forums.alliedmods.net/showthread.php?t=161992)

Ex3cuTioN 07-13-2011 16:26

unregister_forward
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN ""
#define VERSION ""
#define AUTHOR ""

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /allow""cmd1");
    
register_clcmd("say /notallow""cmd1");
}

public 
cmd1()
    
register_forward(FM_ClientUserInfoChanged"fwClientUserInfoChanged");
    
public 
cmd2()
    
unregister_forward(FM_ClientUserInfoChanged,register_forward(FM_ClientUserInfoChanged"fwClientUserInfoChanged")); 

This is not working...I mean, the unregister part.

fysiks 07-13-2011 16:48

Re: unregister_forward
 
You have to get the forward pointer when you register the forward then use that to unregister it. Otherwise, it's trying to unregister a different forward.

You should learn to look in the include files for some extra information:

PHP Code:

/* Registers a forward.
 * Returns an id you can pass to unregister_forward
 */
native register_forward(_forwardType,const _function[],_post=0);

/* Unregisters a forward.
 * The registerId must be from register_forward, and
 * post/forwardtype must match what you registered the forward as.
 */
native unregister_forward(_forwardTyperegisterIdpost=0); 



All times are GMT -4. The time now is 00:53.

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