Stock VS Public
#1

Hello SA-MP Community.I am posting this thread because I got a really big question mark in my mind.Can anyone explain the difference between Stock and Forward&Public?Thank you so much
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=341545
Reply
#3

Nice tutorial, Imma read it now.
Reply
#4

That doesn't explain every detail.

Public functions' names are 'remembered', so they can be called via name (CallLocalFunction, CallRemoteFunction, SetTimer(Ex) etc.).

The 'stock' keyword makes it so the code/variable that follows will not be compiled if it is not used. This in turn will prevent 'unused symbol' warnings. You shouldn't use the stock keyword on functions that will definately be used, for example if you make a GivePlayerScore function, just define it as a normal function:

pawn Код:
GivePlayerScore(playerid, score)
{
    // blah
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)