Server: Unknown Commands "/" -
otiy - 29.04.2012
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.
Re: Server: Unknown Commands "/" -
mickos - 29.04.2012
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/putyourtexthere", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, 0x24FF0AB9, "Put your text here");
return 1;
}
This is an example
Re: Server: Unknown Commands "/" -
sniperwars - 29.04.2012
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");
}
Re: Server: Unknown Commands "/" -
mickos - 29.04.2012
oh sorry my mistake
Re: Server: Unknown Commands "/" -
Littlehelper - 29.04.2012
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '/') return SendClientMessage(playerid,-1,"Error: Unknown command.");
return 1;
}
Re: Server: Unknown Commands "/" -
MP2 - 29.04.2012
Every command starts with /, so that code you just posted is wrong.
Not 100% sure but try this:
if(cmdtext[1] == '\0') return SendClientMessage(...);
Re: Server: Unknown Commands "/" -
otiy - 29.04.2012
Yes i have [pawon]Return SendClientMessage(playerid,COLOR_YELLOW2, "Error: Unknown command.");[/pawon] but he doesn't work. streamer or sscanf is?
Re: Server: Unknown Commands "/" -
otiy - 29.04.2012
Please help me
Re: Server: Unknown Commands "/" -
SuperViper - 30.04.2012
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]))))
Re: Server: Unknown Commands "/" -
otiy - 30.04.2012
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