SA-MP Forums Archive
Stock & Public - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Stock & Public (/showthread.php?tid=156001)



Stock & Public - Antonio [G-RP] - 20.06.2010

Whats the difference between using 'stock' and using 'public' infront of a function ?


Re: Stock & Public - Kyosaur - 20.06.2010

Stock doesnt give warnings when the function isnt used. If you compile your script, and it doesnt use the function, it simply wont be included.


Re: Stock & Public - MadeMan - 20.06.2010

https://sampwiki.blast.hk/wiki/Keywords:Initialisers



Re: Stock & Public - Antonio [G-RP] - 20.06.2010

Quote:
Originally Posted by Kyosaur!!
Stock doesnt give warnings when the function isnt used. If you compile your script, and it doesnt use the function, it simply wont be included.
Thats the only thing?


Re: Stock & Public - Kyosaur - 20.06.2010

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Quote:
Originally Posted by Kyosaur!!
Stock doesnt give warnings when the function isnt used. If you compile your script, and it doesnt use the function, it simply wont be included.
Thats the only thing?
Well for the most part, yes. If i remember correctly, when a public variable/function is compiled, the actual name is stored instead of just the address. Thats why functions like SetTimer,SetTimerEx,CallRemoteFunction, and CallLocalFunction only work on publics. It wouldnt make much sense if you tried calling a stock with one of them, as only the address is stored.


Re: Stock & Public - Niixie - 20.06.2010

if you want to return other things than numbers, e.g. name. then you use stock

e.g.

Код:
stock playername(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
return pname;
}
u c?


Re: Stock & Public - Hiddos - 20.06.2010

Quote:
Originally Posted by [MWR
Niixie ]
if you want to return other things than numbers, e.g. name. then you use stock

e.g.

Код:
stock playername(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
return pname;
}
u c?
Wuddafuk? A RETURN IS A RETURN. Why would it be able to return a string at stock() and not at a public call?