Remove key combos for now (will finish another time)
This commit is contained in:
@@ -18,16 +18,19 @@ function initKeyBindScript() {
|
|||||||
function addKeyBindCommand(command, params, client) {
|
function addKeyBindCommand(command, params, client) {
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
|
|
||||||
let keys = getKeysInComboName(getParam(params, " ", 1));
|
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||||
let tempCommand = getParam(params, " ", 2);
|
let tempCommand = getParam(params, " ", 2);
|
||||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||||
|
|
||||||
if(keys.indexOf(false) != -1) {
|
if(!keyId) {
|
||||||
messagePlayerError(client, "One of the key names you input is invalid!");
|
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces. Must be lowercase.");
|
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
||||||
messagePlayerTip(client, "No actual symbols, use a name for those if needed like ampersand, hashtag, tilde, etc");
|
|
||||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
||||||
messagePlayerInfo(client, `For combos, use a plus sign between the keys. No spaces! Example: {ALTCOLOUR}rightctrl+num3{MAINCOLOUR}`);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!keyId) {
|
||||||
|
messagePlayerError(client, "That key name/id is invalid!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,12 +40,14 @@ function addKeyBindCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||||
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(keys.join(" + "))} {MAINCOLOUR}keys to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removeKeyBindCommand(command, params, client) {
|
function removeKeyBindCommand(command, params, client) {
|
||||||
|
let splitParams = params.split(" ");
|
||||||
|
|
||||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||||
|
|
||||||
if(!keyId) {
|
if(!keyId) {
|
||||||
@@ -69,8 +74,6 @@ function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
|
|||||||
keyBindData.databaseId = -1;
|
keyBindData.databaseId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyBindData.needsSaved = true;
|
|
||||||
|
|
||||||
getPlayerData(client).keyBinds.push(keyBindData);
|
getPlayerData(client).keyBinds.push(keyBindData);
|
||||||
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
||||||
|
|
||||||
@@ -206,29 +209,4 @@ function showKeyBindListCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function getKeyNamesInComboName(comboName) {
|
|
||||||
if(comboName.indexOf("+") != -1) {
|
|
||||||
return comboName.split("+");
|
|
||||||
} else {
|
|
||||||
return [comboName];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function getKeysInComboName(comboName) {
|
|
||||||
let keyNames = getKeyNamesInComboName(comboName);
|
|
||||||
let keys = [];
|
|
||||||
for(let i in keyNames) {
|
|
||||||
if(getKeyIdFromParams(keyNames[i])) {
|
|
||||||
keys.push(getKeyIdFromParams(keyNames[i]));
|
|
||||||
} else {
|
|
||||||
keys.push(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return keys
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
Reference in New Issue
Block a user