SA-MP Forums Archive
zcmd - Confused?? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: zcmd - Confused?? (/showthread.php?tid=177564)



zcmd - Confused?? - pagie1111 - 18.09.2010

Well, I was reading on the include for zcmd 0.3.1 and noticed an odd function.

pawn Код:
public OnGameModeInit()
{
        zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
        zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
        if (funcidx("zcmd_OnGameModeInit") != -1)
        {
                return CallLocalFunction("zcmd_OnGameModeInit", "");
       }      
        return 1;
}
What is this function funcidx and what does it do? I have searched the wiki also.


Re: zcmd - Confused?? - pagie1111 - 18.09.2010

Ok, I found that this belongs to core.inc


But still do not know what its used for.


Re: zcmd - Confused?? - LarzI - 18.09.2010

funcidx is probably "Function Index", but still, I don't know what it does either.


Re: zcmd - Confused?? - Sergei - 18.09.2010

funcidx returns ID of the specific public function. If it's not (-1) that function exists. Funcidx is fast, so zcmd firstly checks if public function actually exists before calling it with CallLocalFunction.


Re: zcmd - Confused?? - Zh3r0 - 18.09.2010

Quote:
Originally Posted by Sergei
Посмотреть сообщение
funcidx returns ID of the specific public function. If it's not (-1) that function exists. Funcidx is fast, so zcmd firstly checks if public function actually exists before calling it with CallLocalFunction.
So if we don't have OnGameModeInit or OnPlayerCommand for example, it will not load or something?