SA-MP Forums Archive
Mute and Unmute in dcmd - 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: Mute and Unmute in dcmd (/showthread.php?tid=142145)



Mute and Unmute in dcmd - Dolph - 17.04.2010

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


Re: Mute and Unmute in dcmd - Correlli - 17.04.2010

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;
}



Re: Mute and Unmute in dcmd - Dolph - 17.04.2010

Already done that. Thanks for response tho.


Re: Mute and Unmute in dcmd - Correlli - 17.04.2010

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


Re: Mute and Unmute in dcmd - Dolph - 17.04.2010

I was logged in, yes.


Re: Mute and Unmute in dcmd - Correlli - 17.04.2010

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


Re: Mute and Unmute in dcmd - bpeterson - 17.04.2010

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;
}



Re: Mute and Unmute in dcmd - Dolph - 17.04.2010

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


Re: Mute and Unmute in dcmd - bpeterson - 17.04.2010

The OnPlayerText thingy should work. What does it say?


Re: Mute and Unmute in dcmd - Dolph - 17.04.2010

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