08-17-2015, 09:11
ENG Text (Click to View)
Hello everyone! Would you like to change your username issued messages in the chat for admins? If Yes, this is possible!
P.S. If you use the plugin "Permissions" and you asked nick change person in the group "USER", then the person will send two messages, one with normal nick and the other with a modified.
EX: after compiling or downloading the plugin, when the plugin will automatically create a directory and a folder of aliases.
Should look like this:
IMG
RUS Text (Click to View)
Source code
PHP Code:
using System;
using Addon;
using System.IO;
using System.Collections.Generic;
namespace SC
{
public class Aliases : CPlugin
{
string path = "plugins\\aliases.txt";
string TextColor;
public override ChatType OnSay(string Message, ServerClient Client)
{
List<string> Names = new List<string>(File.ReadAllLines(path));
for (int i = 0; i < Names.Count; i++)
{
string line = Names[i];
string oldName = line.Split('=')[0];
string NewName = line.Split('=')[1];
if (!Message.StartsWith("!"))
{
if (oldName == Client.Name)
{
ServerSay(string.Format("{0}^7:^2 {1}", NewName, Message), true);
return ChatType.ChatNone;
}
}
}
return ChatType.ChatContinue;
}
}
}
Please write how to insert BB code to post "CSHARP code"
Credits:
@S3VDIT0 - Made the plugin
@frst_ - Special thanks