stock GenerateRegistration() //states the name of the stock
{
new registration = random(9999); //Generates a number out of 9999
foreach(Player, i) //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
}
GenerateRegistration() //states the name of the stock
{
new registration = random(9999); //Generates a number out of 9999
foreach(Player, i) //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
}
forward GenerateRegistration();
public GenerateRegistration() //states the name of the stock
{
new registration = random(9999); //Generates a number out of 9999
foreach(Player, i) //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
}
"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 Код:
|
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. |