foward public | stock -
Banditukas - 04.08.2014
Hi,
Can i use function like use stock, i mean
Код:
CMD:blbla( ... )
{
HELLO( playerid );
}
forward HELLO ( playerid );
public HELLO( playerid )
{
SendClientMessage(playerid,-1,"HELLO");
}
I can do this?
Re: foward public | stock -
Stanford - 04.08.2014
Yes, but for this situations use stocks.
Publics are usually used in general for timers and calling them (remote) you better use stocks in this case.
Hint: return 1; at the end of the cmd
Re: foward public | stock -
Banditukas - 04.08.2014
Hm,
Nice problem if i use stock (now i always use stock) but now in one dialog, my pawn crash, when i turn to public ok..
Re: foward public | stock -
SickAttack - 04.08.2014
Publics and stocks aren't needed most of the time and you can just use a plain function.
pawn Код:
GivePlayerHealth(playerid, Float:amount)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health + amount);
}
Re: foward public | stock -
SanAndreasMP - 04.08.2014
If you're planning on making a library, you should go for stock.
otherwise
"public" saves the name of the function in the amx (normally
functions are just called be address, the human-readable
name is not important). Saving the name means that the
function can be found by name later on. When you specify a
function in "SetTimer", "SetTimerEx", "CallLocalFunction" or
"CallRemoteFunction" you specify it by name so these can
only call public functions. Callbacks such as
"OnPlayerConnect" are also public for the same reason. - ******
Re: foward public | stock -
Dignity - 04.08.2014
Quote:
Originally Posted by SanAndreasMP
strtok.
|
i hope this is a typo for 'stock'
Quote:
Originally Posted by Stanford
Yes, but for this situations use stocks.
Publics are usually used in general for timers and calling them (remote) you better use stocks in this case.
Hint: return 1; at the end of the cmd
|
You don't need to use a stock in this situation at all, only when writing libraries. Also, you only need to return true or false when there is actually a condition to be true/false, not for every function.
Go with what SickAttack said.
Re: foward public | stock -
ViniBorn - 04.08.2014
https://sampforum.blast.hk/showthread.php?tid=529820
Re: foward public | stock -
SanAndreasMP - 04.08.2014
sorry for bad spelling. It's stock.