01.05.2012, 08:06
(
Последний раз редактировалось iggy1; 01.05.2012 в 08:42.
)
Hello i was looking through zcmd and came across this code.
To me that translates to "zcmd_g_HasOPCS" equals "funcidx("OnPlayerCommandReceived")" doesn't equal -1.
I just don't understand what it is for i have noticed it in a few other incs too.
I never do this when hooking callbacks. I do use funcidx to check if a func exists but never with -1 after it (when assigning to a var). I'm thinking maybe i should do it this way since all the experienced/pro coders use it.
Is this really necessary? And why?
I've just been doing this.
Thanks.
pawn Код:
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
I just don't understand what it is for i have noticed it in a few other incs too.
I never do this when hooking callbacks. I do use funcidx to check if a func exists but never with -1 after it (when assigning to a var). I'm thinking maybe i should do it this way since all the experienced/pro coders use it.
Is this really necessary? And why?
I've just been doing this.
pawn Код:
g_HasORIL = funcidx("OnRetrieveIpLocation");