An open API service indexing awesome lists of open source software.

https://github.com/jpalumickas/csstats

Ruby gem which handle csstats.dat file generated by CSX module in AMX Mod X.
https://github.com/jpalumickas/csstats

amxx counter-strike csstats csx ruby

Last synced: about 1 year ago
JSON representation

Ruby gem which handle csstats.dat file generated by CSX module in AMX Mod X.

Awesome Lists containing this project

README

          

# CSstats

Gem which handle `csstats.dat` file generated by CSX module
in AMX Mod X ([https://www.amxmodx.org][amxx])

[![Gem Version](https://img.shields.io/gem/v/csstats.svg?style=flat-square)][rubygems]
[![Coverage Status](https://img.shields.io/codecov/c/github/jpalumickas/csstats?style=flat-square)][codecov]

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'csstats'
```

## Usage

```ruby
require 'csstats'

stats = CSstats.new(path: 'csstats.dat')
stats.players.find(2).nick
```

You can set `max_players` option if you need to get specified number of players.

```ruby
stats = CSstats.new(path: 'csstats.dat', max_players: 15)
stats.players.count
# => 15
```

You can get player information by specified name.

```ruby
stats = CSstats.new(path: 'csstats.dat')
player_stats = stats.players.find_by(nick: 'my-super-nick')

puts player_stats.kills
# => 3
```

## Supported Ruby Versions

This library aims to support and is [tested against][github_actions] the following Ruby
implementations:

* Ruby 2.4.0
* Ruby 2.5.0
* Ruby 2.6.0

## Copyright
Copyright (c) 2013-2019 Justas Palumickas.
See [LICENSE][license] for details.

[rubygems]: https://rubygems.org/gems/csstats
[codecov]: https://codecov.io/gh/jpalumickas/csstats
[github_actions]: https://github.com/jpalumickas/csstats/actions

[amxx]: https://www.amxmodx.org
[license]: https://raw.githubusercontent.com/jpalumickas/csstats/master/LICENSE