SA-MP Forums Archive
Onconsoletext always returns unknown command ... - 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: Onconsoletext always returns unknown command ... (/showthread.php?tid=85709)



Onconsoletext always returns unknown command ... - ғαιιοцт - 09.07.2009

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'


Re: Onconsoletext always returns unknown command ... - ledzep - 09.07.2009

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

Post your code.


Re: Onconsoletext always returns unknown command ... - ғαιιοцт - 09.07.2009

Код:
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;
}



Re: Onconsoletext always returns unknown command ... - ledzep - 09.07.2009

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?


Re: Onconsoletext always returns unknown command ... - Ignas1337 - 09.07.2009

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


Re: Onconsoletext always returns unknown command ... - ғαιιοцт - 09.07.2009

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


Re: Onconsoletext always returns unknown command ... - Nero_3D - 09.07.2009

everything looks ok, and if you rly get
Quote:

Unknown command or variable:
command

I only can think of another filterscript which returns 0


Re: Onconsoletext always returns unknown command ... - ғαιιοцт - 09.07.2009

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