Use locale strings for keybind cmds messages
This commit is contained in:
@@ -43,6 +43,11 @@ function initKeyBindScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addKeyBindCommand(command, params, client) {
|
function addKeyBindCommand(command, params, client) {
|
||||||
|
if (areParamsEmpty(tempCommand)) {
|
||||||
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
|
|
||||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||||
@@ -50,45 +55,35 @@ function addKeyBindCommand(command, params, client) {
|
|||||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||||
|
|
||||||
if (!keyId) {
|
if (!keyId) {
|
||||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
messagePlayerError(client, getLocaleString(client, "InvalidKeyBindName"));
|
||||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
messagePlayerTip(client, getLocaleString(client, "KeyBindNameTip"));
|
||||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
messagePlayerInfo(client, getLocaleString(client, "UniversalInlineExampleList", `{ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl{MAINCOLOR}`));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!keyId) {
|
|
||||||
messagePlayerError(client, "That key name/id is invalid!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (areParamsEmpty(tempCommand)) {
|
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||||
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
messagePlayerSuccess(client, getLocaleString(client, "KeyBindRemoved", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))}{MAINCOLOUR}`, `{ALTCOLOUR}/${tempCommand} ${tempParams}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removeKeyBindCommand(command, params, client) {
|
function removeKeyBindCommand(command, params, client) {
|
||||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
if (areParamsEmpty(tempCommand)) {
|
||||||
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
if (!keyId) {
|
|
||||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
|
||||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
|
||||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||||
|
|
||||||
if (!keyId) {
|
if (!keyId) {
|
||||||
messagePlayerError(client, "That key name/id is invalid!");
|
messagePlayerError(client, getLocaleString(client, "InvalidKeyBindName"));
|
||||||
|
messagePlayerTip(client, getLocaleString(client, "KeyBindNameTip"));
|
||||||
|
messagePlayerInfo(client, getLocaleString(client, "UniversalInlineExampleList", `{ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl{MAINCOLOR}`));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
removePlayerKeyBind(client, keyId);
|
removePlayerKeyBind(client, keyId);
|
||||||
messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
messagePlayerSuccess(client, getLocaleString(client, "KeyBindRemoved", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))}{MAINCOLOUR}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -102,6 +97,15 @@ function resetKeyBindsCommand(command, params, client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function copyKeyBindsToServerCommand(command, params, client) {
|
||||||
|
getPlayerData(client).promptType = AGRP_PROMPT_COPYKEYBINDSTOSERVER;
|
||||||
|
showPlayerPrompt(client, getLocaleString(client, "CopyAllKeyBindsToServerConfirm"), getLocaleString(client, "GUIWarningTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||||
|
//removePlayerKeyBind(client, keyId);
|
||||||
|
//messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
|
function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
|
||||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
||||||
if (tempKey == true) {
|
if (tempKey == true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user