Class: GoldSrcServer
- Inherits:
-
Object
- Object
- GoldSrcServer
- Includes:
- GameServer
- Defined in:
- lib/steam/servers/goldsrc_server.rb
Overview
This class represents a GoldSrc game server and can be used to query information about and remotely execute commands via RCON on the server
A GoldSrc game server is an instance of the Half-Life Dedicated Server (HLDS) running games using Valve’s GoldSrc engine, like Half-Life Deathmatch, Counter-Strike 1.6 or Team Fortress Classic.
Constant Summary
Constants included from GameServer
GameServer::REQUEST_CHALLENGE, GameServer::REQUEST_INFO, GameServer::REQUEST_PLAYER, GameServer::REQUEST_RULES
Instance Attribute Summary
Attributes included from Server
Instance Method Summary collapse
-
#init_socket ⇒ Object
Initializes the socket to communicate with the GoldSrc server.
-
#initialize(address, port = 27015, is_hltv = false) ⇒ GoldSrcServer
constructor
Creates a new instance of a GoldSrc server object.
-
#rcon_auth(password) ⇒ true
Saves the password for authenticating the RCON communication with the server.
-
#rcon_exec(command) ⇒ String
Remotely executes a command on the server via RCON.
Methods included from GameServer
#handle_response_for_request, #init, #ping, player_status_attributes, #players, #rcon_authenticated?, #rules, #server_info, split_player_status, #to_s, #update_challenge_number, #update_ping, #update_players, #update_rules, #update_server_info
Methods included from Server
Constructor Details
#initialize(address, port = 27015, is_hltv = false) ⇒ GoldSrcServer
Creates a new instance of a GoldSrc server object
31 32 33 34 35 |
# File 'lib/steam/servers/goldsrc_server.rb', line 31 def initialize(address, port = 27015, is_hltv = false) super address, port @is_hltv = is_hltv end |
Instance Method Details
#init_socket ⇒ Object
Initializes the socket to communicate with the GoldSrc server
40 41 42 |
# File 'lib/steam/servers/goldsrc_server.rb', line 40 def init_socket @socket = GoldSrcSocket.new @ip_address, @port, @is_hltv end |
#rcon_auth(password) ⇒ true
Saves the password for authenticating the RCON communication with the server
51 52 53 54 |
# File 'lib/steam/servers/goldsrc_server.rb', line 51 def rcon_auth(password) @rcon_password = password true end |
#rcon_exec(command) ⇒ String
Remotely executes a command on the server via RCON
61 62 63 |
# File 'lib/steam/servers/goldsrc_server.rb', line 61 def rcon_exec(command) @socket.rcon_exec(@rcon_password, command).strip end |