Jump to content
Sign in to follow this  

Autoitv3 UDP sockets

Recommended Posts


Possible to create an autoit script what do an UDP query?

I want to get from a multiplayer server, the players name.. i know how to do it in php, but i now want it to my Autoit script's GUI..

PHP Source is:


function query_source($address)


    $array = explode(":", $address); //explode the adress at :

    $server['status'] = 0; //status variable

    $server['ip']     = $array[0]; //server ip variable

    $server['port']   = $array[1]; //server port variable

    if (!$server['ip'] || !$server['port']) { exit("EMPTY OR INVALID ADDRESS"); }

    $socket = @fsockopen("udp://{$server['ip']}", $server['port'], $errno, $errstr, 1);

    if (!$socket) { return $server; }

    stream_set_timeout($socket, 1);

    stream_set_blocking($socket, TRUE);

    fwrite($socket, "\xFF\xFF\xFF\xFF\x54Source Engine Query\x00");

    $packet = fread($socket, 4096);


    if (!$packet) { return $server; }

    $header                = substr($packet, 0, 4);

    $response_type         = substr($packet, 4, 1);

    $network_version       = ord(substr($packet, 5, 1));

    $packet_array          = explode("\x00", substr($packet, 6), 5);

    $server['name']        = $packet_array[0];

    $server['map']         = $packet_array[1];

    $server['game']        = $packet_array[2];

    $server['description'] = $packet_array[3];

    $packet                = $packet_array[4];

    $app_id                = array_pop(unpack("S", substr($packet, 0, 2)));

    $server['players']     = ord(substr($packet, 2, 1));

    $server['playersmax']  = ord(substr($packet, 3, 1));

    $server['bots']        = ord(substr($packet, 4, 1));

    $server['status']      = 1;

    $server['dedicated']   =     substr($packet, 5, 1);  

    $server['os']          =     substr($packet, 6, 1);  

    $server['password']    = ord(substr($packet, 7, 1));  

    $server['vac']         = ord(substr($packet, 8, 1));  

    return $server;


$query = query_source("");

echo "hostname:";  

echo $query['name'];  

echo "<br/>players:";  

echo $query['players'];  

echo "<br/>playersmax:";  

echo $query['playersmax'];  

echo "<br/>vac(?):";  

echo $query['vac'];  

echo "<br/>passowrd(?):";  

echo $query['password'];  


Share this post

Link to post
Share on other sites



I want to get from a multiplayer server, the players name

You appear not to have read the Forum rules since your arrival here. Please do so now (there is also a link at bottom right of each page) - particularly the bit about not discussing script interaction with games or game servers - and then you will understand why you will get no help and this thread will now be locked. :naughty:


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...