Winactive
I have this simple autofire script for H1Z1 and its worked fine, no bans, nothing. But recently with an Anti-Cheat update the script has issues with its toggle feature. I can open the script and the icon appears, I drag it to my secondary monitor, I open H1Z1, and I can toggle it fine. Then after tabbing out to play videos, toggling it off, etc.. It will randomly stop toggling on or off. Basically each time I tab out I have to Reload The Script for it to work. I assume it has to do with Winactive, and if someone could help me either fix Winactive or remove it that would be amazing.
Before you say, I've tried just remove the lines where it says, "Winactive", but when I did the Icon was no longer moveable and I could toggle/suspend the script.
Code:
; <COMPILER: v1.1.24.05>
issuspended := true
isvisible := true
pic_off = kicon.png
pic_on = 0
Menu, Tray, Icon,,, 1
Menu,Tray,Click,1
IniRead, Key1, Settings.ini, Settings, Suspendbutton, XButton1
IniRead, Key2, Settings.ini, Settings, NoRecoil, LButton
IniRead, Key3, Settings.ini, Settings, Rapidfire, XButton2
IniWrite, %Key1%, Settings.ini, Settings, Suspendbutton
IniWrite, %Key2%, Settings.ini, Settings, NoRecoil
IniWrite, %Key3%, Settings.ini, Settings, Rapidfire
Gui, Add, Pic, vPic gMoveGui, % ( issuspended ? pic_off : pic_on )
Gui, Color, #E0FFFF
Gui, +LastFound
winset, transcolor, #E0FFFF
Gui, -Caption -Border -Sysmenu +AlwaysOnTop +ToolWindow
Gui, show, ,
Hotkey, ifwinactive, ahk_exe H1Z1.exe
Hotkey, %Key1%, User1
Hotkey, %Key2%, ~$User2
Hotkey, %Key3%, ~$User3
if !isvisible
Gui Hide
return
GuiToggle:
if isvisible
Gui, Hide
else
Gui, Show
return
#ifwinactive ahk_exe H1Z1.exe
User1:
suspend,permit
ToggleSuspend()
suspend
return
~$User2:
KeyWait %Key2%, T0.2
If (ErrorLevel = 1) {
While GetKeyState(Key2, "P") {
Click
Setmousedelay 130
}
}
return
~$User3:
KeyWait %Key3%, T0.2
If (ErrorLevel = 1) {
While GetKeyState(Key3, "P") {
Click
Setmousedelay 30
}
}
return
#ifwinactive
ToggleSuspend(){
global
issuspended := !issuspended
guicontrol,,Pic, % ( issuspended ? pic_off : pic_on )
}
return
Guiclose:
Exitapp
MoveGui:
PostMessage, 0xA1, 2,,, A
Return
