Poll

Let See How Many Likes This Function Got

Yes
3 (100%)
No
0 (0%)

Total Members Voted: 3

Voting closed: January 11, 2015, 12:33:52 pm

Author Topic: Function On Player Chat  (Read 17 times)

$TyLiXx AbBa$ii

  • Administrator
  • Newbie
  • *****
  • Posts: 9
  • Karma: +1/-0
  • Scripter
    • View Profile
Function On Player Chat
« on: January 01, 2015, 07:49:43 am »
function onPlayerChat( player, text )
{
   // Echoes the message
   local color;
   if(player.IsMuted==true) PrivMessage("You are muted so no one can read your messages!!",player);
   if(binfo[player.ID].Ptext==null)binfo[player.ID].Ptext=text;
   else if(binfo[player.ID].Ptext==text) binfo[player.ID].Ptextcount=binfo[player.ID].Ptextcount+1;
   else binfo[player.ID].Ptextcount=0;
   binfo[player.ID].Ptext=text;
   if(binfo[player.ID].Stimer==0) binfo[player.ID].Stimer=GetTime().tointeger();
   else if((GetTime().tointeger()-binfo[player.ID].Stimer)<2) binfo[player.ID].SCounter=binfo[player.ID].SCounter+1;
   else
   {
      binfo[player.ID].SCounter=0;
      binfo[player.ID].Stimer=GetTime().tointeger();
   }
   if((binfo[player.ID].SCounter>2 || binfo[player.ID].Ptextcount>3) && player.IsMuted == false && (GetLevel(player)==1))
   {
      player.IsMuted = true;
      binfo[player.ID].SCounter=0;
      binfo[player.ID].Ptextcount=0;
      ClientMessage ( "You have been Auto-muted for one minute for spamming!", player 159,204,280);
      NewTimer("unmute",60000,1,player.ID);
   }
   else if((binfo[player.ID].SCounter>=2 || binfo[player.ID].Ptextcount>3) && player.IsMuted == false) Kick( player, "auto", "spamming while Muted" );
      
   switch ( player.Skin )
   {
      case 1:
         color = ICOL_LBLUE;
         break;
      case 2:
         color = ICOL_BLUE;
         break;
      case 3:
         color = ICOL_CYAN;
         break;
      case 4:
         color = ICOL_GREEN;
         break;
      case 5:
         color = ICOL_LGREEN;
         break;
      default:
         color = ICOL_BROWN;
   }
   messagez.push( {
            name = player.Name,
            team = player.Team,
            msg = text,
            type = 4
           });
   if(messagez.len() > 20) messagez.remove(0);
   EchoMessage( ICOL_GREEN + "[" + player.ID + "] " + ICOL + color + "" + player.Name + "> " + ICOL + text );
   
   
No Matter Who I Am It Depends On You

Share on Facebook Share on Twitter


nomi

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
  • I am n0t lazy i am just 0n my energy saving mode
    • View Profile
Re: Function On Player Chat
« Reply #1 on: January 02, 2015, 02:33:44 am »
nice work abbasi :) :) :) :P
n0b0dy is perfect i am n0b0dy