Its better to use stock, forward/public or just the plain?
#1

This

PHP код:
stock GenerateRegistration() //states the name of the stock
{
    new 
registration random(9999); //Generates a number out of 9999
    
foreach(Playeri//Searches every user in the server checking if the vehicle plate is used.
    
{
        if(
PlayerInfo[i][vReg] == registration || registration 1000// Checks if the reg is in use or if its below 1000.
        
{
            
GenerateRegistration(); //Regenerates a reg if the criteria is not met
            
return 1;
        }
     }
     return 
registration//returns the reg if the criteria is met

is the same like this without stock?

PHP код:
GenerateRegistration() //states the name of the stock
{
    new 
registration random(9999); //Generates a number out of 9999
    
foreach(Playeri//Searches every user in the server checking if the vehicle plate is used.
    
{
        if(
PlayerInfo[i][vReg] == registration || registration 1000// Checks if the reg is in use or if its below 1000.
        
{
            
GenerateRegistration(); //Regenerates a reg if the criteria is not met
            
return 1;
        }
     }
     return 
registration//returns the reg if the criteria is met

or..

PHP код:
forward GenerateRegistration();
public 
GenerateRegistration() //states the name of the stock
{
    new 
registration random(9999); //Generates a number out of 9999
    
foreach(Playeri//Searches every user in the server checking if the vehicle plate is used.
    
{
        if(
PlayerInfo[i][vReg] == registration || registration 1000// Checks if the reg is in use or if its below 1000.
        
{
            
GenerateRegistration(); //Regenerates a reg if the criteria is not met
            
return 1;
        }
     }
     return 
registration//returns the reg if the criteria is met

??

Fucking learning process..
Reply
#2

There's no difference ( there's one ) between stock and plain text but there's a difference between stock ( plain text w.e ) and public/forward

>> https://sampforum.blast.hk/showthread.php?tid=335885

Quote:
Originally Posted by ******
Посмотреть сообщение
"public" functions take more memory and are only for special cases - THAT is why people use "stock". Many functions don't ever need to be called via timers so there's no need to make them public.

Also, most functions do not need any prefix at all:

pawn Код:
MyFunc(a)
{
}
"stock" is really only used in libraries designed for other people to possibly use. If you write a function in your mode, you usually write it explicitly for your mode and thus need it.
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
There is a difference between stock and plain - I explained it in that post you quoted!

There is no "best", just different.

Timer - public.
Library - stock.
Mode - plain.
Certain special cases (not just publics) - forward.
What are those special cases?
Reply
#4

Quote:
Originally Posted by DBZdabIt3Bro7
Посмотреть сообщение
What are those special cases?
Tags
Reply
#5

Thanks you a lot, you helping me a lot on my learning process , respect !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)