Class: RconCs::Packets::PlayersPacket

Inherits:
Object
  • Object
show all
Defined in:
lib/rcon_cs/packets/players_packet.rb

Overview

Players packet class, provides methods to create and parse Source Query protocol player packets.

Instance Method Summary collapse

Constructor Details

#initializeInfoPacket

Creates a new info packet.



11
12
13
# File 'lib/rcon_cs/packets/players_packet.rb', line 11

def initialize
  @packet = "\xFF\xFF\xFF\xFF\x55"
end

Instance Method Details

#to_sString

Returns the players packet as a string.

Returns:

  • (String)

    the players packet.



18
19
20
# File 'lib/rcon_cs/packets/players_packet.rb', line 18

def to_s
  "#{@packet}\xFF\xFF\xFF\xFF"
end

#with_challenge(challenge) ⇒ Object



22
23
24
25
# File 'lib/rcon_cs/packets/players_packet.rb', line 22

def with_challenge(challenge)
  @packet = "#{@packet}#{challenge.force_encoding("UTF-8")}"
  self
end