Check if player can use keybinds before processing

This commit is contained in:
Vortrex
2021-04-18 19:09:34 -05:00
parent f60b6cc10e
commit adaae74c34

View File

@@ -25,7 +25,7 @@ function initKeyBindScript() {
function bindAccountKey(key, keyState) {
logToConsole(LOG_DEBUG, `[Asshat.KeyBind]: Binded key ${sdl.getKeyName(key)} (${key})`);
bindKey(toInteger(key), keyState, function(event) {
if(hasKeyBindDelayElapsed()) {
if(hasKeyBindDelayElapsed() && canLocalPlayerUseKeyBinds()) {
lastKeyBindUse = sdl.ticks;
tellServerPlayerUsedKeyBind(key);
}
@@ -65,4 +65,10 @@ function hasKeyBindHoldElapsed(keyState) {
return false;
}
// ===========================================================================
function canLocalPlayerUseKeyBinds() {
return (!usingSkinSelector && isSpawned && !itemActionDelayEnabled);
}
// ===========================================================================