You last visited: Today at 09:16
Advertisement
Little Help :)?
Discussion on Little Help :)? within the CO2 Private Server forum part of the Conquer Online 2 category.
12/13/2010, 11:10
#1
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Little Help :)?
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
#2
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 370
World.SendMessageToAll("[SYSTEM]", "Some message", 2011, 0);
Magic
12/13/2010, 14:56
#3
elite*gold: 0
Join Date: May 2006
Posts: 1,190
Received Thanks: 516
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
#4
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Quote:
Originally Posted by
.Kinshi
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
#5
elite*gold: 0
Join Date: Jun 2010
Posts: 50
Received Thanks: 10
Quote:
Originally Posted by
EmmeTheCoder
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
12/13/2010, 17:41
#6
elite*gold: 0
Join Date: Dec 2010
Posts: 341
Received Thanks: 255
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
#7
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,383
Quote:
Originally Posted by
Macnoo
Code:
/broadcast Hello World
but would that not just show as in game
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
#8
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Doesn't work firstindexof for me.. Anyone could help me?
12/13/2010, 22:13
#9
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 370
In ur console commands.
Try this.
12/13/2010, 22:25
#10
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Quote:
Originally Posted by
Syst3m_W1z4rd
In ur console commands.
Try this.
What?
12/13/2010, 23:17
#11
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Fixed, Thought making GUI for Message
Problem :
When i open my GUI, the NEwestCoServer Console Gets Freezed !
12/14/2010, 10:38
#12
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Don't use a while loop in the gui initilize
12/14/2010, 10:45
#13
elite*gold: 0
Join Date: Feb 2006
Posts: 550
Received Thanks: 82
run that console listener on its own thread
12/14/2010, 18:22
#14
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Quote:
Originally Posted by
EmmeTheCoder
Don't use a while loop in the gui initilize
I Didn't use any "While"!
12/14/2010, 19:10
#15
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Quote:
Originally Posted by
PuN|SheR
I Didn't use any "While"!
Then what's causing it to freeze?
All times are GMT +2. The time now is 09:16 .