Release Read command output
#1
on request of @iAegle here is the C# code from my (not released yet) RCON plugin which reads the output from the console after you've executed a command.
This is not perfect, because it waits 1 sec which makes command processing not really fast. You can change it to something lower however i do not recommend it

Function
Code:
string readResponse(string identifier) { string[] content = File.ReadAllLines("addon\\logs\\console.log"); bool add = false; string output = ""; foreach (string z in content) { string r = ""; try { r = z.Substring(11); } catch { } if(add) { output += r; output += "\n"; } if (r == identifier) add = true; } return output; }

Usage example
Code:
Random random = new Random(); string id = Convert.ToString(random.Next(1, 99999)); ServerPrint("]" + cmd.Replace("\r\n", "").Replace("\n", "")); ServerLog(LogType.LogConsole, id); ServerCommand(cmd); Thread.Sleep(1000); //wait for the command to process string lulz = readResponse(id); return lulz;
Reply

#2
<3 5char
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help auto command Dynasty 6 5,976 08-26-2013, 16:05
Last Post: hillbilly
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 5,666 04-05-2013, 18:15
Last Post: SuperNovaAO
  Dont Read Stocker 1 3,481 02-24-2013, 19:38
Last Post: JariZ
  !come command Dr3am95 12 10,950 02-12-2013, 12:08
Last Post: SgtLegend
  whats the command to get string length pedjas 4 4,294 01-20-2013, 18:30
Last Post: pedjas
  Help Read from console rcon in Delphi richard1994x 9 8,622 12-01-2012, 17:34
Last Post: richard1994x
  [Request] Team change by admin command. Dumas 10 11,375 11-29-2012, 21:38
Last Post: 99IRock
Question Help kick command still need help koro35 3 4,341 11-27-2012, 22:45
Last Post: koro35
  [Help] How to hide a command? korsika 4 5,569 10-27-2012, 23:30
Last Post: korsika
  Please read this. JariZ 10 8,928 10-17-2012, 20:56
Last Post: diegogt

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.