Code:
CrosshairAdjust = 11
Process, wait, iw5mp.exe, 0.1
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
{
Process, wait, iw4mp.dat, 0.1
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID != 1
{
MsgBox Could not find Modern Warfare 2!
ExitApp
}
}
WinActivate, ahk_pid %NewPID%
WinGetPos,,,ModW, ModH, ahk_pid %NewPID%
NewX := (A_ScreenWidth / 2) - (ModW / 2)
NewY := (A_ScreenHeight / 2 - 11) - (ModH / 2)
WinMove, ahk_pid %NewPID%,, %NewX%, %NewY%
WinGetPos,,,ModW, ModH, ahk_pid %NewPID%
#SingleInstance force
#Persistent
OnExit, ExitRoutine
xpos := A_ScreenWidth/2
ypos := A_ScreenHeight/2
hDrwArea := DllCall("GetDC", "uint", Null)
SetTimer, SetPixel, 1
SetPixel:
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 1, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 1, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 1, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 1, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 2, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 2, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 3, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 3, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 2, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 2, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 3, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 3, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 4, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 4, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 4, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 4, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 5, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 5, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 5, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 5, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 6, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 6, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 6, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 6, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 7, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 7, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 7, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 7, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 8, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 8, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 8, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 8, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 9, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 9, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 9, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 9, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos - 10, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos, "int", ypos + 10, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos - 10, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
DllCall("SetPixel", "uint", hDrwArea, "int", xpos + 10, "int", ypos, "uint", 255, "uint", 0, "uint", 0)
Return
ExitRoutine:
DllCall("ReleaseDC", UInt, 0, UInt, hDrwArea)
DllCall("FreeLibrary", "UInt", hDrwArea)
ExitApp
~NumLock::Suspend, toggle
$Mbutton::
{
GetKeyState, state, Mbutton, T
if state = D
{
send {LAlt Down}
send {LShift Down}
sleep 275
MouseClick,left
send {LAlt Up}
send {LAlt Down}
send {LAlt Up}
send {LShift Up}
}
else
{
MouseClick,middle
}
}
this is the one from mw2 changed to work with mw3..with xhair plus I think everything under 270ms doesn't register or work or whatever...but 275 seems to be ok with sleight of hand and quickdraw for both msr and barret..I didn't write it just changed timing and the exe !