Little Help :)?

12/13/2010 11:10 PuN|SheR#1
Hey.. I Have one question.. I would like to speak to my players sometimes, without entering game and whispering them! And Game.World.SendMsgToAll would be good to make it to work in Console of the server ! So if someone can help me how to make command in console of NewestCoServer(Program.cs) that will write message (BroadCoast) To all players online on server... like the CO Messages "Any Trading of game accounts are illegal and can get your acc banned " ! Thanks :)
12/13/2010 11:21 Syst3m_W1z4rd#2
World.SendMessageToAll("[SYSTEM]", "Some message", 2011, 0);

Magic
12/13/2010 14:56 .Beatz#3
Add this under MobThread_Execute (maybe it's called something different in your source)
Also you will need to change Actions to World.
Code:
static void Handle_Events()
        {
            switch (DateTime.Now.Minute)
            {
                case 5:
                case 13:
                    Actions.SendMsgToAll("GM", "ADD MESSAGE HERE", 2011, 0);
                    break;
                case 20:
                    Actions.SendMsgToAll("GM", "ADD MESSAGE HERE", 2011, 0);
                    break;
                case 32:
                    Actions.SendMsgToAll("GM", "ADD MESSAGE HERE", 2011, 0);
                    break;
                case 44:
                    Actions.SendMsgToAll("GM", "ADD MESSAGE HERE", 2011, 0);
                    break;
                case 56:
                    Actions.SendMsgToAll("GM", "ADD MESSAGE HERE", 2011, 0);
                    break;
                default:
                    break;
            }
        }
Fixed

Ahh I thought this was what he wanted lol
12/13/2010 15:03 _Emme_#4
Quote:
Originally Posted by .Kinshi View Post
Code:
while (true) {
    String cmd = Console.ReadLine();
    if (cmd.StartsWith("/broadcast"))
        SendMsgToAll("[Broadcast]", cmd.SubString(cmd.FirstIndexOf(" ")));
}
Something like that would work.
.
12/13/2010 15:52 Macnoo#5
Quote:
Originally Posted by EmmeTheCoder View Post
while(true)
{
string[] input = Console.ReadLine().Split(' ');
if (input[0] == "/broadcast")
SendMsgToAll("[Broadcast]",input[1]);
}
Code:
/broadcast Hello World
but would that not just show as in game

Code:
[Broadcast]Hello
12/13/2010 17:41 .Kinshi#6
Code:
while (true) {
    String cmd = Console.ReadLine();
    if (cmd.StartsWith("/broadcast"))
        SendMsgToAll("[Broadcast]", cmd.SubString(cmd.FirstIndexOf(" ")));
}
Something like that would work.
12/13/2010 20:41 pro4never#7
Quote:
Originally Posted by Macnoo View Post
Code:
/broadcast Hello World
but would that not just show as in game

Code:
[Broadcast]Hello
Depends on how you use the data entered... if you just use string[1] or w/e yes it will only use the first word (assuming splitting by ' ') but if you parse things properly it would work fine.

Personally what I do is if it's NOT a cmd I broadcast it.


IE:

/restart
/blablabla
/etc

all do cmds... but if I do like

Weeee!!

that gets sent to all online players.
12/13/2010 21:09 PuN|SheR#8
Doesn't work firstindexof for me.. Anyone could help me?
12/13/2010 22:13 Syst3m_W1z4rd#9
In ur console commands.
Try this.

Code:
Removed
12/13/2010 22:25 PuN|SheR#10
Quote:
Originally Posted by Syst3m_W1z4rd View Post
In ur console commands.
Try this.

Code:
Removed
What?
12/13/2010 23:17 PuN|SheR#11
Fixed, Thought making GUI for Message :D

Problem :
When i open my GUI, the NEwestCoServer Console Gets Freezed !
12/14/2010 10:38 _Emme_#12
Don't use a while loop in the gui initilize
12/14/2010 10:45 ChingChong23#13
run that console listener on its own thread
12/14/2010 18:22 PuN|SheR#14
Quote:
Originally Posted by EmmeTheCoder View Post
Don't use a while loop in the gui initilize
I Didn't use any "While"!
12/14/2010 19:10 _Emme_#15
Quote:
Originally Posted by PuN|SheR View Post
I Didn't use any "While"!
Then what's causing it to freeze?