ItsMods

Full Version: BlockerChat
You're currently viewing a stripped down version of our content. View the full version with proper formatting.




Source code
PHP Code:
using System;
using Addon;
using System.IO;
using System.Collections.Generic;

namespace 
SC
{
    public class 
BlockChat CPlugin
    
{
        
string Chat "plugins\\chatblocked.txt";
        
string Chat2;

        public 
override void OnServerLoad()
        {
            
ServerPrint("BlockerChat by S3VDIT0");
            
Chat2 GetServerCFG("ServerControl""BannedChatPlayerMess""^2   !");
        }

        public 
override ChatType OnSay(string MessageServerClient Client)
        {
                
string[] parsed Message.Split(null as char[], StringSplitOptions.RemoveEmptyEntries);
                if (
BlockedXUIDs(Client) == Client.XUID)
                {
                    
TellClient(Client.ClientNumChat2true);
                    return 
ChatType.ChatNone;
                }
            
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                
if (Message.StartsWith("!block") || Message.StartsWith("!b"))
                {
                    if (
parsed.Length 1)
                    {
                        
ServerClient client findClient(parsed[1]);
                        if (
client != null)
                        {
                            
ServerClient client2 findClient(parsed[1]);
                            
using (StreamWriter writer = new StreamWriter(Chattrue))
                            {
                                
writer.WriteLine(client2.XUID.ToLower());
                            }
                            
String block GetServerCFG("ServerControl""SayCB""^2  ^7<playername> ^2 !");
                            
block block.Replace("<playername>"client2.Name);
                            
ServerSay(blocktrue);
                            return 
ChatType.ChatNone;
                        }
                        if (
client == null)
                        {
                            
TellClient(Client.ClientNum"^1      !"true);
                            return 
ChatType.ChatNone;
                        }
                    }
                    else
                    {
                        
TellClient(Client.ClientNum"^7: ^2!block/!b ^7<playername>"true);
                    }
                    return 
ChatType.ChatNone;
                }

            
/////////////////////////////////////////////////////////////////////////////////////////
            
return ChatType.ChatContinue;
        }

        public 
string BlockedXUIDs(ServerClient Client)
        {
            List<
stringXUID = new List<string>(File.ReadAllLines(Chat));

            for (
int i 0XUID.Counti++)
            {
                
string line XUID[i];
                
string CX XUID[i];

                if (
CX == Client.XUID)
                {
                    return 
CX;
                }
            }
            return 
null;
        }

        
//FindClient
        
public ServerClient findClient(String clientName)
        {
            
clientName clientName.Trim();
            
int clientCount 0;
            
ServerClient client null;
            List<
ServerClientclientList GetClients();
            foreach (
ServerClient currClient in clientList)
            {
                if (
<= currClient.Name.IndexOf(clientNameStringComparison.InvariantCultureIgnoreCase))
                {
                    
client currClient;
                    
clientCount++;
                }
            }
            if (
clientCount 1)
            {
                return 
null;
            }
            else if (
clientCount == 1)
            {
                return 
client;
            }

            return 
null;
        }    
    }



Credits:
@S3VDIT0 - Made the plugin
@frst_ - Special thanks
Can't believe people still use InfinityScript to actually mod IW5.
(08-05-2015, 19:30)DidUknowiPwn Wrote: [ -> ]Can't believe people still use InfinityScript to actually mod IW5.

This plugin for the addon, I don't know how IS working.
Maybe I do not understand, since it is not good at English.