public function test_steamid64_to_steamid() { $this->assertEquals('STEAM_0:0:25795358', steamid64_to_steamid('76561198011856444')); $this->assertEquals('STEAM_0:1:66086313', steamid64_to_steamid('76561198092438355')); $this->assertEquals('STEAM_0:1:15354461', steamid64_to_steamid('76561197990974651')); $this->assertEquals('STEAM_0:1:55249120', steamid64_to_steamid('76561198070763969')); $this->assertEquals('STEAM_0:0:77458258', steamid64_to_steamid('76561198115182244')); }
/** * Получение списка игроков на сервере */ function get_players() { $this->CI->load->helper('games'); $return = array(); if ($result = $this->command('status')) { $return = array(); // id name ping connected addr // 76561198041740340 "ACE ;j" 125 2919s 176.51.201.18 // 76561198042221933 "RK" 78 869s 176.51.246.210 $pattern = '!\\s*(\\d*)\\s*\\"(.*?)\\"\\s*\\d*\\s*(\\d*s)\\s*([0-9\\.]*)!si'; $matches = get_matches($pattern, $result); $count = count($matches); $a = 0; while ($a < $count) { $return[] = array('user_name' => htmlspecialchars($matches[$a]['2']), 'user_id' => $matches[$a]['1'], 'steam_id' => steamid64_to_steamid($matches[$a]['1']), 'user_ip' => $matches[$a]['4'], 'user_time' => $matches[$a]['3']); $a++; } } return $return; }