[HELP] Unknown server command
#1

I have a problem.

When i type /me or /b or /shout.
It will show as:

matthew_murdoch Shouts: text
Unknown Server Command

etc.
Whats the problem
Reply
#2

Paste the code you are working with. Not the entre script, just the part with this/these commands
Reply
#3

I just uploaded the whole thing.

http://www.sendspace.com/file/ozivq0
Reply
#4

Simple, you are never returning that the command worked in your code, all you have to do is add a "return 1;" line after every command you do is finished.

I did the /me for you:

Код:
if(strcmp(cmd, "/me", true) == 0)
{
	GetPlayerName(playerid, sendername, sizeof(sendername));
	new length = strlen(cmdtext);
	while ((idx < length) && (cmdtext[idx] <= ' '))
	{
		idx++;
	}
	new offset = idx;
	new result[64];
	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	{
		result[idx - offset] = cmdtext[idx];
		idx++;
	}
	result[idx - offset] = EOS;
	if(!strlen(result))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
		return 1;
	}
	else
	{
		format(string, sizeof(string), "* %s %s", sendername, result);
	}
	ProxDetector(30.0, playerid, string, COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    printf("%s", string);

    // You need to add this return 1, this tells the program that the command worked successfully (or something like that)
    return 1;
}
Reply
#5

Quote:
Originally Posted by japufta
Simple, you are never returning that the command worked in your code, all you have to do is add a "return 1;" line after every command you do is finished.

I did the /me for you:

Код:
if(strcmp(cmd, "/me", true) == 0)
{
	GetPlayerName(playerid, sendername, sizeof(sendername));
	new length = strlen(cmdtext);
	while ((idx < length) && (cmdtext[idx] <= ' '))
	{
		idx++;
	}
	new offset = idx;
	new result[64];
	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	{
		result[idx - offset] = cmdtext[idx];
		idx++;
	}
	result[idx - offset] = EOS;
	if(!strlen(result))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
		return 1;
	}
	else
	{
		format(string, sizeof(string), "* %s %s", sendername, result);
	}
	ProxDetector(30.0, playerid, string, COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    printf("%s", string);

    // You need to add this return 1, this tells the program that the command worked successfully (or something like that)
    return 1;
}
"I did the /me for you"
You're funny. I'm sure it's taken from somewhere.

Don't use his code, it's very useless..
Use this:
pawn Код:
new
  string[128];
if(!strcmp(cmdtext,"/me",true))
{
  if(cmdtext[idx++]!=32||cmdtext[idx]==EOS) return SendClientMessage(playerid,color,"/me [text]");
  format(string,sizeof(string)," %s %s",the_player_name,cmdtext[idx]);
  SendClientessageToAll(color,string);
  return 1;
}
Reply
#6

To the above post. Why is the code useless? And i would have to change every code.

Thanks for the effort.
Reply
#7

Lol, MenaceX's code wouldn't work either because you don't have idx or EOS defined.

And he doesn't mean replace all of your codes, just your /me command

pawn Код:
if(!strcmp(cmdtext[1],"me",true,2))
{
  if(!cmdtext[4])return SendClientMessage(playerid,0xFF0000FF,"Command Requires Parameter. eg \"* Joe Staff Punches The Wall\"");
  new string[130];
  GetPlayerName(playerid,string,sizeof(string));
  format(string,sizeof(string),* "%s %s",string,cmdtext[3]);
  return SendClientMessageToAll(0xAA33AAFF,string);
}
Reply
#8

Quote:
Originally Posted by japufta
Simple, you are never returning that the command worked in your code, all you have to do is add a "return 1;" line after every command you do is finished.

I did the /me for you:

Код:
if(strcmp(cmd, "/me", true) == 0)
{
	GetPlayerName(playerid, sendername, sizeof(sendername));
	new length = strlen(cmdtext);
	while ((idx < length) && (cmdtext[idx] <= ' '))
	{
		idx++;
	}
	new offset = idx;
	new result[64];
	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	{
		result[idx - offset] = cmdtext[idx];
		idx++;
	}
	result[idx - offset] = EOS;
	if(!strlen(result))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
		return 1;
	}
	else
	{
		format(string, sizeof(string), "* %s %s", sendername, result);
	}
	ProxDetector(30.0, playerid, string, COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    printf("%s", string);

    // You need to add this return 1, this tells the program that the command worked successfully (or something like that)
    return 1;
}
Seriously I would just use his ^^^.

The other ones are for like RPG's and I think he wants it for a RolePlay Script
Reply
#9

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by japufta
Simple, you are never returning that the command worked in your code, all you have to do is add a "return 1;" line after every command you do is finished.

I did the /me for you:

Код:
if(strcmp(cmd, "/me", true) == 0)
{
	GetPlayerName(playerid, sendername, sizeof(sendername));
	new length = strlen(cmdtext);
	while ((idx < length) && (cmdtext[idx] <= ' '))
	{
		idx++;
	}
	new offset = idx;
	new result[64];
	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	{
		result[idx - offset] = cmdtext[idx];
		idx++;
	}
	result[idx - offset] = EOS;
	if(!strlen(result))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
		return 1;
	}
	else
	{
		format(string, sizeof(string), "* %s %s", sendername, result);
	}
	ProxDetector(30.0, playerid, string, COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    printf("%s", string);

    // You need to add this return 1, this tells the program that the command worked successfully (or something like that)
    return 1;
}
"I did the /me for you"
You're funny. I'm sure it's taken from somewhere.

Don't use his code, it's very useless..
Use this:
pawn Код:
new
  string[128];
if(!strcmp(cmdtext,"/me",true))
{
  if(cmdtext[idx++]!=32||cmdtext[idx]==EOS) return SendClientMessage(playerid,color,"/me [text]");
  format(string,sizeof(string)," %s %s",the_player_name,cmdtext[idx]);
  SendClientessageToAll(color,string);
  return 1;
}
You are pretty much dumb, sorry but couldn't help not saying it.

I obviously just added the return 1; , is that so hard for you to undertsand. HE already had the /me in his code written.
I EDITED HIS OWN WORK since he needed help on IT. Next time you post something stupid like that, could you please think for a second. This also means you didn't even bother downloading his code to help him.

For the person who needed help on this, all you need to do is make sure there's a "return 1;" after every command text you have.

P.S I may have a few posts but that doesn't mean I don't know shit about coding. Make up your mind bro.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)