12.03.2014, 20:53
I've been wondering this for a while, what exactly is the use of forwarding something in a script? Thanks to anyone who explains it!
//somewhere in the code;
function(a,b);
//function is defined after the call
stock function()
{
// do something;
}
So you can't call a function if you didn't define it previously only if you use forward
forward function(x,y);
//somewhere in the code;
function(x,y);
//function is defined after the call
stock function(a,b)
{
// do something;
}
|
forward announce the compiler that you defined a function somewhere down in the code:
for example THIS IS WRONG!!! Код:
//somewhere in the code;
function(a,b);
//function is defined after the call
stock function()
{
// do something;
}
So you can't call a function if you didn't define it previously only if you use forward
Код:
forward function(x,y);
//somewhere in the code;
function(x,y);
//function is defined after the call
stock function(a,b)
{
// do something;
}
|
forward SendClientMessageToAllAdmins(msg[]);
public SendClientMessageToAllAdmins(msg[])
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
SendClientMessage(i,COLOR_YELLOW,msg);
}
}
}