Ok the server script I use is:
; ------------------------------------------
; ------------SERVERSCRIPT------------------
; ---------------v-0.03b--------------------
; -----------KEY CONFIGURATION--------------
khit = {LButton}
kparrydown = {v down}
kparryup = {v up}
karm = {r}
krest = {0}
kmove = {w}
kmenuopen = {RButton}
kmenuclose = {RButton}
kmenuclick = left
; -------CHECK CONFIGURATION SECTION--------
Gosub, IniReadSettings
if (Network_Address = "ERROR" )
{
Gosub, IPPORTGUI
return
}
if (oEmo = "ERROR" OR oHits = "ERROR" OR oShields = "ERROR" OR oHitDelay = "ERROR" OR oRest = "ERROR" OR oProfile = "ERROR" )
{
Gosub, MeleeOptionsGUI
return
}
if (oEmo = "" OR oHits = "" OR oShields = "" OR oHitDelay = "" OR oRest = "" OR oProfile = "" )
{
Gosub, MeleeOptionsGUI
return
}
if (pweapon = "" OR pweapon = "ERROR" OR pshield = "" OR pshield = "ERROR")
{
Gosub, BPSetup
return
}
if (pxu = "ERROR")
{
Gosub, BPSetup
return
}
Main:
Gui, Destroy
Gui, Add, Button, gIPPORTGUI, IP and Port Setup
Gui, Add, Button, gBPSetup, Backpack and Paperdoll Setup
Gui, Add, Button, gItemSearchGUI, Item Search Test
Gui, Add, Button, gKeySetupGUI, Key Setup
Gui, Add, Button, gTeleportGUI, Teleporthack
Gui, Add, Button, gMeleeOptionsGUI, Melee Options
Gui, Add, Button, gMeleeStart, Melee Start
Gui, Add, Button, gAbout, About
Gui, Show
Gosub Connection_Init
return
MeleeStart:
Gui, Submit, NoHide
loop
{
;Gosub, IniReadSettings
weapons = 1
counter = 1
;change = 10
dcast = 5000
darm = 1000
dsmall = 1000
dserver = 200
sleep 3000
loop
{
if(oProfile = 1 OR oProfile = 2)
{
;Hit start
SendText = parry %oHitDelay%
SendData(conectioncheck,SendText)
sleep dserver
send % khit
sleep oHitDelay
sleep 100
;Hit end
}
if(oProfile = 1 OR oProfile = 3 )
{
;Parry start
SendText = hit %oHitDelay%
SendData(conectioncheck,SendText)
dparry := oHitDelay - 400
sleep 500
send % kparrydown
sleep dparry
send % kparryup
;Parry end
}
sleep dserver
if(counter = oHits)
{
;Emo-donkey-mode
loop, % oEmo
{
;Hit start
SendText = hit %oHitDelay%
SendData(conectioncheck,SendText)
sleep dserver
send % khit
sleep oHitDelay
sleep 100
;Hit end
}
sleep 1000
SendText = rest %oRest%
SendData(conectioncheck,SendText)
counter = 0
;rest start
loop, % oRest
{
send % karm
sleep darm
send % krest
sleep dserver
send % khit
}
sleep darm
loop, 3
{
send % kmove
sleep dsmall
}
sleep 2000
;rest stop
send % kmenuopen
sleep 1000
;Weapon Change Start
Gosub, SearchWeaponPaperdoll
sleep 1000
if oShields = 1
Gosub, SearchShieldPaperdoll
sleep 2000
send % kmenuclose
sleep 1000
send % karm
sleep darm
;Weapon Change Stop
sleep 5000
}
counter++
}
}
SentText =
return
; ------------GUI-MISC------------------
Restart:
Reload
return
ItemSearchGUI:
Gui, Destroy
Gui, Add, Text,, Remove your weapon and shield from the paperdoll!
Gui, Add, Text,, Mouse have to be in menu mode, not mouselook mode:
Gui, Add, Text,, Click button 1 ingame to test weapon search and equip paperdoll.
Gui, Add, Text,, Click button 2 ingame to test shield search and equip paperdoll.
Gui, Add, Button, gRestart, Exit
Gui, Show
Loop
{
if GetKeyState("1","P")
{
Gosub, SearchWeaponPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, SearchShieldPaperdoll
}
}
return
MeleeOptionsGUI:
Gui, Destroy
Gui, Add, Text,, Number of hits before going to emo:
Gui, Add, Edit, voHits
Gui, Add, Text,, Number of emo-hits:
Gui, Add, Edit, voEmo
Gui, Add, Text,, Delay between hits, in ms (1 sec = 1000 ms):
Gui, Add, Edit, voHitDelay
Gui, Add, Text,, How many times to rest 1200ms:
Gui, Add, Edit, voRest
Gui, Add, Text,, Check if using shields:
Gui, Add, Checkbox, voShields
Gui, Add, Text,, Profile 1: Server and client hit n parry
Gui, Add, Text,, Profile 2: Server hit only, client parry only
Gui, Add, Text,, Profile 3: Server parry only, client hit only
Gui, Add, Text,, Select a profile:
Gui, Add, DropDownList, voProfile, 1|2|3
Gui, Add, Button, gIniMelee, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return
IniMelee:
Gui, Submit
IniWrite, %oHits%, C:\ahk\config.ini, MeleeOptions, Hits
IniWrite, %oEmo%, C:\ahk\config.ini, MeleeOptions, Emo
IniWrite, %oShields%, C:\ahk\config.ini, MeleeOptions, Shields
IniWrite, %oHitDelay%, C:\ahk\config.ini, MeleeOptions, HitDelay
IniWrite, %oRest%, C:\ahk\config.ini, MeleeOptions, Rest
IniWrite, %oProfile%, C:\ahk\config.ini, MeleeOptions, Profile
Reload
return
KeySetupGUI:
MsgBox Not done yet, will be added in the future.
return
TeleportGUI:
MsgBox HAR! You damn dirty cheating punk! Got ya noob
return
About:
MsgBox Network connection code was made by Zed Gecko @ Autohotkey forum. Thanks!
MsgBox Rest was made by a donkey. Yada yada blah blah... Version 0.03b
return
IPPORTGUI:
Gui, Destroy
Gui, Add, Text,, Please enter your network IP:
Gui, Add, Edit, vIP
Gui, Add, Text,, Please enter your network port:
Gui, Add, Edit, vPort
Gui, Add, Button, gIniIPPort, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return
IniIPPort:
Gui, Submit
IniWrite, %IP%, C:\ahk\config.ini, Network, IP
IniWrite, %Port%, C:\ahk\config.ini, Network, Port
Reload
return
; ------------TrainerSetupHandling------------------
BPSetup:
Gui, Destroy
Gui, Add, Text,, Paperdoll:
Gui, Add, Text,, Push key 1 in upper left above your weapon slots
Gui, Add, Text,, Push key 2 in lower right under your shield slots
Gui, Add, Text,, Backpack:
Gui, Add, Text,, Push key 3 in upper left (inside the wood please) corner of your backpack
Gui, Add, Text,, Push key 4 in lower right (inside the wood please) corner of your backpack
Gui, Add, Text,, Click the backpack, then push key 5 On your weapon and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Text,, Click the backpack, then push key 6 On your shield and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Button, gRestart, Done
Gui, Show
loop
{
if GetKeyState("1","P")
{
Gosub, IniWriteUpperPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, IniWriteLowerPaperdoll
}
else if GetKeyState("3","P")
{
Gosub, IniWriteUpperBackpack
}
else if GetKeyState("4","P")
{
Gosub, IniWriteLowerBackpack
}
else if GetKeyState("5","P")
{
Gosub, IniWriteWeaponPixel
}
else if GetKeyState("6","P")
{
Gosub, IniWriteShieldPixel
}
}
return
IniReadSettings:
IniRead, pweapon, C:\AHK\config.ini, Items, weapon
IniRead, pshield, C:\AHK\config.ini, Items, shield
IniRead, pxu, C:\AHK\config.ini, paperdollCordsUpperLeft, x
IniRead, pyu, C:\AHK\config.ini, paperdollCordsUpperLeft, y
IniRead, pxl, C:\AHK\config.ini, paperdollCordsLowerRight, x
IniRead, pyl, C:\AHK\config.ini, paperdollCordsLowerRight, y
IniRead, bxu, C:\AHK\config.ini, backpackCordsUpperLeft, x
IniRead, byu, C:\AHK\config.ini, backpackCordsUpperLeft, y
IniRead, bxl, C:\AHK\config.ini, backpackCordsLowerRight, x
IniRead, byl, C:\AHK\config.ini, backpackCordsLowerRight, y
IniRead, Network_Address, C:\AHK\config.ini, Network, IP
IniRead, Network_Port, C:\AHK\config.ini, Network, Port
IniRead, oHits, C:\AHK\config.ini, MeleeOptions, Hits
IniRead, oEmo, C:\AHK\config.ini, MeleeOptions, Emo
IniRead, oShields, C:\AHK\config.ini, MeleeOptions, Shields
IniRead, oHitDelay, C:\AHK\config.ini, MeleeOptions, HitDelay
IniRead, oRest, C:\AHK\config.ini, MeleeOptions, Rest
IniRead, oProfile, C:\AHK\config.ini, MeleeOptions, Profile
return
IniWriteUpperPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsUpperLeft, y
return
IniWriteLowerPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsLowerRight, y
return
IniWriteUpperBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsUpperLeft, y
return
IniWriteLowerBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsLowerRight, y
return
; ------------PixelSearchHandlingNEW------------------
IniWriteWeaponPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, weapon
sleep 1000
MouseMove, x, y
return
IniWriteShieldPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, shield
sleep 1000
MouseMove, x, y
return
; ------------ItemSearchHandling------------------
SearchWeaponPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch oX, oY, pxu, pyu, pxl, pyl, pweapon, 1, Fast
if ErrorLevel
Gosub, SearchWeaponBackpack
return
return
SearchShieldPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch, oX, oY, pxu, pyu, pxl, pyl, pshield, 1, Fast
if ErrorLevel
Gosub, SearchShieldBackpack
return
return
SearchWeaponBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pweapon, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return
SearchShieldBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pshield, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return
Menu:
sleep 200
send % kmenuopen
sleep 200
return
; ------------ConnectionHandling------------------
Connection_Init:
OnExit, ExitSub ; For connection cleanup purposes.
socket := PrepareForIncomingConnection(Network_Address, Network_Port)
if socket = -1 ; Connection failed (it already displayed the reason).
ExitApp
Process, Exist ; This sets ErrorLevel to this script's PID (it's done this way to support compiled scripts).
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off
NotificationMsg = 0x5555 ; An arbitrary message number, but should be greater than 0x1000.
OnMessage(NotificationMsg, "ReceiveData")
FD_READ = 1 ; Received when data is available to be read.
FD_CLOSE = 32 ; Received when connection has been closed.
FD_CONNECT = 20 ; Recieved when connection has been made.
if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CLOSE|FD_CONNECT)
{
MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
ExitApp
}
Loop ; Wait for incomming connections
{
conectioncheck := DllCall("Ws2_32\accept", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
if conectioncheck > 1
{
MsgBox Incoming connection accepted
break
}
sleep 500
}
return
PrepareForIncomingConnection(IPAddress, Port)
{
VarSetCapacity(wsaData, 32) ; The struct is only about 14 in size, so 32 is conservative.
result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002)
if ErrorLevel
{
MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
return -1
}
if result ; Non-zero, which means it failed (most Winsock functions return 0 upon success).
{
MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}
AF_INET = 2
SOCK_STREAM = 1
IPPROTO_TCP = 6
socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
if socket = -1
{
MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}
SizeOfSocketAddress = 16
VarSetCapacity(SocketAddress, SizeOfSocketAddress)
InsertInteger(2, SocketAddress, 0, AF_INET) ; sin_family
InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2) ; sin_port
InsertInteger(DllCall("Ws2_32\inet_addr", "Str", IPAddress), SocketAddress, 4, 4) ; sin_addr.s_addr
if DllCall("Ws2_32\bind", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
{
MsgBox % "bind() indicated ---- Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}
if DllCall("Ws2_32\listen", "UInt", socket, "UInt", "SOMAXCONN")
{
MsgBox % "LISTEN() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}
return socket ; Indicate success by returning a valid socket ID rather than -1.
}
ReceiveData(wParam, lParam)
{
global ShowRecieved
socket := wParam
ReceivedDataSize = 4096 ; Large in case a lot of data gets buffered due to delay in processing previous data.
Loop
{
VarSetCapacity(ReceivedData, ReceivedDataSize, 0)
ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
if ReceivedDataLength = 0 ; The connection was gracefully closed,
ExitApp ; The OnExit routine will call WSACleanup() for us.
if ReceivedDataLength = -1
{
WinsockError := DllCall("Ws2_32\WSAGetLastError")
if WinsockError = 10035 ; WSAEWOULDBLOCK, which means "no more data to be read".
return 1
if WinsockError <10054> welcome, strlen(welcome) + 1, NULL);
}
InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
; The caller must ensure that pDest has sufficient capacity. To preserve any existing contents in pDest,
; only pSize number of bytes starting at pOffset are altered in it.
{
Loop %pSize% ; Copy each byte in the integer into the structure as raw binary data.
DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}
ExitSub: ; This subroutine is called automatically when the script exits for any reason.
DllCall("Ws2_32\WSACleanup")
ExitApp