12.04.2015, 09:26
(
Last edited by Vince; 07/06/2016 at 12:26 PM.
Reason: Some typos
)
What is stock?
The stock keyword, like const, is a modifier that tells the compiler to hide a variable or a function if it is not used. Contrary to popular believe in the SA-MP community, stock is not a requirement. Functions do not require a special keyword in Pawn. The word "stock" is not interchangeable with the word "function" either.
No, you're writing a function!
When to use stock?
The stock keyword, like const, is a modifier that tells the compiler to hide a variable or a function if it is not used. Contrary to popular believe in the SA-MP community, stock is not a requirement. Functions do not require a special keyword in Pawn. The word "stock" is not interchangeable with the word "function" either.
Quote:
Originally Posted by random scripting help topic
Hi, I'm writing this stock ...
|
When to use stock?
- I am writing a gamemode.
- You don't need the stock keyword!
- I am writing a filterscript.
- You don't need the stock keyword!
- I am writing an include.
- Is the function or variable required to be used in a gamemode or filterscript? If yes, do not use the stock keyword. Do not use any keyword at all.
- Is the function or variable for internal use only? If yes, use static.
- Is the function or variable for internal use only, but is there a chance that it may not be used (conditional compiling)? If yes, use static stock
- If none of the above are met, only then is it appropriate to use stock.