Raised This Month: $ Target: $400
 0% 

returns


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
silentt
Member
Join Date: Feb 2006
Location: Toronto, Ontario, Canada
Old 08-20-2008 , 00:35   returns
Reply With Quote #1

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.
silentt is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 08-20-2008 , 05:05   Re: returns
Reply With Quote #2

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
__________________
I am out of order!
grimvh2 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-20-2008 , 06:53   Re: returns
Reply With Quote #3

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

__________________
hleV is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-20-2008 , 11:33   Re: returns
Reply With Quote #4

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

anakin_cstrike is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-20-2008 , 12:03   Re: returns
Reply With Quote #5

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.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 08-21-2008 , 07:45   Re: returns
Reply With Quote #6

http://metamod.org/coding.html#MRES_IGNORED
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang 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 03:06.


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