From 5f496f2c760a2e2c06468c88e09643e729d1d5a4 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Fri, 18 Dec 2020 19:22:38 -0600 Subject: [PATCH] Add dev simulate player cmd --- scripts/server/command.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/server/command.js b/scripts/server/command.js index f660026f..5794ec36 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -105,6 +105,7 @@ function loadCommandData() { commandData("ccode", executeClientCodeCommand, "", getStaffFlagValue("developer"), true, true), commandData("gmx", restartGameModeCommand, "", getStaffFlagValue("developer"), true, true), commandData("saveall", saveAllServerDataCommand, "", getStaffFlagValue("developer"), true, true), + commandData("docmd", simulatePlayerCommand, " [params]", getStaffFlagValue("developer"), true, true), ], discord: [], faction: [], @@ -347,7 +348,7 @@ function enableAllCommandsByType(command, params, client) { // --------------------------------------------------------------------------- -addEventHandler("OnPlayerCommand", function(event, client, command, params) { +function onPlayerCommand(event, client, command, params) { let commandData = getCommand(command); let paramsDisplay = params; @@ -391,6 +392,21 @@ addEventHandler("OnPlayerCommand", function(event, client, command, params) { console.log(`[Asshat.Command] ${getClientDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`); commandData.handlerFunction(command, params, client); +} +addEventHandler("OnPlayerCommand", onPlayerCommand); + +// --------------------------------------------------------------------------- + +addCommandHandler("cmd", function(command, params, client) { + if(!client.console) { + return false; + } + + let splitParams = params.split(" "); + let newCommand = splitParams[0]; + let newParams = splitParams.slice(1).join(" "); + + onPlayerCommand(newCommand, newParams, client); }); // --------------------------------------------------------------------------- \ No newline at end of file