PDA

View Full Version : Unknown command [Advanced]


HellviRus
15/05/2014, 07:13 PM
Hello,
I'm receiving an error : Server: Unknown command.
when using this command :
if(strcmp("/me", cmd[0], true, 10) == 0)
{
new string2[1024];
format(string2, sizeof(string2), cmdtext);
strdel(string2, 0, 3);
format(string, sizeof(string), "* %s%s", pName(playerid), string2);
ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
I'm sure this is not a return 1; error because I checked it.
Can you please give me all the possible causes of this message ? because I'm receiving it a lot and it's not about the returns.

PinEvil
15/05/2014, 07:22 PM
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessageToAll(0xFFFF00AA, str);
return 1;
}

SickAttack
15/05/2014, 07:24 PM
Use ZCMD, its fast and easy to use.

Beckett
15/05/2014, 07:56 PM
You are probably using two command processor at once (e.g: ZCMD and strcmp)?

Sasino97
15/05/2014, 08:55 PM
You are probably using two command processor at once (e.g: ZCMD and strcmp)?

The issue is not that, it is exactly what PinEvil said, the same thing I thought when I just read the code.

if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessageToAll(0xFFFF00AA, str);
return 1;
}

HellviRus
16/05/2014, 07:27 AM
Actually guys, the problem is solved when I remove this line : "strdel(string2, 0, 3);"

HellviRus
18/05/2014, 08:10 AM
Anybody ?

Threshold
18/05/2014, 08:19 AM
if(strcmp("/me", cmdtext, true) == 0)
{
new string2[128];
format(string2, sizeof(string2), cmdtext[4]);
format(string, sizeof(string), "* %s %s", pName(playerid), string2);
ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}