Raised This Month: $51 Target: $400
 12% 

What are stocks exactly?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoldNux
Senior Member
Join Date: Mar 2018
Old 05-28-2018 , 22:06   What are stocks exactly?
Reply With Quote #1

What is the difference between a STOCK and a regular function?
Is it only that it is not compiled if it is not used?

Thank you.
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731
GoldNux is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-28-2018 , 23:34   Re: What are stocks exactly?
Reply With Quote #2

Quote:
Originally Posted by GoldNux View Post
Is it only that it is not compiled if it is not used?
yes
__________________
ddhoward is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-29-2018 , 07:57   Re: What are stocks exactly?
Reply With Quote #3

Yup and many on these forums refer to a function as a stock..when you hear 'stock', 9/10 times it means function. They should only be used in include files.
__________________
Bugsy is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-29-2018 , 08:27   Re: What are stocks exactly?
Reply With Quote #4

Quote:
Originally Posted by GoldNux View Post
What is the difference between a STOCK and a regular function?
Is it only that it is not compiled if it is not used?

Thank you.
Yes, and if you code incorrectly and not use it, compiler will not give any error from that function.
Also stocks are welcome where you will use in multiple plugins the same function, like access from amxmisc or others
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-29-2018 , 10:51   Re: What are stocks exactly?
Reply With Quote #5

Generally stocks are added in includes, since codders doesn't use all that exists into them. So when he compile, do not get errors like "Function is not be used". So, consider when you want a custom function, add as an private functions instead of stock in plugin
__________________








CrazY. 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 15:18.


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