Jump to content

Recommended Posts

Posted (edited)

Hello, I am trying to make my char say "k" but for some reason it don't work.If you look and compare pictures I attached you will see that packets were same, weren't? but I still cant understand what I did wrong.

Game is diablo II

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Dim $Hex,$Str
;==============================================
;==============================================
;CLIENT! Start Me after starting the SERVER!!!!!!!!!!!!!!!
;==============================================
;==============================================

Example()

Func Example()
    ; Set Some reusable info
    ;--------------------------
    Local $ConnectedSocket, $szData
    ; Set $szIPADDRESS to wherever the SERVER is. We will change a PC name into an IP Address
;   Local $szServerPC = @ComputerName
;   Local $szIPADDRESS = TCPNameToIP($szServerPC)
    Local $szIPADDRESS = "213.248.106.48"
    Local $nPORT = 4000

    ; Start The TCP Services
    ;==============================================
    TCPStartup()

    ; Initialize a variable to represent a connection
    ;==============================================
    $ConnectedSocket = -1

    ;Attempt to connect to SERVER at its IP and PORT 33891
    ;=======================================================
    $ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT)

    ; If there is an error... show it
    If @error Then
        MsgBox(4112, "Error", "TCPConnect failed with WSA error: " & @error)
        ; If there is no error loop an inputbox for data
        ;   to send to the SERVER.
    Else
        ;Loop forever asking for data to send to the SERVER
            $Hex = "15 01 00 6B 00 00 00"
            $Str = StringSplit($Hex," ")
$Hex = ''
For $x = 1 to $Str[0]
    If $Str[$x] Then
        $Hex &= Chr((Dec($Str[$x])))
    EndIf
Next
            TCPSend($ConnectedSocket, Binary($hex))

    EndIf
EndFunc   ;==>Example
Edited by E1M1

edited

Posted

I got it, The problem Is It Creates new connection.

The question is: how to use existing connection?

TCPConnect() returns main socket identifier

but how to use an existing main socket identifier?

edited

Posted

You can't attach to an existing connection with all native AutoIt code. As far as I am aware, there are no libraries available for AutoIt to use a existing connection and send packets that way.

Most programs that are able to do this use winpcap.dll, there is no AutoIt UDF available to do this.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...