How to change SERVER: Unknown command
#1

Heyaa!
Can someone can tell me how to change that someone typed an unknown command it will not show as "SERVER: Unknown command" but whatever different text in example "You`re not a harry poter to make your own commands."
Thanks!
Reply
#2

pawn Code:
public OnPlayerCommandText(playerid,cmdtext[])
{
 //---- all commands
  return 0;
}
down there it is return 0 make it
pawn Code:
return SendClientMessage(playerid,-1,"Invalid COmmand");


So it returns That message where " -1 " is color you want , and Replace Invalid Command by message you want.
Reply
#3

Replace
pawn Code:
return 0;
with
pawn Code:
return SendClientMessage(playerid, [color], "You're not harry potter to make your own commands");
at the bottom of OnPlayerCommandText
Reply
#4

Thank u!
Reply
#5

This is mine.
But it still "SERVER: Unknown command"


Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //Can't use commands when not spawned.
	if(IsSpawned[playerid] != 1)
	{
	   SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}You cannot use commands while you're not spawned.");
	   return 1;
	}

	return SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]{FFFFFF} You have entered and invalid command, Type /commands or /cmds to see our server commands.");
}
Reply
#6

Thanks for bumping an 3 years topic.

@aCloudy.
Reply
#7

lol :P
Reply
#8

Quote:
Originally Posted by HY
View Post
Thanks for bumping an 3 years topic.

@aCloudy.
LOOOL :P
I ******d this, hehehe.
Can someone help me ?
Reply
#9

Very simple.
pawn Code:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) SendClientMessage(playerid, COLOR_GREY, "That command does not exist - /commands for a list of commands.");
    return 1;
}
This is what i use.
Reply
#10

Quote:
Originally Posted by Pinguinn
View Post
Replace
pawn Code:
return 0;
with
pawn Code:
return SendClientMessage(playerid, [color], "You're not harry potter to make your own commands");
at the bottom of OnPlayerCommandText
ahahaha, this is a funny one
Reply
#11

Its easy , at end in the place or return 0 type

return SendClientMessage(playerid , -1 /*you can choose your color*/ , " You are not harry potter to make your own commands! ");

That's it.. BINGO!!
Reply
#12

Quote:
Originally Posted by HY
View Post
Thanks for bumping an 3 years topic.

@aCloudy.
You are allowed to bump a topic which hasn't been archived and you are facing the same error.


ontopic: Replace the return 0 with the message you want to send.
Reply
#13

Sorry for bumping the topic.
But I did what you guys talking about but still it sends me SERVER:Unknown Command.

It worked from my past scripts idk why it won't work now.
is this a update bug?
Reply
#14

Why not start a new thread instead of Bumping a 5 years old thread?? Although, It differs from a script to another, Some scripts needs you to create a new unknown command stock..
Reply
#15

Quote:
Originally Posted by KizZweLL
View Post
Sorry for bumping the topic.
But I did what you guys talking about but still it sends me SERVER:Unknown Command.

It worked from my past scripts idk why it won't work now.
is this a update bug?
pawn Code:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
      new str[200];
      if(strlen(cmdtext) < 20) format(str,sizeof(str),"The command %s is not available. Try /cmds instead.",cmdtext);
      else format(str,sizeof(str),"This command is not available, try /cmds instead.");
      PlayerPlaySound(playerid,5204 ,0.0,0.0,0.0);
      return SendClientMessage(playerid,-1,str);
    }
    return 1;
}
Reply
#16

How to make it so it will only respond to commands which are not in use? For instance I have /help but when I used /help it still shows the message now. I want it to show only for commands which or not in use. Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)