Skip to content

Commit

Permalink
fix: interval not created for attack controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuyk committed Jun 22, 2024
1 parent 4b7576d commit 25033ea
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/client/player/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ let disableAttackControls = false;
let interval: number;

function tick() {
if (!disableCameraControls) {
return;
}

if (disableCameraControls) {
// Camera Movement
native.disableControlAction(0, 1, true);
Expand All @@ -22,6 +18,8 @@ function tick() {
}

if (disableAttackControls) {
alt.log('disabling...');

// Scroll Wheel
native.disableControlAction(0, 14, true);
native.disableControlAction(0, 15, true);
Expand Down Expand Up @@ -52,6 +50,10 @@ function setCameraControlsDisabled(state: boolean) {

function setAttackControlsDisabled(state: boolean) {
disableAttackControls = state;

if (!interval) {
alt.setInterval(tick, 0);
}
}

alt.onServer(Events.player.controls.set, setControls);
Expand Down

0 comments on commit 25033ea

Please sign in to comment.