SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 10/06/2016, 06:56 PM   #81
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,827
Reputation: 1401
Default Re: Stop the abuse of stock!

Quote:
Originally Posted by vannesenn View Post
Why then we should use public? I don't understand now anything.
You miss the main point of this thread. stock is not a MUST when writing a function as many people still think. The only thing it does is hiding the warning if the function is not used anywhere in your script.

You shouldn't use public functions without a reason as well. Use public functions only if it is called by a timer, Call Local/Remote Function or a callback specified to some functions from plugins such as mysql_tquery or mysql_pquery.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 11/06/2016, 10:12 AM   #82
Stinged
High-roller
 
Join Date: Feb 2013
Posts: 1,571
Reputation: 187
Default Re: Stop the abuse of stock!

A lot of people think normal functions are actually called stock.
stock is a word you place to hide the 'unused' warning.

It doesn't only work in functions, it also works in arrays and variables.
Code:
new stock Unused_Array[50];
Stinged is offline   Reply With Quote
Old 11/06/2016, 01:59 PM   #83
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,759
Reputation: 754
Default Re: Stop the abuse of stock!

It doesn't just only hide the warning, it also leaves unused functions out of the compiled source as if it didn't exist.

Functions with stock in front of them can/are called stock functions.
SickAttack is offline   Reply With Quote
Old 11/02/2017, 10:36 AM   #84
PeanutButter
Big Clucker
 
PeanutButter's Avatar
 
Join Date: May 2015
Location: Belgium
Posts: 103
Reputation: 41
Default Re: Stop the abuse of stock!

Quote:
Originally Posted by Vince View Post
What is stock?
Baby don't hurt me.
__________________
MY TUTORIALS
MY INCLUDES
PeanutButter is offline   Reply With Quote
Old 11/02/2017, 10:54 AM   #85
HydraHumza
Gangsta
 
HydraHumza's Avatar
 
Join Date: Oct 2014
Posts: 626
Reputation: 130
Default Re: Stop the abuse of stock!

Quote:
Originally Posted by PeanutButter View Post
Baby don't hurt me.
You bump the old topic
__________________
Quote:
Originally Posted by Kalcor View Post
The fact is, I am right. And if you think I'm wrong, you are wrong.
HydraHumza is offline   Reply With Quote
Old 11/02/2017, 11:36 AM   #86
iLearner
Guest
 
Posts: n/a
Default Re: Stop the abuse of stock!

Quote:
Originally Posted by Humza View Post
You bump the old topic
I wouldnt really call it a bump, or any kind of rule break, however for the reason he did it & what he posted, is indeed unappropriated.
  Reply With Quote
Old 22/02/2017, 12:59 PM   #87
ATomas
Huge Clucker
 
Join Date: Jul 2009
Location: Czech Republic
Posts: 278
Reputation: 20
Default Re: Stop the abuse of stock!

From pawn documentation (https://www.compuphase.com/pawn/pawn.htm page 86)
Quote:
Stockfunctions A “stock” function is a function that the PAWN parser must “plug into” the program when it is used, and that it may simply “remove” from the program (without warning) when it is not used.
Use alright stock continues happy
ATomas is offline   Reply With Quote
Old 22/02/2017, 01:13 PM   #88
organe.
Big Clucker
 
organe.'s Avatar
 
Join Date: Apr 2012
Posts: 53
Reputation: 0
Default Re: Stop the abuse of stock!

from stock change to static ?
__________________
My maps:
[ MAP ] New street of Los Santos [ for RP ]
organe. is offline   Reply With Quote
Old 22/02/2017, 09:49 PM   #89
BiosMarcel
Banned
 
Join Date: Jul 2012
Location: Germany
Posts: 1,219
Reputation: 234
Default Re: Stop the abuse of stock!

Quote:
Originally Posted by organe. View Post
from stock change to static ?
that wasn't the threads message ...
BiosMarcel is offline   Reply With Quote
Old 23/02/2017, 05:08 AM   #90
iKarim
Banned
 
Join Date: Oct 2015
Posts: 579
Reputation: 142
Default Re: Stop the abuse of stock!

Quote:
Originally Posted by organe. View Post
from stock change to static ?
You shouldn't use "stock" without a valid reason to do so, instead of writing functions like that:
PHP Code:
stock someFunctionfooFloatbar 
Write like that without the stock keyword:
PHP Code:
someFunctionfooFloatbar 
iKarim is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
G abuse Cerealguy Scripting Help 3 12/01/2015 02:40 PM
Repair Abuse MBilal Scripting Help 12 30/09/2013 03:03 PM
Pickup abuse.. ThePhill97 Scripting Help 1 23/11/2012 06:14 PM
How to make stock stop a script? ddnbb Scripting Help 12 27/08/2012 01:29 PM
[AJUDA] Stock stock GetVehicleModelID(nome[]) Baigou Português/Portuguese 1 08/11/2011 11:21 PM


All times are GMT. The time now is 12:39 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.