ZCMD and STRCMP problem - 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 and STRCMP problem (
/showthread.php?tid=259464)
ZCMD and STRCMP problem -
rinori - 04.06.2011
Well, I am trying to convert my gamemode commands to ZCMD, (its a gf edit) but when I make a command with zcmd, and when I made a cmd like "/id" (COMMAND:ID etc etc), I cannot use other commands in strcmp
all it says "SERVER UNKNOWN COMMAND"
help please
Re: ZCMD and STRCMP problem -
Burridge - 04.06.2011
ZCMD, and strcmp commands cannot be used together AFAIK. All commands have to be ZCMD or strcmp, you can't mix the two.
Re: ZCMD and STRCMP problem -
rinori - 04.06.2011
What about dcmd? yes?
Re: ZCMD and STRCMP problem -
Markx - 04.06.2011
dcmd can be, because zcmd disables the OnPlayerCommandText callback.
Re: ZCMD and STRCMP problem -
Gamer_Z - 04.06.2011
Quote:
Originally Posted by Markx
dcmd can be, because zcmd disables the OnPlayerCommandText callback.
|
oh really?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//strcmp
if(!strcmp(cmdtext,"/MyCommand",true))
{
SendClientMessage(playerid,0,"It works and this text is black!");
return 1;
}
//zcmd
if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
{
return 1;
}
new
pos,
funcname[MAX_FUNC_NAME];
while (cmdtext[++pos] > ' ')
{
funcname[pos-1] = tolower(cmdtext[pos]);
}
format(funcname, sizeof(funcname), "cmd_%s", funcname);
while (cmdtext[pos] == ' ') pos++;
if (!cmdtext[pos])
{
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, "\1"));
}
return CallLocalFunction(funcname, "is", playerid, "\1");
}
if (zcmd_g_HasOPCE)
{
return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, cmdtext[pos]));
}
return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
}
just put the strcmp command(s) BEFORE zcmd.
Anyway I do not recomend using 2 command processors at one time.