Есть функция отправки пакетов в игре, нужно поставить задержку в отправке ,как это сделать?
Код:
Func sendpacket($packet, $packetsizeold, $pid)
Local $packetsize = Int(StringLen($packet) / 2), $premotethread, $vbuffer, $loop, $result, $opcode, $processhandle = $dllh[1], $functionaddress, $packetaddress
ConsoleWrite("Packet [" & $packetsize & "]: " & $packet & @CRLF)
$functionaddress = DllCall($kernel32, "int", "VirtualAllocEx", "int", $processhandle, "ptr", 0, "int", 70, "int", 4096, "int", 64)
$packetaddress = DllCall($kernel32, "int", "VirtualAllocEx", "int", $processhandle, "ptr", 0, "int", $packetsize, "int", 4096, "int", 64)
$opcode &= "60"
$opcode &= "B8" & _hex($sendpacketfunction)
$opcode &= "8B0D" & _hex($realbase)
$opcode &= "8B4920"
$opcode &= "BF" & _hex($packetaddress[0])
$opcode &= "6A" & _hex($packetsize, 2)
$opcode &= "57"
$opcode &= "FFD0"
$opcode &= "61"
$opcode &= "C3"
$vbuffer = DllStructCreate("byte[" & StringLen($opcode) / 2 & "]")
For $loop = 1 To DllStructGetSize($vbuffer)
DllStructSetData($vbuffer, 1, Dec(StringMid($opcode, ($loop - 1) * 2 + 1, 2)), $loop)
Next
DllCall($kernel32, "int", "WriteProcessMemory", "int", $processhandle, "int", $functionaddress[0], "int", DllStructGetPtr($vbuffer), "int", DllStructGetSize($vbuffer), "int", 0)
$vbuffer = DllStructCreate("byte[" & $packetsize & "]")
For $loop = 1 To DllStructGetSize($vbuffer)
DllStructSetData($vbuffer, 1, Dec(StringMid($packet, ($loop - 1) * 2 + 1, 2)), $loop)
Next
DllCall($kernel32, "int", "WriteProcessMemory", "int", $processhandle, "int", $packetaddress[0], "int", DllStructGetPtr($vbuffer), "int", DllStructGetSize($vbuffer), "int", 0)
$hremotethread = DllCall($kernel32, "int", "CreateRemoteThread", "int", $processhandle, "int", 0, "int", 0, "int", $functionaddress[0], "ptr", 0, "int", 0, "int", 0)
Do
$result = DllCall($kernel32, "int", "WaitForSingleObject", "int", $hremotethread[0], "int", 50)
Until $result[0] <> 258
DllCall($kernel32, "int", "CloseHandle", "int", $hremotethread[0])
DllCall($kernel32, "ptr", "VirtualFreeEx", "hwnd", $processhandle, "int", $functionaddress[0], "int", 0, "int", 32768)
DllCall($kernel32, "ptr", "VirtualFreeEx", "hwnd", $processhandle, "int", $packetaddress[0], "int", 0, "int", 32768)
Return True
EndFunc
Func _hex($value, $size = 8, $rv = 0)
Local $tmp1, $tmp2, $i
$tmp1 = StringRight("000000000" & Hex($value), $size)
For $i = 0 To StringLen($tmp1) / 2 - 1
$tmp2 = $tmp2 & StringMid($tmp1, StringLen($tmp1) - 1 - 2 * $i, 2)
Next
Return $tmp2
EndFunc