SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/10/2012, 04:55 PM   #1
Blackazur
High-roller
 
Join Date: Apr 2012
Posts: 1,612
Reputation: 12
Default /mute /unmute Cmd

How can i script a /mute and /unmute Cmd? And that only Admins can use it.
Blackazur is offline   Reply With Quote
Old 13/10/2012, 05:36 PM   #2
McFellow
Big Clucker
 
Join Date: May 2012
Posts: 161
Reputation: 0
Default Re: /mute /unmute Cmd

How do you mean and mute from what just the main chat?
McFellow is offline   Reply With Quote
Old 13/10/2012, 05:40 PM   #3
Blackazur
High-roller
 
Join Date: Apr 2012
Posts: 1,612
Reputation: 12
Default AW: /mute /unmute Cmd

Yep, from the mainchat.
Blackazur is offline   Reply With Quote
Old 13/10/2012, 05:56 PM   #4
ReVo_
Gangsta
 
ReVo_'s Avatar
 
Join Date: Oct 2009
Posts: 539
Reputation: 73
Default Re: /mute /unmute Cmd

Code:
new bool:Muted[MAX_PLAYERS];

Code:
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:


Code:
if (Muted[playerid])
return SendClientMessage(playerid,-1,"You are muted."), 0;

OnPlayerConnect:
Code:
Muted[playerid]=false;
ReVo_ is offline   Reply With Quote
Old 13/10/2012, 05:58 PM   #5
gtakillerIV
High-roller
 
gtakillerIV's Avatar
 
Join Date: Sep 2011
Location: UAE, Sharjah.
Posts: 1,002
Reputation: 201
Default Re: /mute /unmute Cmd

Shouldnt this:

PHP Code:
if (Muted[playerid])) 
Be:

PHP Code:
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 Code:
if (Muted[playerid]) 
Should be:

PHP Code:
if (Muted[playerid] == true
The one where you say to add it under OnPlayerText.
gtakillerIV is offline   Reply With Quote
Old 13/10/2012, 05:59 PM   #6
ReVo_
Gangsta
 
ReVo_'s Avatar
 
Join Date: Oct 2009
Posts: 539
Reputation: 73
Default Re: /mute /unmute Cmd

Quote:
Originally Posted by gtakillerIV View Post
Shouldnt this:

PHP Code:
if (Muted[playerid])) 
Be:

PHP Code:
if (Muted[playerid] == true
OPS: True i do ))

Now fixed
ReVo_ is offline   Reply With Quote
Old 13/10/2012, 06:23 PM   #7
Blackazur
High-roller
 
Join Date: Apr 2012
Posts: 1,612
Reputation: 12
Default AW: /mute /unmute Cmd

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mute / Unmute MustangV10 Scripting Help 14 18/12/2011 12:22 PM
[FilterScript] [FS] Simple Mute and Unmute Oxside Filterscripts 15 18/02/2011 08:24 PM
[HELP] Mute, Unmute, Who is muted Larsey123IsMe Help Archive 0 13/12/2010 05:21 PM
Mute unmute script FireCat Help Archive 3 21/07/2010 04:11 PM
Mute and Unmute in dcmd Dolph Help Archive 11 17/04/2010 11:54 AM


All times are GMT. The time now is 03:29 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.