ReMoTe04 Posted May 27, 2014 Share Posted May 27, 2014 Hello! 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: expandcollapse popup<?php 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); @fclose($socket); 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("193.38.128.75:27342"); 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']; ?> Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2014 Moderators Share Posted May 27, 2014 ReMoTe04, I want to get from a multiplayer server, the players nameYou 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. M23 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts