[HELP] Server Unknown Command?!
#1

Hello again!
I got a problem, after typing in a cmd like /afk or /back, it procceds the cmd and does like it should, but under every cmd in the game it says Server Unknown Command...

The cmds is:

Код:
	if (strcmp("/afk", cmdtext, true, 4) == 0)
	{
		new str[256], pname[256];
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "%s is now away from keyboard!", pname, cmdtext[4]);
    TogglePlayerControllable(playerid, false);
		SendClientMessageToAll(0xFF8000FF, str);
	}
Код:
	if (strcmp("/back", cmdtext, true, 5) == 0)
	{
		new str[256], pname[256];
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "%s is now back on keyboard!", pname, cmdtext[5]);
    TogglePlayerControllable(playerid, true);
		SendClientMessageToAll(0xFF8000FF, str);
	}
Код:
  if (strcmp("/pullover", cmdtext, true, 9) == 0)
  {
 		if(GetPlayerTeam(playerid) != 1) return SendClientMessage(playerid, 0xFF0000AA, "You are not a Police Officer.");
    new string[128];
		new adminname[MAX_PLAYER_NAME];
		GetPlayerName(playerid,adminname,sizeof(adminname));
 		format(string, sizeof(string),"Officer %s says Pull Over Now!",adminname);
		SendClientMessageToAll(0x0000BBAA, string);
	}
Thanks for the help!
Reply
#2

add "return 1;" to the end of each of these commands, eg:

pawn Код:
if (strcmp("/afk", cmdtext, true, 4) == 0)
    {
        new str[256], pname[256];
        GetPlayerName(playerid, pname, 256);
        format(str, 256, "%s is now away from keyboard!", pname, cmdtext[4]);
        TogglePlayerControllable(playerid, false);
        SendClientMessageToAll(0xFF8000FF, str);
        return 1;
    }
Reply
#3

Add this to end of command (no OnPlayerCommandText).

Код:
return 1;
So the commands are:

Код:
	if (strcmp("/afk", cmdtext, true, 4) == 0)
	{
		new str[256], pname[256];
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "%s is now away from keyboard!", pname, cmdtext[4]);
    TogglePlayerControllable(playerid, false);
		SendClientMessageToAll(0xFF8000FF, str);
		return 1;
	}
Код:
	if (strcmp("/back", cmdtext, true, 5) == 0)
	{
		new str[256], pname[256];
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "%s is now back on keyboard!", pname, cmdtext[5]);
    TogglePlayerControllable(playerid, true);
		SendClientMessageToAll(0xFF8000FF, str);
		return 1;
	}
Код:
  if (strcmp("/pullover", cmdtext, true, 9) == 0)
  {
 		if(GetPlayerTeam(playerid) != 1) return SendClientMessage(playerid, 0xFF0000AA, "You are not a Police Officer.");
    new string[128];
		new adminname[MAX_PLAYER_NAME];
		GetPlayerName(playerid,adminname,sizeof(adminname));
 		format(string, sizeof(string),"Officer %s says Pull Over Now!",adminname);
		SendClientMessageToAll(0x0000BBAA, string);
		return 1;
	}
EDIT: I haven't seen earlier post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)