SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 21/04/2020, 03:02 PM   #1171
Kasichok
Big Clucker
 
Kasichok's Avatar
 
Join Date: Sep 2018
Location: weed farm
Posts: 95
Reputation: 35
Default Re: Useful Snippets

Simple Mute Script: (please remember to set player color or else his name in chat will be black)

PHP Code:
#include <a_samp>
#include <foreach>
#include <sscanf2>
#include <zcmd>

static bool:Muted[MAX_PLAYERS][MAX_PLAYERS];

public 
OnPlayerDisconnect(playeridreason)
{
    foreach(new 
i,Player)
    {
        
Muted[i][playerid] = false;
        
Muted[playerid][i] = false;
    }
    return 
1;
}

CMD:mute(playeridparams[])
{
    new 
username[31];
    if(
sscanf(params"u"user)) return SendClientMessage(playerid0xFFFFFFFF"Usage: /mute [id/name]");
    if(
user == playerid) return SendClientMessage(playerid0xFF0000FF"You cannot mute yourself!");
    if(!
IsPlayerConnected(user) || IsPlayerNPC(playerid)) return SendClientMessage(playerid0xFF0000FF"Invalid player!");
    if(
Muted[playerid][user]) return SendClientMessage(playerid0xFF0000FF"Player is allready muted!");
    
Muted[playerid][user] = true;
    
GetPlayerName(username24);
    
strcat(name" muted!");
    
SendClientMessage(playerid0xFFFF00FFname);
    return 
1;
}

CMD:unmute(playeridparams[])
{
    new 
username[33];
    if(
sscanf(params"u"user)) return SendClientMessage(playerid0xFFFFFFFF"Usage: /mute [id/name]");
    if(
user == playerid) return SendClientMessage(playerid0xFF0000FF"If you cannot mute yourself then why unmute!");
    if(!
IsPlayerConnected(user) || IsPlayerNPC(playerid)) return SendClientMessage(playerid0xFF0000FF"Invalid player!");
    if(!
Muted[playerid][user]) return SendClientMessage(playerid0xFF0000FF"Player is not muted!");
    
Muted[playerid][user] = false;
    
GetPlayerName(username24);
    
strcat(name" unmuted!");
    
SendClientMessage(playerid0xFFFF00FFname);
    return 
1;
}

public 
OnPlayerText(playeridtext[])
{
    new 
colorname[144];
    
color GetPlayerColor(playerid);
    
GetPlayerName(playeridname24);
    
strcat(name"{FFFFFF}: ");
    
strcat(nametext);
    foreach(new 
i,Player)
    {
        if(
Muted[i][playerid]) continue;
        
SendClientMessage(icolorname);
    }
    return 
0;

__________________



STRESSED? TRY KASICHOK AND RELAX


Kasichok 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
READ Usefull Links to snippets and other -Sneaky- Help Archive 5 02/05/2009 11:22 AM


All times are GMT. The time now is 09:03 PM.


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