Is there any way to log the executed RCON commands? They show up in the console, but don't get logged.
__title__ = 'ConsoleLogger'
__author__ = 'Jakkee'
__version__ = '1.0'
import clr
clr.AddReferenceByName("Fougerite")
import Fougerite
class ConsoleLogger:
def On_Console(self, Player, ConsoleEvent):
if not Plugin.IniExists("Log"):
Plugin.CreateIni("Log").Save()
command = ConsoleEvent.Class
if ConsoleEvent.Function is not None:
command = ConsoleEvent.Class + "." + ConsoleEvent.Function
ini = Plugin.GetIni("Log")
ini.AddSetting("Log", Plugin.GetDate() + "|" + Plugin.GetTime(), Player.Name + "=" + Player.SteamID + " has run: " + command)
hmm..[4/4/2016 1:09:52 AM] [Error] [IronPython] Error in plugin ConsoleLogger:
[4/4/2016 1:09:52 AM] [Error] Traceback (most recent call last):
File "<string>", line 17, in On_Console
AttributeError: 'NoneType' object has no attribute 'Name'
__title__ = 'ConsoleLogger'
__author__ = 'Jakkee'
__version__ = '1.0'
import clr
clr.AddReferenceByName("Fougerite")
import Fougerite
class ConsoleLogger:
def On_Console(self, Player, ConsoleEvent):
try:
if not Plugin.IniExists("Log"):
Plugin.CreateIni("Log").Save()
command = ConsoleEvent.Class
if ConsoleEvent.Function is not None:
command = ConsoleEvent.Class + "." + ConsoleEvent.Function
ini = Plugin.GetIni("Log")
ini.AddSetting("Log", Plugin.GetDate() + "|" + Plugin.GetTime(), Player.Name + "=" + Player.SteamID + " has run: " + command)
except:
pass
Use Plugin.Log("LogName", x) instead of da iniminis.hmm..
Try this, it will not through errors but it also may not log anything as well
Python:__title__ = 'ConsoleLogger' __author__ = 'Jakkee' __version__ = '1.0' import clr clr.AddReferenceByName("Fougerite") import Fougerite class ConsoleLogger: def On_Console(self, Player, ConsoleEvent): try: if not Plugin.IniExists("Log"): Plugin.CreateIni("Log").Save() command = ConsoleEvent.Class if ConsoleEvent.Function is not None: command = ConsoleEvent.Class + "." + ConsoleEvent.Function ini = Plugin.GetIni("Log") ini.AddSetting("Log", Plugin.GetDate() + "|" + Plugin.GetTime(), Player.Name + "=" + Player.SteamID + " has run: " + command) except: pass
__title__ = 'ConsoleLogger'
__author__ = 'Jakkee'
__version__ = '1.0'
import clr
clr.AddReferenceByName("Fougerite")
import Fougerite
class ConsoleLogger:
def On_Console(self, Player, ConsoleEvent):
try:
command = ConsoleEvent.Class
if ConsoleEvent.Function is not None:
command = ConsoleEvent.Class + "." + ConsoleEvent.Function
Plugin.Log("Log", Player.Name + "=" + Player.SteamID + " has run: " + command)
except:
pass