mute system

Started by Cool, Oct 21, 2015, 05:12 PM

Previous topic - Next topic

Cool

its nots a hard thing but who dont have will help that mute system this system made by S.l.C i just configured to mute from kick
Creator: SLC
CREDITS: Noob
// Player Class
class PlayerStats
{
Muted = false;
}
function onScriptLoad()
{
 local g_ChatHistory = array(GetMaxPlayers());
 }
 
 function onPlayerJoin( player )
{
g_ChatHistory[player.ID] = [];
}

function onPlayerChat( player, text )
{
if ( status[ player.ID ].Muted == true )
{
MessagePlayer( RED+"pm >> Your Message was not sent because you're muted!", player);
return 0;
}

 local match = 0, history = g_ChatHistory[player.ID];
    foreach (msg in history)
    {
        if ((text == msg) && (++match >= 4))
        {
Message(RED+">> Auto-Muted [ " + player.Name + " ] Reason: [ Spamming/Flooding].");
      status[ player.ID].Muted = true;
      NewTimer( "autounmute", 20000, 1, player.Name, player.ID );
  return false;
        }
    }

    history.insert(0, text);
    if (history.len() > 4)
    {
        history.pop();
    }
}

function onPlayerPart( player,  reason )
{
       
  g_ChatHistory[player.ID] = null;
}

function autounmute (player, id)
{
status[ id ].Muted = false;
Message(MSG+">> Auto-Unmuted [ " + player + " ]");
}


KAKAN

For god sake!
It won't work at all.
I'm at a trip, I'll edit it and will give an nice example later.
oh no

KAKAN

#2
Open a new blank server and use it.
If it works, I'll give you any one snip you want.
Remember:- USE A FULLY BLANK SERVER
P.S:_ Going to release a decent one, if everyone wants it.`
oh no

.

There's a number of issues with it. I'll be back with them. For starters, this needs to be outside a function. Otherwise it'll throw "the index 'g_ChatHistory' does not exist"

local g_ChatHistory = array(GetMaxPlayers());
Either that or changed to:

g_ChatHistory <- array(GetMaxPlayers());
.

KAKAN

#4
http://forum.vc-mp.org/?topic=1717.0
See that, and learn.
That's pretty easy.
And yes, you forgot to load the arrays to the class you created.

Some errors:-
The index 'status' doesn't exists
The index 'RED' doesn't exists
Etc etc
oh no