Mass convert indentation + add ped speech cmd

This commit is contained in:
Vortrex
2022-03-16 17:02:33 -05:00
parent 297ab6f8f8
commit efc72dffe1
68 changed files with 8401 additions and 8312 deletions

View File

@@ -23,71 +23,71 @@ function initKeyBindScript() {
// ===========================================================================
function bindAccountKey(key, keyState) {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
keyBinds.push(toInteger(key));
bindKey(toInteger(key), keyState, function(event) {
if(isAnyGUIActive()) {
return false;
}
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
keyBinds.push(toInteger(key));
bindKey(toInteger(key), keyState, function(event) {
if(isAnyGUIActive()) {
return false;
}
if(hasKeyBindDelayElapsed()) {
if(canLocalPlayerUseKeyBinds()) {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
lastKeyBindUse = sdl.ticks;
tellServerPlayerUsedKeyBind(key);
} else {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
}
} else {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
}
});
if(hasKeyBindDelayElapsed()) {
if(canLocalPlayerUseKeyBinds()) {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
lastKeyBindUse = sdl.ticks;
tellServerPlayerUsedKeyBind(key);
} else {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
}
} else {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
}
});
}
// ===========================================================================
function unBindAccountKey(key) {
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
unbindKey(key);
keyBinds.splice(keyBinds.indexOf(key), 1);
return true;
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
unbindKey(key);
keyBinds.splice(keyBinds.indexOf(key), 1);
return true;
}
// ===========================================================================
function hasKeyBindDelayElapsed() {
if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
return true;
}
if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
return true;
}
return false;
return false;
}
// ===========================================================================
function canLocalPlayerUseKeyBinds() {
if(isAnyGUIActive()) {
return false;
}
if(isAnyGUIActive()) {
return false;
}
if(!isSpawned) {
return false;
}
if(!isSpawned) {
return false;
}
if(itemActionDelayEnabled) {
return false;
}
if(itemActionDelayEnabled) {
return false;
}
return true;
return true;
}
// ===========================================================================
function clearKeyBinds() {
for(let i in keyBinds) {
unbindKey(keyBinds[i]);
}
keyBinds = [];
for(let i in keyBinds) {
unbindKey(keyBinds[i]);
}
keyBinds = [];
}
// ===========================================================================