I recently tried muting players with:
[instance].IsMuted = true;
and with
[instance].Muted = true;
both of these cause an error (Member variable not found).
Any function to mute?
Muted <-array(GetMaxPlayers(),0);
function onPlayerJoin( player )
{
Muted[player.ID] = 0;
}
else if( cmd =="mute" )
{
local p = FindPlayer( text );
if ( !p )
{
MessagePlayer("[#FF0000]Error: Unknown Player.", player );
return;
}
else if ( !text ) MessagePlayer("[#FF0000][Syntax] - /" + cmd + " <PlayerNAME/ID>", player );
else
{
Muted[ p.ID ] = true;
}
}
function onPlayerChat( player, message )
{
if( Muted[ player.ID ] == true )
{
MessagePlayer("You are muted", player );
return 0;
}
}
This is an example ;)
@MatheuS
1. You should check for text first before trying to FindPlayer it. While it may work, it isn't pretty.
2. You are Mutated? lol.
@Thijn
1. You should check for text first before trying to FindPlayer it. While it may work, it isn't pretty.
I think he will not use it all that I put, I tried to explain to him how it should be
2. You are Mutated? lol.
Fixed!
Still best to give a good example then.
Quote from: MatheuS on Jan 23, 2015, 09:26 AMMuted <-array(GetMaxPlayers(),0);
function onPlayerJoin( player )
{
Muted[player.ID] = 0;
}
else if( cmd =="mute" )
{
local p = FindPlayer( text );
if ( !p )
{
MessagePlayer("[#FF0000]Error: Unknown Player.", player );
return;
}
else if ( !text ) MessagePlayer("[#FF0000][Syntax] - /" + cmd + " <PlayerNAME/ID>", player );
else
{
Muted[ p.ID ] = true;
}
}
function onPlayerChat( player, message )
{
if( Muted[ player.ID ] == true )
{
MessagePlayer("You are muted", player );
return 0;
}
}
This is an example ;)
thanks