SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 16/10/2019, 08:49 PM   #91
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,730
Reputation: 1686
Default Re: Stop the abuse of stock!

Bumping this because this should always be up.
__________________
When the opportunity presents itself to flip-a da table, uh, you flip-a da table.

Discord: Kwarde#8009
Kwarde is offline   Reply With Quote
Old 04/05/2020, 02:57 AM   #92
[FMJ]PowerSurge
Big Clucker
 
Join Date: May 2012
Location: Nottingham, England
Posts: 125
Reputation: 19
Default Re: Stop the abuse of stock!

So what's your reasoning for this?

Yeah, it's not required, but it suppresses errors and is not added to the compiled code if it's never called.

If I'm writing a large script with many functions, and I add to the bottom,
PHP Code:
stock CheckPlayerStats(iPlayerID) {
    
// do something

I can leave it there without using the function yet and it won't be compiled into the amx, but it's already written for when I do come to use it.

If I remove the 'stock' as you suggest, then I'll get an "unused" warning until I do use it, and it gets compiled into the amx regardless of whether I reference the function or not, thus potentially wasting space.

A 'stock' function does not have the potential to waste space the way a plain function does.
[FMJ]PowerSurge 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 08:41 PM.


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