Add return value type to server code execute
This commit is contained in:
@@ -324,7 +324,7 @@ function executeServerCodeCommand(command, params, client) {
|
|||||||
|
|
||||||
messagePlayerSuccess(client, "Server code executed!");
|
messagePlayerSuccess(client, "Server code executed!");
|
||||||
messagePlayerNormal(client, `Code: ${params}`, COLOUR_YELLOW);
|
messagePlayerNormal(client, `Code: ${params}`, COLOUR_YELLOW);
|
||||||
messagePlayerNormal(client, `Returns: ${returnValue}`, COLOUR_YELLOW);
|
messagePlayerNormal(client, `Returns: ${returnValue} (${typeof returnValue})`, COLOUR_YELLOW);
|
||||||
logToConsole(LOG_INFO, `Server code executed by ${getPlayerDisplayForConsole(client)}: ${params}`);
|
logToConsole(LOG_INFO, `Server code executed by ${getPlayerDisplayForConsole(client)}: ${params}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -337,6 +337,7 @@ function executeClientCodeCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let splitParams = params.split(" ");
|
||||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||||
let targetCode = splitParams.slice(1).join(" ");
|
let targetCode = splitParams.slice(1).join(" ");
|
||||||
|
|
||||||
@@ -350,10 +351,10 @@ function executeClientCodeCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendRunCodeToClient(client, targetClient, targetCode, getPlayerId(client));
|
sendRunCodeToClient(targetClient, targetCode, client);
|
||||||
|
|
||||||
messagePlayerSuccess(client, "Executing client code for " + toString(getPlayerName(targetClient)) + "!");
|
messagePlayerSuccess(client, `Executing client code for ${getPlayerName(targetClient)}`);
|
||||||
messagePlayerNormal(client, "Code: " + targetCode);
|
messagePlayerNormal(client, `Code: ${targetCode}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,27 +475,26 @@ function restartGameModeCommand(command, params, client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clientRunCodeFail(client, returnTo, code) {
|
function clientRunCodeFail(client, returnTo, error) {
|
||||||
let returnClient = getClientFromIndex(returnTo);
|
let returnClient = getClientFromIndex(returnTo);
|
||||||
if(!returnClient) {
|
if(!returnClient) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
messagePlayerError(returnClient, `Client code failed to execute for ${getPlayerName(client)}!`);
|
messagePlayerError(returnClient, `(${getPlayerName(client)}). Error: ${error}`);
|
||||||
messagePlayerNormal(returnClient, `Code: ${code}`, getColourByName("yellow"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clientRunCodeSuccess(client, returnTo, returnVal, code) {
|
function clientRunCodeSuccess(client, returnTo, returnVal) {
|
||||||
let returnClient = getClientFromIndex(returnTo);
|
let returnClient = getClientFromIndex(returnTo);
|
||||||
if(!returnClient) {
|
if(!returnClient) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
messagePlayerSuccess(returnClient, `Client code executed for ${getPlayerName(client)}!`);
|
//messagePlayerSuccess(returnClient, `Client code executed for ${getPlayerName(client)}!`);
|
||||||
messagePlayerNormal(returnClient, `Code: ${code}`, getColourByName("yellow"));
|
//messagePlayerNormal(returnClient, `Code: ${code}`, getColourByName("yellow"));
|
||||||
messagePlayerNormal(returnClient, `Returns: ${returnVal}`, getColourByName("yellow"));
|
messagePlayerNormal(returnClient, `(${getPlayerName(client)}) Code returns: ${returnVal}`, getColourByName("white"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user