AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   return in plugin_init (https://forums.alliedmods.net/showthread.php?t=76206)

anakin_cstrike 08-20-2008 11:42

return in plugin_init
 
Hi...i saw in many plugins this:
PHP Code:

public plugin_init()
{
       
// what ever
       
return PLUGIN_CONTINUE;


When i should use a return value in plugin_init ?

Orangutanz 08-20-2008 11:56

Re: return in plugin_init
 
There is no need to use a return PLUGIN_X inside of plugin_init, unless you don't want your plugin to work or in a restricted mode. In which case you can just use return inside of your statement. This way you don't need to add an extra return at the end of plugin_init.

Example:
Code:
public plugin_init() {     register_plugin( PLUGIN, VERSION, AUTHOR )         if ( !cstrike_running() )     {         log_message( "%s - error: failed to load plugin ( Counter-Strike Only! )", PLUGIN )         return     }     // REST OF YOUR CODE/FUNCTIONALITY HERE }

anakin_cstrike 08-20-2008 12:30

Re: return in plugin_init
 
I was shur you will say that...for example:
PHP Code:

public plugin_init() {  
   
register_plugin("Bullet Damage","1.0","f117bomb")  
   
register_event("Damage""damage_msg""b""2!0""3=0""4!0")
   
register_cvar("bullet_damage","0"
   return 
PLUGIN_CONTINUE  


?

Orangutanz 08-20-2008 12:31

Re: return in plugin_init
 
Quote:

Originally Posted by anakin_cstrike (Post 672679)
I was shur you will say that...for example:
PHP Code:

public plugin_init() {  
   
register_plugin("Bullet Damage","1.0","f117bomb")  
   
register_event("Damage""damage_msg""b""2!0""3=0""4!0")
   
register_cvar("bullet_damage","0"
   return 
PLUGIN_CONTINUE  // THIS ISN'T NEEDED


?


anakin_cstrike 08-20-2008 12:50

Re: return in plugin_init
 
Ok....but why is there ?:) or, it has no effect ?

ConnorMcLeod 08-20-2008 12:52

Re: return in plugin_init
 
It's completly useless.

anakin_cstrike 08-20-2008 13:01

Re: return in plugin_init
 
Ok.

Brad 08-20-2008 20:21

Re: return in plugin_init
 
Quote:

Originally Posted by connorr (Post 672690)
It's completly useless.

Not completely. It *could* help improve one's typing skills.

Greenberet 08-23-2008 06:42

Re: return in plugin_init
 
well now it is useless
but i remember a bug in amxx 0.16 ( i think it was this version )
where you could use "return PLUGIN_HANDLED" and plugin_init will not be executed on all the other plugins that are loaded after yours^^


All times are GMT -4. The time now is 08:25.

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