Minor update

This commit is contained in:
Maxim Khomutov 2023-07-25 21:19:00 +03:00
parent f52c73ab76
commit c1cb8dcdba
3 changed files with 10 additions and 0 deletions

View File

@ -62,6 +62,7 @@ class EventsSystem:
"onVehicleDeleted": [], # onCarDelete
"onVehicleReset": [], # onCarReset
"onFileChanged": [], # TODO lua onFileChanged
"onConsoleInput": [], # kt.add_command
}
def builtins_hook(self):

View File

@ -63,6 +63,11 @@ class MP:
def _print(self, *args):
args = list(args)
for i, arg in enumerate(args):
if isinstance(arg, str):
try:
args[i] = arg.encode("CP1251").decode(config.enc)
except UnicodeEncodeError:
pass
if "LuaTable" in str(type(arg)):
args[i] = self._lua.globals().Util.JsonEncode(arg)
s = " ".join(map(str, args))

View File

@ -91,6 +91,10 @@ class KuiToi:
return False
return bool(self.get_player(cid=pid, nick=nick))
def add_command(self, key, func, man, desc, custom_completer) -> dict:
self.log.debug("Requests add_command")
return console.add_command(key, func, man, desc, custom_completer)
class PluginsLoader: