27.11.2011, 09:35
(
Последний раз редактировалось wups; 27.11.2011 в 11:17.
)
change
if(!strlen(cMdtMp[1]))
to
if(isnull(cMdtMp[1]))
or even
if(sscanf(cmdtext[1], "sS(' ')", cMdtMp[0], cMdtMp[1]))
THE CORRECT CODE WOULD BE:
Not sure how default string is defined in sscanf.
However, if you don't use optional string in sscanf, then cMdtMp[0] will also be empty if there were no params.
Cheers.
Edit: You should make it NON case sensitive.
if(!strlen(cMdtMp[1]))
to
if(isnull(cMdtMp[1]))
or even
if(sscanf(cmdtext[1], "sS(' ')", cMdtMp[0], cMdtMp[1]))
THE CORRECT CODE WOULD BE:
pawn Код:
#define do_cMd; \
new cMdtMp[2][128], cMd; \
sscanf(cmdtext[1], "sS(' ')", cMdtMp[0], cMdtMp[1]) format(cmdtext, 32, "cMd_%s", cMdtMp[0]);\
if(funcidx(cmdtext) != -1) { if(!cMd) { cMd = 1; CallLocalFunction(cmdtext, "ds", playerid, cMdtMp[1]); } }
However, if you don't use optional string in sscanf, then cMdtMp[0] will also be empty if there were no params.
Cheers.
Edit: You should make it NON case sensitive.