SA-MP Forums Archive
/mute /unmute Cmd - 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)
+--- Thread: /mute /unmute Cmd (/showthread.php?tid=384868)



/mute /unmute Cmd - Blackazur - 13.10.2012

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


Re: /mute /unmute Cmd - McFellow - 13.10.2012

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


AW: /mute /unmute Cmd - Blackazur - 13.10.2012

Yep, from the mainchat.


Re: /mute /unmute Cmd - ReVo_ - 13.10.2012

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;



Re: /mute /unmute Cmd - gtakillerIV - 13.10.2012

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.


Re: /mute /unmute Cmd - ReVo_ - 13.10.2012

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

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

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

Now fixed


AW: /mute /unmute Cmd - Blackazur - 13.10.2012

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