![]() |
Sending server console commands from script
According to naryv this should work:
Code:
System.Console.WriteLine("bla-bla-bla"); E.g it is possible to autokick users based on ping now. Or include them into ban list for vulching or attacking admins :D |
Hm via MissionMenu with special user privileges, you could kick and ban players or reload a mission. Seems possible, will make some tests.
|
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. |
That is interesting.
Opens many new options for controling, including battle stop and starting, based on if player connected. |
At the moment i get the command to the console but not executed. :(
|
Copy log and code here I will send it to naryv please.
|
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: |
Thank you. I asked naryv.
|
Quote:
Code:
string line = System.Console.ReadLine(); |
Sorry, I have no idea. Someone has to try it. And better someone who understands what it means :)
|
Quote:
|
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. |
Did you try someother commands? Maybe the dedi has troubles kicking the IP it is hosted by or something like that.
|
I also tried battle stop -> no effect.
|
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)); |
your chr(13) is \n or \r\n in C#.
|
Quote:
|
The server console is only the standard output in this case. Same like "cmd" in Windows if you use Console Applications.
|
All times are GMT. The time now is 07:01 PM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.