Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: MacTavish on Mar 12, 2015, 09:42 AM

Title: Server mute player on first join
Post by: MacTavish on Mar 12, 2015, 09:42 AM
guys i have an weird problem server is auto muting player on just one message its just happening on VPS and just on first join no errors appeared :-\
Title: Re: Server mute player on first join
Post by: DizzasTeR on Mar 12, 2015, 09:44 AM
Can you show your onPlayerChat & onPlayerJoin?

and if you can explain a little more.
Title: Re: Server mute player on first join
Post by: MacTavish on Mar 12, 2015, 09:50 AM
Quote from: Doom_Killer on Mar 12, 2015, 09:44 AMCan you show your onPlayerChat & onPlayerJoin?

and if you can explain a little more.
function onPlayerJoin( player )
{
local IP = player.IP;
    Message(BROWN +"--> [ "+WHITE+""+ player.Name +""+ BROWN +" ] Connecting From:[ "+WHITE+""+ IpToCountry( IP ) +""+ BROWN +"  ]" );
    ePrivMessage(GREY+"--> Welcome [ "+PINK+""+ player.Name +""+GREY+" ], IP: [ "+PINK+""+ player.IP +""+GREY+" ]",player);
  ePrivMessage(ORANGE+"--> Welcome to [ "+PURPLE+"" + NameServer + ""+ORANGE+" ]",player);
  ePrivMessage(LBLUE+"--> Your Mac-ID is [" + player.UniqueID + "]", player );
    EchoMessage(ICOL_GREEN+"--> [ " + player.Name + " ] "+ ICOL_BROWN + "Connecting From: "+ ICOL_ORANGE+"[ "+ IpToCountry( IP )+" ]" );
EPM(ICOL_GREEN+"--> [ " + player.Name + " ] "+ ICOL_BROWN + "Connecting From: "+ ICOL_ORANGE+"[ "+ IpToCountry( IP )+" ]"+ ICOL_GREEN + " With IP: "+ ICOL_BLACK+"[ "+ player.IP +" ]" );
g_FPS.push({Player = player, Text = null});
DIS.push({Player = player, Text = null});
PLS.push({Player = player, Text = null});
NewTimer( "Banned", 3000, 1,  player.ID );
SKIN.push({Player = player, Text = null});
Announce(" ~y~Wellcome ~b~To ~g~Extreme ~p~City ~w~2015",player,6);
    test <- CreateTextdraw("[0.4] Extreme City 2015-16",20,-38,0xFF00FF00);
O <- CreateSprite( "needle.png",-340,-250, 0, 0, 0,255 );
    test.ShowForPlayer(player);
ec <- CreateSprite("ec.png",-340,-150,0,0,0,-150);
ec.ShowForPlayer(player);
    LastActive(player);
    AccInfo(player);
    local ID = player.ID;
if(stats[ID]!=null)stats[ID] = null;
stats[player.ID] = PlayerStats();
loadspawnwep(player.Name,ID);
}

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

if ( i == 1 ) onPlayerCommand2( player, GetTok( text.slice( 1 ), " ", 1 ), xp );
else onPlayerCommand2( player, GetTok( text.slice( 1 ), " ", 1 ), GetTok( text.slice( 1 ), " ", 2, i ) );
}
    }

//=========================== AntiSpam =============================================================

         local spammer = (GetTickCount()-MSNCount[player.ID])/MSNxSEC;
    MSNPlayer[player.ID]+=spammer-1;
    if(MSNPlayer[player.ID]>LIMIT_REP_SPAM)MSNPlayer[player.ID]=LIMIT_REP_SPAM-1;
    if(MSNPlayer[player.ID]<0)MSNPlayer[player.ID]= -1;
    MSNCount[player.ID]=GetTickCount();
    if(MSNPlayer[player.ID]<0)
     {
      Message(RED+">> Auto-Muted [ " + player.Name + " ] For 20Secs Reason: [ Spamming/Flooding].");
EchoMessage(ICOL_RED+">> Auto-Muted [ " + player.Name + " ] For 20Secs Reason: [ Spamming/Flooding].");
      status[ player.ID].Muted = true;
      NewTimer( "autounmute", 20000, 1, player.Name, player.ID );
NewTimer( "Count1", 1000, 1, 20, player.ID );
NewTimer( "Count1", 2000, 1, 19, player.ID );
NewTimer( "Count1", 3000, 1, 18, player.ID );
NewTimer( "Count1", 4000, 1, 17, player.ID );
NewTimer( "Count1", 5000, 1, 16, player.ID );
NewTimer( "Count1", 6000, 1, 15, player.ID );
NewTimer( "Count1", 7000, 1, 14, player.ID );
NewTimer( "Count1", 8000, 1, 13, player.ID );
NewTimer( "Count1", 9000, 1, 12, player.ID );
NewTimer( "Count1", 10000, 1, 11, player.ID );
NewTimer( "Count1", 11000, 1, 10, player.ID );
NewTimer( "Count1", 12000, 1, 9, player.ID );
NewTimer( "Count1", 13000, 1, 8, player.ID );
NewTimer( "Count1", 14000, 1, 7, player.ID );
NewTimer( "Count1", 15000, 1, 6, player.ID );
NewTimer( "Count1", 16000, 1, 5, player.ID );
NewTimer( "Count1", 17000, 1, 4, player.ID );
NewTimer( "Count1", 18000, 1, 3, player.ID );
NewTimer( "Count1", 19000, 1, 2, player.ID );
NewTimer( "Count1", 20000, 1, 1, player.ID );
}
//=======================================================================================================

EchoMessage(randcolorsirc[rand() % randcolorsirc.len()]+"[" + player.ID +"] "+ player.Name + ": "+randcolorsirc[rand() % randcolorsirc.len()]+"" + text.tostring() + "\n");
    Message(ORANGE+ player.Name + " : "+WHITE+""+ text.tostring());
return 0;

}

Doom i cant explain if you wanna see then join    vc-mp.net:5200


after every restart and and only for first time when player join and start chat then server mute him but if he rejoin and then again start chat then its works fine
Title: Re: Server mute player on first join
Post by: DizzasTeR on Mar 12, 2015, 12:02 PM
I dont see any problem there.... but i noticed you are returning 0 onplayerchat, why is that so? Also a player doesn't get automuted, there is something which sets the mute stats of the player to true.

After reading your statement again I noticed that you said it happens on first join, means you might be setting his mute to true accidently for example on login cmd or autologin. Anyway i'll check your server.
Title: Re: Server mute player on first join
Post by: . on Mar 12, 2015, 12:06 PM
Quote from: Doom_Killer on Mar 12, 2015, 12:02 PM.... but i noticed you are returning 0 onplayerchat, ...

There's the bug :P
Title: Re: Server mute player on first join
Post by: Sk on Mar 12, 2015, 12:24 PM
m i the only one to notice those 20 timers which could be replaced by one timer. ><
anyway dont use that return 0 at that end it will not show any chat message instead use return 1 idk may be that helps.
Edit:
OMG those timers are in chat event. ._.
Title: Re: Server mute player on first join
Post by: Kratos_ on Mar 13, 2015, 05:06 AM
But why 20 timers onplayerchat  ?  If there will be 10 spammers then you're invoking a series of 200 timers in the server & about 10 of them will woke up together successively at any instant of 1-20 seconds .  Use GetTickCount for the time bound which will be regarded
as the mute period .
Title: Re: Server mute player on first join
Post by: MacTavish on Mar 13, 2015, 07:14 AM
Thanks guys but the problem has not been solved yet i will try restoring the changes in script i've made because it was working fine 2days ago