01-27-2013, 19:11
hey there. i were working at an cmd/plugin called moderator rules, but then i released it on an forum did the admin there said to me: "using System Threading; will crash the server, so i dont want to use it. sorry"
is it possible to remove System Threading and change it?
PHP Code:
using System.IO;
using System.Threading;
using Addon;
namespace Rules
{
public class Rules : CPlugin
{
string[] rules = { "" };
public override void OnServerLoad()
{
rules = File.ReadAllLines("addon\\rules.txt");
ServerPrint("ModRules plugin by EnVi Sweden Rocks");
}
public override ChatType OnSay(string Message, ServerClient Client)
{
ServerPrint(Client.Name + ": " + Message);
if (!Message.StartsWith("!modrules"))
{
return ChatType.ChatContinue;
}
Message.Split(new char[]
{
' '
});
{
Thread shru = new Thread(ShowRules);
shru.Start(Client);
return ChatType.ChatNone;
}
return ChatType.ChatGame;
}
private void ShowRules(object cli)
{
ServerClient sc = (ServerClient)cli;
foreach (string rule in rules)
{
Thread.Sleep(1000);
TellClient(sc.ClientNum, "[^1RULES^7]: " + rule, true);
ServerPrint("console to " + sc.Name + ": " + "[^1RULES^7]: " + rule);
}
}
}
}