Mute and Unmute in dcmd
#1

Just made mute and unmute. Didnt get any errors, but when I test it in-game(logged in as a admin) I get Server: Unknown Command.

Here is the code: http://pawn.pastebin.com/cYCbffhq


- ee100
Reply
#2

You're using dcmd, which means you're not finished yet:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(mute, 4, cmdtext); // because "mute" has 4 characters.
  dcmd(unmute, 6, cmdtext); // because "unmute" has 6 characters.
  return false;
}
Reply
#3

Already done that. Thanks for response tho.
Reply
#4

Are you logged as RCON admin then? Because I see that you used IsPlayerAdmin-check.
Reply
#5

I was logged in, yes.
Reply
#6

Check your code again. And by the way, you're not formatting the message correctly.
Reply
#7

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(mute[playerid] == 1)
    {
      SendClientMessage(playerid,0xFF0000,"ERROR: You are muted!");
      return 0;
    }
}
//---------------------------------------------------------------
dcmd_mute(playerid, params[])
{
  new pid;
  if(!IsPlayerAdmin(playerid)) return 1;
  if(sscanf(params,"u",pid)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /mute [playerid]");
  new name[MAX_PLAYER_NAME],string[128];
  GetPlayerName(pid,name,sizeof(name));
  format(string,sizeof(string),"%s has been muted",name);
  SendClientMessageToAll(0xF60000AA,string);
  mute[pid]= 1;
  return 1;
}

dcmd_unmute(playerid, params[])
{
  new pid;
  if(!IsPlayerAdmin(playerid)) return 1;
  if(sscanf(params,"u",pid)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /mute [playerid]");
  new name[MAX_PLAYER_NAME],string[128];
  GetPlayerName(pid,name,sizeof(name));
  format(string,sizeof(string),"%s has been unmuted",name);
  SendClientMessageToAll(0xF60000AA,string);
  mute[pid]= 0;
  return 1;
}
Reply
#8

Quote:
Originally Posted by bpeterson
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(mute[playerid] == 1)
    {
      SendClientMessage(playerid,0xFF0000,"ERROR: You are muted!");
      return 0;
    }
}
//---------------------------------------------------------------
dcmd_mute(playerid, params[])
{
  new pid;
  if(!IsPlayerAdmin(playerid)) return 1;
  if(sscanf(params,"u",pid)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /mute [playerid]");
  new name[MAX_PLAYER_NAME],string[128];
  GetPlayerName(pid,name,sizeof(name));
  format(string,sizeof(string),"%s has been muted",name);
  SendClientMessageToAll(0xF60000AA,string);
  mute[pid]= 1;
  return 1;
}

dcmd_unmute(playerid, params[])
{
  new pid;
  if(!IsPlayerAdmin(playerid)) return 1;
  if(sscanf(params,"u",pid)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /mute [playerid]");
  new name[MAX_PLAYER_NAME],string[128];
  GetPlayerName(pid,name,sizeof(name));
  format(string,sizeof(string),"%s has been unmuted",name);
  SendClientMessageToAll(0xF60000AA,string);
  mute[pid]= 0;
  return 1;
}
Putted it up as u did..

Код:
public OnPlayerText(playerid, text[])
{
if(mute[playerid] == 1)
{
  SendClientMessage(playerid,0xFF0000,"ERROR: You are muted!");
  return 0;
}
return 1;
}
But still the command doesnt work
Reply
#9

The OnPlayerText thingy should work. What does it say?
Reply
#10

Quote:
Originally Posted by bpeterson
The OnPlayerText thingy should work. What does it say?
Since I do /mute.. And I dont see any :/mute [Playerid].. I only get a message that its not a command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)