foward public | stock
#1

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?
Reply
#2

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
Reply
#3

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..
Reply
#4

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);
}
Reply
#5

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. - ******
Reply
#6

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.
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=529820
Reply
#8

sorry for bad spelling. It's stock.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)