lghub lua script presskey

24 views Asked by At

I dont really know how to code lua, i made a script, when "Numlock" is on the script clicks "a" for a random time duration, then releases "a" and it presses "s" for random time. repeats the script until numlock is turned off. it doesnt work tho..

function OnEvent(event, arg)
   OutputLogMessage("wawa")
   if event == sKeyLockOn("Numlock") then
         repeat
            PressKey("a")
            Sleep(math.random(8700, 8900))
            ReleaseKey("a")
            Sleep(2)
            PressKey("s")
            Sleep(math.random(8700, 8900))
            ReleaseKey("s")
            Sleep(2)
            until not IsKeyLockOn("Numlock")
      end
   end

this code doesnt work for some reason, i tried using mouse button instead of numlock but no luck

0

There are 0 answers