AlliedModders

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

silentt 08-20-2008 00:35

returns
 
can someone help me out by explaining to me how and when to use the two main returns return PLUGIN_HANDLED and return PLUGIN_CONTINUE.

"http://wiki.amxmodx.org/Intro_to_AMX_Mod_X_Scripting" this doesnt help too much I need a better explanation please a really dumafied one please if possible.

grimvh2 08-20-2008 05:05

Re: returns
 
Well my english aint that good to explain ,

but for example you regsiter a clcmd like "/start"

if you say /start and in your public function at the end you use return PLUGIN_CONTINUE the plugin ignores evrything and evryone can see you typing /start , when using return PLUGIN_HANDLED the message will be blocked because the plugin stopped it . I hope you understand it a bit more cause my explantions arent evrything

hleV 08-20-2008 06:53

Re: returns
 
PLUGIN_HANDLED makes a function stop after doing something. Like:
PHP Code:

public plugin_init()
        
register_clcmd("amx_test""cmdTest"ADMIN_RCON"- test")
 
public 
cmdTest(idlevel)
{
        if (!(
get_user_flags(id) & level))
        {
                
console_print(id"You have no access to that command")
 
                
// Stops everything below because player doesn't have the right flag
                
return PLUGIN_HANDLED
        
}
 
        
client_print(0print_chat"Admin have used amx_test command")
 
        
// Now stop the "No such command" message in the console
        
return PLUGIN_HANDLED



anakin_cstrike 08-20-2008 11:33

Re: returns
 
If you want to block the chat (no chat) use handled, like hleV said below, if not, use continue.

ConnorMcLeod 08-20-2008 12:03

Re: returns
 
And if you want the chat message (not only chat messages but it's more understandable with this example) not to be printed but be detected by other plugins, use HANDLED_MAIN instead of HANDLED.

jim_yang 08-21-2008 07:45

Re: returns
 
http://metamod.org/coding.html#MRES_IGNORED


All times are GMT -4. The time now is 03:06.

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