Server: Unknown Commands "/"
#1

Hello,
I have i little question.

I use this for OnPlayerCommandText:
Code:

public OnPlayerCommandText(playerid, cmdtext[])
{
//lots of commands
return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Unknown command.);
}

So when i use a command that doesn't exists like /aaaa it sais:
Error: Unknown command

BUT when i just enter '/' it sais the default:
SERVER: Unknown command.

I've tested this on other server with custom unknown command messages, and it also happens there.
Reply
#2

public OnPlayerCommandText(playerid, cmdtext[])
{

if (strcmp("/putyourtexthere", cmdtext, true, 5) == 0)
{

SendClientMessage(playerid, 0x24FF0AB9, "Put your text here");
return 1;
}

This is an example
Reply
#3

BEER-samp, he wants to change the SERVER: Unknown command.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/test", true, 5) == 0)
     {
         SendClientMessage(playerid, COLOR_YELLOW, "Text here!");
         return 1;
     }
     return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This command doesn't exist. Please use /commands");
}
Reply
#4

oh sorry my mistake
Reply
#5

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '/') return SendClientMessage(playerid,-1,"Error: Unknown command.");
    return 1;
}
Reply
#6

Every command starts with /, so that code you just posted is wrong.

Not 100% sure but try this:

if(cmdtext[1] == '\0') return SendClientMessage(...);
Reply
#7

Yes i have [pawon]Return SendClientMessage(playerid,COLOR_YELLOW2, "Error: Unknown command.");[/pawon] but he doesn't work. streamer or sscanf is?
Reply
#8

Please help me
Reply
#9

At the top of your OnPlayerCommandText, put this:

pawn Код:
if(IsNull(cmdtext)) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Unknown command.);
and after your includes put this:

pawn Код:
#define IsNull(%1) \
    ((!(%1[0]))||(((%1[0]) == '\1') && (!(%1[1]))))
Reply
#10

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
At the top of your OnPlayerCommandText, put this:

pawn Код:
if(IsNull(cmdtext)) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Unknown command.);
and after your includes put this:

pawn Код:
#define IsNull(%1) \
    ((!(%1[0]))||(((%1[0]) == '\1') && (!(%1[1]))))
I put this
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)