Onconsoletext always returns unknown command ...
#1

How can i remove the 'unknown command' in the console when i use a console command?
The command is working, it returns 1 in tye script but it still says 'unknown command'
Reply
#2

Most likely it is because something in within your command is returning 0.

Post your code.
Reply
#3

Код:
new UsePlayerid = -1;

public OnRconCommand(cmd[])
{
	new cmdtext[256], tmp[256], idx;
	new String[128];
	cmdtext = strtok(cmd, idx);

	if(!strcmp(cmdtext,"chat",true))
	{
		tmp = bigstrtok(cmd, idx);
		if(strlen(tmp))
		{
			if(UsePlayerid != -1 && IsPlayerConnected(UsePlayerid))
			{
				new name[MAX_PLAYER_NAME];
				new textstring[128];
				format(textstring, sizeof(textstring), "[%i] %s", UsePlayerid, tmp);
				GetPlayerName(UsePlayerid, name, sizeof name);
				SendPlayerMessageToAll(UsePlayerid, textstring);
				printf("[chat] [%s]: %s", name, tmp);
			}
			else
			{
				format(String, sizeof String, "RconPlayer: [-1] %s", tmp);
				SendClientMessageToAll(0xFFFFFFAA, String);
				printf("[chat] [RconPlayer]: %s", tmp);
			}
		}
		return 1;
	}

	if(!strcmp(cmdtext,"useplayer",true))
	{
		tmp = strtok(cmd, idx);
		if(strlen(tmp))
		{
			UsePlayerid = strval(tmp);
			if(IsPlayerConnected(UsePlayerid) || UsePlayerid == -1)
			{
				if(UsePlayerid == -1)
				{
					print("You are now using RconPlayer (ID -1) to chat with.");
				}
				else
				{
					new name[MAX_PLAYER_NAME];
					GetPlayerName(UsePlayerid, name, sizeof name);
					printf("You are now using %s (ID %i) to chat with.", name, UsePlayerid);
				}
			}
			else
			{
				printf("ID %i is not a valid playerid.", UsePlayerid);
			}
		}
		return 1;
	}
	return 1;
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

stock bigstrtok(const string[], &idx)
{
  new length = strlen(string);
	while ((idx < length) && (string[idx] <= ' '))
	{
		idx++;
	}
	new offset = idx;
	new result[128];
	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	{
		result[idx - offset] = string[idx];
		idx++;
	}
	result[idx - offset] = EOS;
	return result;
}
Reply
#4

DCMD :P

I couldn't even get my RCON to print(cmd), let alone test your commands.
Maybe it's a Vista thing?

I dunno what to say.

Is it saying Unknown command inside the console, or to the player you are using chat/useplayer on?
Reply
#5

he prolly meant the player in-game chat window which he calls console
Reply
#6

Quote:
Originally Posted by Izanagi
he prolly meant the player in-game chat window which he calls console
do I look so stupid that I don't know what console is?

Quote:
Originally Posted by ledzep
DCMD :P

I couldn't even get my RCON to print(cmd), let alone test your commands.
Maybe it's a Vista thing?

I dunno what to say.

Is it saying Unknown command inside the console, or to the player you are using chat/useplayer on?
it used to work before but now I used this fs again on my new server and it doesn't work anymore
it prints unknown command in the console
Reply
#7

everything looks ok, and if you rly get
Quote:

Unknown command or variable:
command

I only can think of another filterscript which returns 0
Reply
#8

Quote:
Originally Posted by ♣ ⓐⓢⓢ
everything looks ok, and if you rly get
Quote:

Unknown command or variable:
command

I only can think of another filterscript which returns 0
there is one other filterscript but everything is ok there to.
if I typt the command of that filterscript in the console, I also get 'unknown command' but the command is fully executed
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)