ItsMods

Full Version: threading remove
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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"
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 MessageServerClient 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]: " ruletrue);
                
ServerPrint("console to " sc.Name ": " "[^1RULES^7]: " rule);
            }
        }
    }


is it possible to remove System Threading and change it?
I really doubt if you created this yourself considering you don't even understand what threading is.
Eitherway, Use ThreadPool or master131's Timing class (found in the mw3 server addon extensions)
Well. I'm an new coder (newbie) and need to learn stuffs.
So you re-release plugins with changed credits?
Yea, I'm sure that'll be a educational experience.