View Full Version : Sending server console commands from script
Ataros
10-12-2011, 12:56 PM
According to naryv this should work:
System.Console.WriteLine("bla-bla-bla");
Thus you can control server from the script. Server-commander any one ? :)
E.g it is possible to autokick users based on ping now. Or include them into ban list for vulching or attacking admins :D
FG28_Kodiak
10-12-2011, 01:05 PM
Hm via MissionMenu with special user privileges, you could kick and ban players or reload a mission. Seems possible, will make some tests.
Ataros
10-12-2011, 01:11 PM
BTW you can get user Steam ID by "host" console command IIRC.
Do you think it will be possible to give admin privileges based on steam ID?
Also it can be useful for squad statistics: players will be registered as squad members and then when they join a server all their statistics will go to squad statistics.
If server can ID players by Steam ID we would not need to ask entering a password which is not possible now iirc. (Script can not read player messsages from chat yet.)
Do you think we can get Steam ID into script via a console command? Maybe log parsing will be required but it is not very reliable in real time. Sometimes log is written with a big delay.
SNAFU
10-12-2011, 01:27 PM
That is interesting.
Opens many new options for controling, including battle stop and starting, based on if player connected.
FG28_Kodiak
10-12-2011, 02:03 PM
At the moment i get the command to the console but not executed. :(
Ataros
10-12-2011, 02:23 PM
Copy log and code here I will send it to naryv please.
FG28_Kodiak
10-12-2011, 02:32 PM
Nothing special, just for testing i tried (Tester was 30sec delay Trigger) :
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("Tester".Equals(shortName) && active)
{
System.Console.WriteLine("kick Kodiak");
}
}
I also tried "\r\n" and "\n". I get the message kick Kodiak in console, thats all
So the simply way doesn't exist :rolleyes:
Ataros
10-12-2011, 02:45 PM
Thank you. I asked naryv.
41Sqn_Banks
10-12-2011, 03:14 PM
According to naryv this should work:
System.Console.WriteLine("bla-bla-bla");
Thus you can control server from the script. Server-commander any one ? :)
E.g it is possible to autokick users based on ping now. Or include them into ban list for vulching or attacking admins :D
Is it possible to read from console? Code would be:
string line = System.Console.ReadLine();
Ataros
10-12-2011, 05:11 PM
Sorry, I have no idea. Someone has to try it. And better someone who understands what it means :)
Ataros
10-12-2011, 05:35 PM
Nothing special, just for testing i tried (Tester was 30sec delay Trigger) :
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("Tester".Equals(shortName) && active)
{
System.Console.WriteLine("kick Kodiak");
}
}
I also tried "\r\n" and "\n". I get the message kick Kodiak in console, thats all
So the simply way doesn't exist :rolleyes:
Maybe you did not manage to connect to server within 30 seconds? Could you try OnPlaceEnter with a spawnpoint?
FG28_Kodiak
10-12-2011, 05:53 PM
Ive tried it also, but i get only a kick Kodiak message in the console, without execution. :rolleyes:
if i type kick Kodiak in the console and hit enter, i get kicked.
SNAFU
10-12-2011, 06:02 PM
Did you try someother commands? Maybe the dedi has troubles kicking the IP it is hosted by or something like that.
FG28_Kodiak
10-12-2011, 06:59 PM
I also tried battle stop -> no effect.
salmo
10-13-2011, 12:36 AM
So the script is writing to the console, but the command is not executed. Odd? Could it be that the command appears in the console but the cursor has not moved to the next line (ie command not exectuted)?
Does the script need to included the [enter] ie something like System.Console.WriteLine("kick Kodiak" & chr(13));
FG28_Kodiak
10-13-2011, 05:18 AM
your chr(13) is \n or \r\n in C#.
salmo
10-13-2011, 11:40 PM
your chr(13) is \n or \r\n in C#.
So the console comand still does not execute if you send a carriage return with the command? System.Console.WriteLine("kick Kodiak\n");
FG28_Kodiak
10-14-2011, 05:23 AM
The server console is only the standard output in this case. Same like "cmd" in Windows if you use Console Applications.
vBulletin® v3.8.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.