Is a stock needed?
#1

I made this :

pawn Код:
public OnPlayerSpawn(playerid)                    
{
  GiveStuffs(playerid);
    return 1;
}
pawn Код:
forward GiveStuffs(playerid);
public GiveStuffs(playerid)
{
  // here I will check teams & give positions /weapons....
   return 1;
}
the question is should I use a stock instead of the callback ?
Reply
#2

I generally use stocks for the stuff you are going to use them for.

You should read up on stocks and functions. Learn the difference between them.
Reply
#3

Quote:
Originally Posted by SA-MP Wiki
A function should be public whenever "the server" must be able to call the function at run time.
Always add public to your function when it is called by
  • a timer, (see also SetTimer and SetTimerEx),
  • CallLocalFunction,
  • CallRemoteFunction.
If you do not call it anywhere (by those functions above), then you simply don't need it. You can either use it as:
pawn Код:
GiveStuffs(playerid)
{
  // here I will check teams & give positions /weapons....
   return 1;
}
stock is used in case you do not want to use that function - so it won't give the error about symbol is never used.
Reply
#4

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
I generally use stocks for the stuff you are going to use them for.

You should read up on stocks and functions. Learn the difference between them.
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If you do not call it anywhere (by those functions above), then you simply don't need it. You can either use it as:
pawn Код:
GiveStuffs(playerid)
{
  // here I will check teams & give positions /weapons....
   return 1;
}
stock is used in case you do not want to use that function - so it won't give the error about symbol is never used.
Thanks a lot both Publics are used by timers generally but this will not make a problem if I use them
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)