Raised This Month: $ Target: $400
 0% 

Function Headers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-15-2012 , 12:19   Function Headers
Reply With Quote #1

can anyone explain to me the different function header definitions in a simple way that an idiot such as myself can understand?
i.e. public, stock, none, etc

and how can i make a function private (so only this plugin can use it) and how can i make a function so another plugin on the server can use it?
Liverwiz is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-15-2012 , 15:16   Re: Function Headers
Reply With Quote #2

If a function is anything except public, then it is only accessible in the plugin that includes it.

If a function is public, it can be accessed using callfuncs and forwards through other plugins.

Alternatively, you can declare a stock function in an include file, then include the .inc file in multiple plugins.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-15-2012 , 17:43   Re: Function Headers
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
If a function is public, it can be accessed using callfuncs and forwards through other plugins.

Last edited by hleV; 05-15-2012 at 17:43.
hleV is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-15-2012 , 15:27   Re: Function Headers
Reply With Quote #4

So if i wanted to grab functions from another plugin (powers defined in a seperate amxx from the main class) i'd write them all public and call them regularly?

i.e.
Code:
Class: powers
public pwr_money(id){ cs_set_user_money(id, moneySet()) }
Then call it from......
Code:
Class: base
public plugin_init(){ pwr_money(15) } 
public moneySet(){ return get_pcvar_num(money_cvar) }
or should i make that stock and include powers?
This is kind of what i'm trying to accomplish, i'm just trying to figure out the best way to have two plugins communicate.

Last edited by Liverwiz; 05-15-2012 at 15:32.
Liverwiz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-16-2012 , 03:20   Re: Function Headers
Reply With Quote #5

Quote:
Originally Posted by Liverwiz View Post
So if i wanted to grab functions from another plugin (powers defined in a seperate amxx from the main class) i'd write them all public and call them regularly?

i.e.
Code:
Class: powers
public pwr_money(id){ cs_set_user_money(id, moneySet()) }
Then call it from......
Code:
Class: base
public plugin_init(){ pwr_money(15) } 
public moneySet(){ return get_pcvar_num(money_cvar) }
or should i make that stock and include powers?
This is kind of what i'm trying to accomplish, i'm just trying to figure out the best way to have two plugins communicate.
I would use dynamic natives. See the tutorial.
__________________
fysiks 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 00:19.


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