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, iw5mp.dat, 0.1
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID != 1
{
MsgBox Could not find Modern Warfare 3!
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}
sleep 275
MouseClick,left
send {LAlt Up}
send {LAlt Down}
send {LAlt Up}
}
else
{
MouseClick,middle
}
}
this is the one I use since mw2 (I changed it to mw3). the QS part is virtually identical