Raised This Month: $2 Target: $400
 0% 

return in plugin_init


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-20-2008 , 11:42   return in plugin_init
Reply With Quote #1

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 ?
__________________

anakin_cstrike is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 08-20-2008 , 11:56   Re: return in plugin_init
Reply With Quote #2

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 }

Last edited by Orangutanz; 08-20-2008 at 11:59.
Orangutanz is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-20-2008 , 12:30   Re: return in plugin_init
Reply With Quote #3

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  

?
__________________

anakin_cstrike is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 08-20-2008 , 12:31   Re: return in plugin_init
Reply With Quote #4

Quote:
Originally Posted by anakin_cstrike View Post
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

?
Orangutanz is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-20-2008 , 12:50   Re: return in plugin_init
Reply With Quote #5

Ok....but why is there ? or, it has no effect ?
__________________

anakin_cstrike is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-20-2008 , 12:52   Re: return in plugin_init
Reply With Quote #6

It's completly useless.
__________________
- tired and retired -
ConnorMcLeod is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-20-2008 , 13:01   Re: return in plugin_init
Reply With Quote #7

Ok.
__________________

anakin_cstrike is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 08-20-2008 , 20:21   Re: return in plugin_init
Reply With Quote #8

Quote:
Originally Posted by connorr View Post
It's completly useless.
Not completely. It *could* help improve one's typing skills.
__________________
Brad is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 08-23-2008 , 06:42   Re: return in plugin_init
Reply With Quote #9

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^^
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Reply


Thread Tools
Display Modes

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 08:40.


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