/mute /unmute Cmd
#1

How can i script a /mute and /unmute Cmd? And that only Admins can use it.
Reply
#2

How do you mean and mute from what just the main chat?
Reply
#3

Yep, from the mainchat.
Reply
#4

pawn Код:
new bool:Muted[MAX_PLAYERS];
pawn Код:
COMMAND:mute(playerid, params[])
{
if (!IsPlayerAdmin(playerid)) return 1; // player is not admin
new id = strval(params);
if (!IsPlayerConnected(id)) return 1; // invalid player
if (Muted[id]) return 1; // already muted
Muted[id]=true;
}

COMMAND:unmute(playerid, params[])
{
if (!IsPlayerAdmin(playerid)) return 1; // player is not admin
new id = strval(params);
if (!IsPlayerConnected(id)) return 1; // invalid player id
if (!Muted[id]) return 1; // player not muted
Muted[id]=false;
}
OnPlayerText:


pawn Код:
if (Muted[playerid])
return SendClientMessage(playerid,-1,"You are muted."), 0;
OnPlayerConnect:
pawn Код:
Muted[playerid]=false;
Reply
#5

Shouldnt this:

PHP код:
if (Muted[playerid])) 
Be:

PHP код:
if (Muted[playerid] == true
EDIT: (Forgot to mention):
By the way booleans are set by default to false. So no need to use "Muted[playerid]=false;".

And this:

PHP код:
if (Muted[playerid]) 
Should be:

PHP код:
if (Muted[playerid] == true
The one where you say to add it under OnPlayerText.
Reply
#6

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Shouldnt this:

PHP код:
if (Muted[playerid])) 
Be:

PHP код:
if (Muted[playerid] == true
OPS: True i do ))

Now fixed
Reply
#7

Yep thx, but i will too that Admins can mute/unmute a Player, not that he can self mute. xD
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)