Can someone help me with no recoil script?

Ask gaming related questions
SongoMongox
Posts: 1
Joined: 04 Feb 2020, 06:59

Can someone help me with no recoil script?

04 Feb 2020, 11:40

Hello there!

I found 2 scripts that I would like to merge them to once.

This one has a GUI interface where I can choose keys etc.

Code: Select all

;
; ****** AutoHotkey___.exe with administrator privileges ******
;
;



#NoEnv
SendMode Input

IniRead, IniNorecoilKey, Settings.ini, Settings, No recoil, F2
IniRead, IniIsNorecoilOnLBMouse, Settings.ini, Settings, No recoil on LBmouse, 1
IniRead, IniSuspendKey, Settings.ini, Settings, Suspend, F3
IniRead, IniReloadKey, Settings.ini, Settings, Reload, F4
IniRead, IniRecoilInc, Settings.ini, Settings, Recoil increase, F5
IniRead, IniRecoilDec, Settings.ini, Settings, Recoil decrease, F6
IniRead, IniTimingInc, Settings.ini, Settings, Timing increase, F7
IniRead, IniTimingDec, Settings.ini, Settings, Timing decrease, F8
IniRead, IniIncreaseInc, Settings.ini, Settings, Increase increase, F9
IniRead, IniIncreaseDec, Settings.ini, Settings, Increase decrease, F10
IniRead, IniC1RecSize, Settings.ini, NoRecoil, C1 Size, 1
IniRead, IniC1RecTiming, Settings.ini, NoRecoil, C1 Timing, 1
IniRead, IniC1RecIncreaseTiming, Settings.ini, NoRecoil, C1 Increase timing, 100
IniRead, ConfigC1, Settings.ini, Settings, C1, F1
IniRead, IniC2RecSize, Settings.ini, NoRecoil, C2 Size, 1
IniRead, IniC2RecTiming, Settings.ini, NoRecoil, C2 Timing, 1
IniRead, IniC2RecIncreaseTiming, Settings.ini, NoRecoil, C2 Increase timing, 100
IniRead, ConfigC2, Settings.ini, Settings, C2, F1
IniRead, IniC3RecSize, Settings.ini, NoRecoil, C3 Size, 1
IniRead, IniC3RecTiming, Settings.ini, NoRecoil, C3 Timing, 1
IniRead, IniC3RecIncreaseTiming, Settings.ini, NoRecoil, C3 Increase timing, 100
IniRead, ConfigC3, Settings.ini, Settings, C3, F1
IniRead, IniC4RecSize, Settings.ini, NoRecoil, C4 Size, 1
IniRead, IniC4RecTiming, Settings.ini, NoRecoil, C4 Timing, 1
IniRead, IniC4RecIncreaseTiming, Settings.ini, NoRecoil, C4 Increase timing, 100
IniRead, ConfigC4, Settings.ini, Settings, C4, F1

KeyboardKeys := "RButton|MButton|XButton1|XButton2|WheelDown|WheelUp|WheelLeft|WheelRight|ScrollLock|Delete|Insert|Home|End|PgUp|PgDn|Up|Down|Left|Right|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|1|2|3|4|5|6|7|8|9|0|°|+|&|é|'|(|-|è|_|ç|à|)|=|$|ù|*|,|;|:|!|£|%|µ|?|.|/|§|<|>|CapsLock|Space|Tab|Enter|Backspace|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|Numpad0|Numpad1|Numpad2|Numpad3|Numpad4|Numpad5|Numpad6|Numpad7|Numpad8|Numpad9|NumpadIns|NumpadEnd|NumpadDown|NumpadPgDn|NumpadLeft|NumpadClear|NumpadRight|NumpadHome|NumpadUp|NumpadPgUp|NumpadDel|NumLock|NumpadDiv|NumpadMult|NumpadAdd|NumpadSub|NumpadEnter|LWin|RWin|LControl|RControl|LShift|RShift|LAlt|RAlt|Alt|AltGr"

ScriptON := 1
Gui Color, 33cc33
Gui Font, 000000
Gui, Add, Text, x100 y16 w30 h23 +0x200, Recoil
Gui, Add, Edit, r1 Limit2 Number Center x100 y40 w30 vRecSize, %IniC1RecSize%
Gui, Add, Text, x148 y16 w60 h23 +0x200, Timing (ms)
Gui, Add, Edit, r1 Limit2 Number Center x160 y40 w30 vRecTiming, %IniC1RecTiming%
Gui, Add, Text, x220 y16 w70 h23 +0x200, Increase (ms)
Gui, Add, Edit, r1 Limit4 Number Center x220 y40 w30 vRecIncreaseTiming, %IniC1RecIncreaseTiming%
Gui, Font, bold
Gui, Add, Text, x10 y10 w30 h20 +0x200 vScriptON, ON
Gui, Font, norm
Gui, Add, Text, x55 y95 w15 h20 +0x200 +center, #1
Gui, Add, Edit, r1 Limit2 Number Center x80 y95 w30 vC1RecSize, %IniC1RecSize%
Gui, Add, Edit, r1 Limit2 Number Center x120 y95 w30 vC1RecTiming, %IniC1RecTiming%
Gui, Add, Edit, r1 Limit4 Number Center x160 y95 w30 vC1RecIncreaseTiming, %IniC1RecIncreaseTiming%
Gui, Add, ComboBox, x200 y95 w90 vConfigC1, %ConfigC1%||%KeyboardKeys%
Gui, Add, Text, x55 y125 w15 h20 +0x200 +center, #2
Gui, Add, Edit, r1 Limit2 Number Center x80 y125 w30 vC2RecSize, %IniC2RecSize%
Gui, Add, Edit, r1 Limit2 Number Center x120 y125 w30 vC2RecTiming, %IniC2RecTiming%
Gui, Add, Edit, r1 Limit4 Number Center x160 y125 w30 vC2RecIncreaseTiming, %IniC2RecIncreaseTiming%
Gui, Add, ComboBox, x200 y125 w90 vConfigC2, %ConfigC2%||%KeyboardKeys%
Gui, Add, Text, x55 y155 w15 h20 +0x200 +center, #3
Gui, Add, Edit, r1 Limit2 Number Center x80 y155 w30 vC3RecSize, %IniC3RecSize%
Gui, Add, Edit, r1 Limit2 Number Center x120 y155 w30 vC3RecTiming, %IniC3RecTiming%
Gui, Add, Edit, r1 Limit4 Number Center x160 y155 w30 vC3RecIncreaseTiming, %IniC3RecIncreaseTiming%
Gui, Add, ComboBox, x200 y155 w90 vConfigC3, %ConfigC3%||%KeyboardKeys%
Gui, Add, Text, x55 y185 w15 h20 +0x200 +center, #4
Gui, Add, Edit, r1 Limit2 Number Center x80 y185 w30 vC4RecSize, %IniC4RecSize%
Gui, Add, Edit, r1 Limit2 Number Center x120 y185 w30 vC4RecTiming, %IniC4RecTiming%
Gui, Add, Edit, r1 Limit4 Number Center x160 y185 w30 vC4RecIncreaseTiming, %IniC4RecIncreaseTiming%
Gui, Add, ComboBox, x200 y185 w90 vConfigC4, %ConfigC4%||%KeyboardKeys%
Gui, Add, Text, x50 y230 w55 h20 +0x200 +center, Suspend:
Gui, Add, ComboBox, x30 y250 w90 vSuspend, %IniSuspendKey%||%KeyboardKeys%
Gui, Add, Text, x160 y230 w55 h20 +0x200 +center, Reload:
Gui, Add, ComboBox, x140 y250 w90 vReload, %IniReloadKey%||%KeyboardKeys%
Gui, Add, Text, x270 y230 w55 h20 +0x200 +center, No Recoil:
Gui, Add, ComboBox, x250 y250 w90 vRecoil, %IniNorecoilKey%||%KeyboardKeys%
Gui, Add, Text, x50 y280 w55 h20 +0x200 +center, Recoil +/-
Gui, Add, ComboBox, x30 y300 w90 vRecoilInc, %IniRecoilInc%||%KeyboardKeys%
Gui, Add, ComboBox, x30 y320 w90 vRecoilDec, %IniRecoilDec%||%KeyboardKeys%
Gui, Add, Text, x160 y280 w55 h20 +0x200 +center, Timing +/-
Gui, Add, ComboBox, x140 y300 w90 vTimingInc, %IniTimingInc%||%KeyboardKeys%
Gui, Add, ComboBox, x140 y320 w90 vTimingDec, %IniTimingDec%||%KeyboardKeys%
Gui, Add, Text, x270 y280 w65 h20 +0x200 +center, Increase +/-
Gui, Add, ComboBox, x250 y300 w90 vIncreaseInc, %IniIncreaseInc%||%KeyboardKeys%
Gui, Add, ComboBox, x250 y320 w90 vIncreaseDec, %IniIncreaseDec%||%KeyboardKeys%
Gui, Add, CheckBox, x110 y370 w170 vIsNorecoilOnLBMouse Checked%IniIsNorecoilOnLBMouse%, No recoil on left button mouse
Gui, Add, Button, gSaveIni x140 y410, Save
Gui, Add, Button, gLoadIni x195 y410, Reload
Gui Show, w370 h450, RecHelp
Gui, Submit, nohide

Hotkey, %IniSuspendKey%, ~$hkWrite
Hotkey, %IniReloadKey%, LoadIni
Hotkey, %IniNorecoilKey%, DoNoRecoil
Hotkey, %IniRecoilInc%, DoIncreaseRecSize
Hotkey, %IniRecoilDec%, DoDecreaseRecSize
Hotkey, %IniTimingInc%, DoIncreaseTiming
Hotkey, %IniTimingDec%, DoDecreaseTiming
Hotkey, %IniIncreaseInc%, DoIncreaseIncreaseTiming
Hotkey, %IniIncreaseDec%, DoDecreaseIncreaseTiming
Hotkey, %ConfigC1%, Config1
Hotkey, %ConfigC2%, Config2
Hotkey, %ConfigC3%, Config3
Hotkey, %ConfigC4%, Config4

isMouseShown()
{
	StructSize := A_PtrSize + 16
	VarSetCapacity(InfoStruct, StructSize)
	NumPut(StructSize, InfoStruct)
	DllCall("GetCursorInfo", UInt, &InfoStruct)
	Result := NumGet(InfoStruct, 8)

	if Result > 1
		return 1
	else
		return 0
}

DoNoRecoil:
RecInc := 0
SetTimer, RecIncrease, %RecIncreaseTiming%
Loop
	{
		GetKeyState, state, %IniNorecoilKey%, P
		if state=u
		{
			Click, up
			break
		}
		else
		{
			Click, down
			Gui, Submit, nohide		
			mouseXY(0,RecSize+RecInc)
			sleep, RecTiming
		}
	}
return

~*$LButton::
GuiControlGet, IsNorecoilOnLBMouse
If (IsNorecoilOnLBMouse = 1)
{
	if isMouseShown() == 0  ; comment this line to cancel mouse cursor detection
	{
		RecInc := 0
		SetTimer, RecIncrease, %RecIncreaseTiming%
		Loop
		{
			GetKeyState, state, LButton, P
			if state=u
				break

			Gui, Submit, nohide		
			mouseXY(0,RecSize+RecInc)
			sleep, RecTiming
		}
		return
	}
}

RecIncrease:
RecInc++
return

Config1:
GuiControl,, RecSize, %IniC1RecSize%
GuiControl,, RecTiming, %IniC1RecTiming%
GuiControl,, RecIncreaseTiming, %IniC1RecIncreaseTiming%
Gui, Submit, nohide
return
Config2:
GuiControl,, RecSize, %IniC2RecSize%
GuiControl,, RecTiming, %IniC2RecTiming%
GuiControl,, RecIncreaseTiming, %IniC2RecIncreaseTiming%
Gui, Submit, nohide
return
Config3:
GuiControl,, RecSize, %IniC3RecSize%
GuiControl,, RecTiming, %IniC3RecTiming%
GuiControl,, RecIncreaseTiming, %IniC3RecIncreaseTiming%
Gui, Submit, nohide
return
Config4:
GuiControl,, RecSize, %IniC4RecSize%
GuiControl,, RecTiming, %IniC4RecTiming%
GuiControl,, RecIncreaseTiming, %IniC4RecIncreaseTiming%
Gui, Submit, nohide
return

mouseXY(x,y)
{
	DllCall("mouse_event",int,1,int,x,int,y,uint,0,uint,0)
}

DoIncreaseRecSize:
increaseRecSize(RecSize)
return
increaseRecSize(s)
{
	if s <= 98
	{
		s++
		GuiControl,, RecSize, %s%
		Gui, Submit, nohide
	}
	else
		return
}
DoDecreaseRecSize:
decreaseRecSize(RecSize)
return
decreaseRecSize(s)
{
	if s >= 2
	{
		s--
		GuiControl,, RecSize, %s%
		Gui, Submit, nohide
	}
	else
		return
}
DoIncreaseTiming:
increaseTiming(RecTiming)
return
increaseTiming(t)
{
	if t <= 98
	{
		t++
		GuiControl,, RecTiming, %t%
		Gui, Submit, nohide
	}
	else
		return
}
DoDecreaseTiming:
decreaseTiming(RecTiming)
return
decreaseTiming(t)
{
	if t >= 2
	{
		t--
		GuiControl,, RecTiming, %t%
		Gui, Submit, nohide
	}
	else
		return
}
DoIncreaseIncreaseTiming:
increaseIncreaseTiming(RecIncreaseTiming)
return
increaseIncreaseTiming(tm)
{
	if tm <= 9800
	{
		tm+=100
		GuiControl,, RecIncreaseTiming, %tm%
		Gui, Submit, nohide
	}
	else
		return
}
DoDecreaseIncreaseTiming:
decreaseIncreaseTiming(RecIncreaseTiming)
return
decreaseIncreaseTiming(tm)
{
	if tm >= 100
	{
		tm-=100
		GuiControl,, RecIncreaseTiming, %tm%
		Gui, Submit, nohide
	}
	else
		return
}
 
~$hkWrite:
Suspend, Permit
Suspend, Toggle
if A_IsSuspended=1
{
	Gui Color, ad896b
	ScriptON := 0
	GuiControl,, ScriptON, OFF
}
else
{
	Gui Color, 33cc33
	ScriptON := 1
	GuiControl,, ScriptON, ON
}
return

SaveIni:
GuiControlGet, NewSuspend, , Suspend
GuiControlGet, NewReload, , Reload
GuiControlGet, NewNoRecoil, , Recoil
GuiControlGet, NewIsNorecoilOnLBMouse, , IsNorecoilOnLBMouse
GuiControlGet, NewRecoilInc, , RecoilInc
GuiControlGet, NewRecoilDec, , RecoilDec
GuiControlGet, NewTimingInc, , TimingInc
GuiControlGet, NewTimingDec, , TimingDec
GuiControlGet, NewIncreaseInc, , IncreaseInc
GuiControlGet, NewIncreaseDec, , IncreaseDec
GuiControlGet, NewC1RecSize, , C1RecSize
GuiControlGet, NewC1RecTiming, , C1RecTiming
GuiControlGet, NewC1RecIncreaseTiming, , C1RecIncreaseTiming
GuiControlGet, NewC1ConfigHKey, , ConfigC1
GuiControlGet, NewC2RecSize, , C2RecSize
GuiControlGet, NewC2RecTiming, , C2RecTiming
GuiControlGet, NewC2RecIncreaseTiming, , C2RecIncreaseTiming
GuiControlGet, NewC2ConfigHKey, , ConfigC2
GuiControlGet, NewC3RecSize, , C3RecSize
GuiControlGet, NewC3RecTiming, , C3RecTiming
GuiControlGet, NewC3RecIncreaseTiming, , C3RecIncreaseTiming
GuiControlGet, NewC3ConfigHKey, , ConfigC3
GuiControlGet, NewC4RecSize, , C4RecSize
GuiControlGet, NewC4RecTiming, , C4RecTiming
GuiControlGet, NewC4RecIncreaseTiming, , C4RecIncreaseTiming
GuiControlGet, NewC4ConfigHKey, , ConfigC4

IniWrite, %NewSuspend%, Settings.ini, Settings, Suspend
IniWrite, %NewReload%, Settings.ini, Settings, Reload
IniWrite, %NewNoRecoil%, Settings.ini, Settings, No recoil
IniWrite, %NewIsNorecoilOnLBMouse%, Settings.ini, Settings, No recoil on LBmouse
IniWrite, %NewRecoilInc%, Settings.ini, Settings, Recoil increase
IniWrite, %NewRecoilDec%, Settings.ini, Settings, Recoil decrease
IniWrite, %NewTimingInc%, Settings.ini, Settings, Timing increase
IniWrite, %NewTimingDec%, Settings.ini, Settings, Timing decrease
IniWrite, %NewIncreaseInc%, Settings.ini, Settings, Increase increase
IniWrite, %NewIncreaseDec%, Settings.ini, Settings, Increase decrease
IniWrite, %NewC1RecSize%, Settings.ini, NoRecoil, C1 Size
IniWrite, %NewC1RecTiming%, Settings.ini, NoRecoil, C1 Timing
IniWrite, %NewC1RecIncreaseTiming%, Settings.ini, NoRecoil, C1 Increase timing
IniWrite, %NewC1ConfigHKey%, Settings.ini, Settings, C1
IniWrite, %NewC2RecSize%, Settings.ini, NoRecoil, C2 Size
IniWrite, %NewC2RecTiming%, Settings.ini, NoRecoil, C2 Timing
IniWrite, %NewC2RecIncreaseTiming%, Settings.ini, NoRecoil, C2 Increase timing
IniWrite, %NewC2ConfigHKey%, Settings.ini, Settings, C2
IniWrite, %NewC3RecSize%, Settings.ini, NoRecoil, C3 Size
IniWrite, %NewC3RecTiming%, Settings.ini, NoRecoil, C3 Timing
IniWrite, %NewC3RecIncreaseTiming%, Settings.ini, NoRecoil, C3 Increase timing
IniWrite, %NewC3ConfigHKey%, Settings.ini, Settings, C3
IniWrite, %NewC4RecSize%, Settings.ini, NoRecoil, C4 Size
IniWrite, %NewC4RecTiming%, Settings.ini, NoRecoil, C4 Timing
IniWrite, %NewC4RecIncreaseTiming%, Settings.ini, NoRecoil, C4 Increase timing
IniWrite, %NewC4ConfigHKey%, Settings.ini, Settings, C4

msgbox, , , Saved!, 1
return
 
LoadIni:
Reload
return

GuiEscape:
GuiClose:
ExitApp
And this one is with no GUI interface, but I can configure how much is the compensator by pressing + or - .

Code: Select all

 ;     Configuration   
     
   
    #SingleInstance force ;It allows to run only one at the same time.
    SetTitleMatchMode, 2 ;Matching for window title.
    #ifwinactive, PUBG LITE ;Active only when in PUBG.
     
     
    ;    Variables     
     
    isMouseShown() ;To suspend script when mouse is visible.
    ADS = 0 ;Var for fast aiming.
    AutoFire = 1 ;Var for autofiring.
    Compensation = 1 ;Var for compensation when autofiring.
    compVal = 1 ;Compensation value.
     
     
    ;    Suspends if mouse is visible     
     
     
    isMouseShown() ;It suspends the script when mouse is visible (inventory, menu).
    {
      StructSize := A_PtrSize + 16
      VarSetCapacity(InfoStruct, StructSize)
      NumPut(StructSize, InfoStruct)
      DllCall("GetCursorInfo", UInt, &InfoStruct)
      Result := NumGet(InfoStruct, 8)
     
      if Result > 1
        Return 1
      else
        Return 0
    }
    Loop
    {
      if isMouseShown() == 1
        Suspend On
      else
        Suspend Off
        Sleep 1
    }
     
    ;   Fast Aiming     
     
     
    *RButton:: ;Fast Aiming [default: Right Button]
    if ADS = 1
    { ;If active, clicks once and clicks again when button is released.
      SendInput {RButton Down}
      SendInput {RButton Up}
      KeyWait, RButton
      SendInput {RButton Down}
      SendInput {RButton Up}
    } else { ;If not, just keeps holding until button is released.
      SendInput {RButton Down}
      KeyWait, RButton
      SendInput {RButton Up}
    }
    Return
     
     
    ;     AutoFire     
     
     
    ~$*LButton:: ;AutoFire
    if AutoFire = 1
    {
    	Loop
    {
    	GetKeyState, LButton, LButton, P
    	if LButton = U
    		Break
    	MouseClick, Left,,, 1
    	Gosub, RandomSleep ;Call to RandomSleep.
      if Compensation = 1
      {
        mouseXY(0, compVal) ;If active, call to Compensation.
      }
    }
    }
    Return
    RandomSleep: ;Random timing between clicks, just in case.
      Random, random, 14, 25
      Sleep %random%-5
    Return
     
     
    ;     Compensation     
     
     
    mouseXY(x,y) ;Moves the mouse down to compensate recoil (value in compVal var).
    {
      DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0)
    }
     
     
    ;     Tooltips     
     
     
    ToolTip(label) ;Function to show a tooltip when activating, deactivating or changing values.
    {
      ToolTip, %label%, 930, 650 ;Tooltips are shown under crosshair for FullHD monitors.
      SetTimer, RemoveToolTip, 1300 ;Removes tooltip after 1.3 seconds.
      return
      RemoveToolTip:
      SetTimer, RemoveToolTip, Off
      ToolTip
      Return
    }
     
     
    ;     Hotkeys for changing values    
     
     
    ;Toggles
    *NumPad1::(ADS = 0 ? (ADS := 1,ToolTip("ADS ON")) : (ADS := 0,ToolTip("ADS OFF")))
    *NumPad2::(AutoFire = 0 ? (AutoFire := 1,ToolTip("AutoFire ON")) : (AutoFire := 0,ToolTip("AutoFire OFF")))
    *NumPad3::(Compensation = 0 ? (Compensation := 1,ToolTip("Compensation ON")) : (Compensation := 0,ToolTip("Compensation OFF")))
     
    *NumpadAdd:: ;Adds compensation.
      compVal := compVal + 1
      ToolTip("Compensation " . compVal)
    Return
     
    *NumpadSub:: ;Substracts compensation.
    if compVal > 0
    {
      compVal := compVal - 1
      ToolTip("Compensation " . compVal)
    }
    Return
What I really want is: (I know that AC get AHK but I'll make it safe)
•A no recoil macro for PUBG (FPS GAMES) which I can manually configure how much will be compensated by pressing the key + and -. When I been press +/- show a little pop-up saying how much is the compensation.
•Turn on and off key
•I also need it to have two presets. for example, if I press the F1 key on the keyboard, the mouse will pull down with X value that I will define by pressing + and -. Than if I press F2 there will be another preset. So when I use AKM I just press F1 and the recoil will be configured for this weapon. If I pick up another weapon I just press F2 and then I will have this weapon config.
•I need it to work only when the mouse pointer is not active. So when I open a inventory ingame, the mouse will not be pulled down.
•I need a GUI where I can choose any key from the keyboard that I want for turn it on, configure the compensation, choose the preset config.

Anyone know how to do it and help me? Thank you all so much!

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 62 guests