Release BlockerChat
#1
Rainbow 




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 Message, ServerClient Client) { string[] parsed = Message.Split(null as char[], StringSplitOptions.RemoveEmptyEntries); if (BlockedXUIDs(Client) == Client.XUID) { TellClient(Client.ClientNum, Chat2, true); 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(Chat, true)) { writer.WriteLine(client2.XUID.ToLower()); } String block = GetServerCFG("ServerControl", "SayCB", "^2 ^7<playername> ^2 !"); block = block.Replace("<playername>", client2.Name); ServerSay(block, true); 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<string> XUID = new List<string>(File.ReadAllLines(Chat)); for (int i = 0; i < XUID.Count; i++) { 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<ServerClient> clientList = GetClients(); foreach (ServerClient currClient in clientList) { if (0 <= currClient.Name.IndexOf(clientName, StringComparison.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


Attached Files
.rar   ChatBlocker.rar (Size: 2.87 KB / Downloads: 77)
Reply

#2
Can't believe people still use InfinityScript to actually mod IW5.
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#3
(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.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.