Where is CallLocalFunction(); used for?
#5

Quote:
Originally Posted by °ғαιιοцт°
Why should I use CallLocalFunction if I can also just use the function's name to call it?

example:
Код:
forward examplefunction(playerid, Float:angle);

public examplefunction(playerid, Float:angle)
{
  SetPlayerFacingAngle(playerid, angle);
  return 1;
}

/* somewhere else in the script: */

CallLocalFunction("examplefunction", "if", playerid, "90.0");
/* but I could also use this: */
examplefunction(playerid, "90.0");
There are two functions called CallRemoteFunction and CallLocalFunction. CallLocalFunction is useful if you have a callback system where you do not want to put references to all the callbacks in the code, helping to save memory.

What CallRemoteFunction does, is call public callbacks from every single loaded AMX. Imagine it as the reason why OnPlayerDeath works. Sometimes it's better to use it instead of calling it directly because it helps make libraries more flexable, etc.
Reply


Messages In This Thread
Where is CallLocalFunction(); used for? - by ғαιιοцт - 11.07.2009, 07:53
Re: Where is CallLocalFunction(); used for? - by luby - 11.07.2009, 08:01
Re: Where is CallLocalFunction(); used for? - by ғαιιοцт - 11.07.2009, 09:21
Re: Where is CallLocalFunction(); used for? - by Finn - 11.07.2009, 09:24
Re: Where is CallLocalFunction(); used for? - by Westie - 11.07.2009, 10:40
Re: Where is CallLocalFunction(); used for? - by ғαιιοцт - 11.07.2009, 10:52
Re: Where is CallLocalFunction(); used for? - by Westie - 11.07.2009, 11:35
Re: Where is CallLocalFunction(); used for? - by MenaceX^ - 11.07.2009, 13:16
Re: Where is CallLocalFunction(); used for? - by lavamike - 11.07.2009, 13:22

Forum Jump:


Users browsing this thread: 2 Guest(s)