Jump to content

Care este diferenta?


Mister

Recommended Posts

Stiu ca sunt functii simple pe care le folosim mereu dar care este diferenta ditre cele doua functii de mai jos?

CallLocalFunction

CallRemoteFunction

Si mai important de ce se folosesc aceste funtii cand putem folosi direct asa functia?

callMe(2,4);

 

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

http://wiki.sa-mp.com/wiki/CallRemoteFunction

http://wiki.sa-mp.com/wiki/CallLocalFunction

 

CallRemoteFunction - ”Calls a public function in any script that is loaded.” - asta cheama o functie din orice script care e incarcat;

CallLocalFunction - "Calls a public function from the script in which it is used." - asta cheama doar din script-ul folosit.

De acel callMe nu stiu nimic.

 

 

Link to comment
Share on other sites

Apelarea directa o poti folosi cand stii daca functia respectiva exista si stii numele functiei la momentul compilarii. Este cea mai rapida metoda.

CallLocalFunction() o folosesti cand nu stii numele functiei la momentul compilarii; se apeleaza doar functia din modul curent (gm/fs). Este o metoda mai lenta pentru ca la fiecare folosire a CallLocalFunction, server-ul cauta in memorie zona alocata functiei pentru a o "chema".

Un exemplu al folosirii CallLocalFunction() este zcmd.

CallRemoteFunction() o folosesti cand nu stii numele functiei la momentul compilarii SI/SAU functia se afla in alt mod (gm/fs); se apeleaza toate functiile cu acest nume. Este lenta din acelasi motiv.

* Functiile "chemate" prin CallRemoteFunction() si CallLocalFunction() trebuie sa fie "forward-ate".

Edited by Spman
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.