Skip to content

Commit

Permalink
Format docs (way too long lines)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdnk committed Jul 5, 2022
1 parent 8eb2456 commit 62bb039
Show file tree
Hide file tree
Showing 9 changed files with 310 additions and 106 deletions.
34 changes: 24 additions & 10 deletions documentation/docs/commands.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Commands
Generally admin commands will have a `get5_` prefix and must be used in console. Commands intended for general player usage are created with `sm_` prefixes, which means sourcemod automtically registers a `!` chat version of the command. (For example: sm_ready in console is equivalent to !ready in chat)

Some client commands are available also for admin usage. For example, `sm_pause` and `sm_unpause` will force pauses if executed by the server (e.g., through `rcon`).
Generally admin commands will have a `get5_` prefix and must be used in console. Commands intended for general player
usage are created with `sm_` prefixes, which means SourceMod automatically registers a `!` chat version of the
command. (For example: `sm_ready` in console is equivalent to `!ready` in chat).

Some client commands are available also for admin usage. For example, `sm_pause` and `sm_unpause` will force pauses if
executed by the server (e.g., through `rcon`).

## Client Commands

## Client Commands
Please note that these can be typed by *all players* in chat.

- `!ready`: Marks a client's team as ready to begin.
Expand All @@ -17,18 +22,25 @@ Please note that these can be typed by *all players* in chat.
- `!switch`: Same as `!swap`.
- `!stop`: Asks to reload the last match backup file, requires other team to confirm.
- `!forceready`: Force readies your team, letting your team start regardless of player numbers/whether they are ready.
- `!get5`: Opens a menu that wraps some common commands. It's mostly intended for people using scrim settings, and has menu buttons for starting a scrim, force-starting, force-ending, adding a ringer, and loading the most recent backup file.
- `!get5`: Opens a menu that wraps some common commands. It's mostly intended for people using scrim settings, and has
menu buttons for starting a scrim, force-starting, force-ending, adding a ringer, and loading the most recent backup
file.

## Server/Admin Commands

## Server/Admin Commands
Please note that these are meant to be used by *admins* in console.

- `get5_loadmatch <filename>`: Loads a match config file (JSON or KeyValue) relative from the `csgo` directory.
- `get5_loadbackup <file>`: Loads a get5 backup file relative from the `csgo` directory.
- `get5_loadteam <team1|team2|spec> <filename>`: Loads a team section from a file into a team relative from the `csgo` directory.
- `get5_loadmatch_url <url>`: Loads a remote (JSON formatted) match config by sending a HTTP(S) GET to the given url, this requires the [Steamworks](https://forums.alliedmods.net/showthread.php?t=229556) extension. When specifying an URL with http:// or https:// in front, you have to put it in quotation (`""`) marks.
- `get5_loadteam <team1|team2|spec> <filename>`: Loads a team section from a file into a team relative from the `csgo`
directory.
- `get5_loadmatch_url <url>`: Loads a remote (JSON formatted) match config by sending a HTTP(S) GET to the given url,
this requires the [Steamworks](https://forums.alliedmods.net/showthread.php?t=229556) extension. When specifying an
URL with http:// or https:// in front, you have to put it in quotation (`""`) marks.
- `get5_endmatch`: Force ends the current match.
- `get5_creatematch`: Creates a BO1 match with the current players on the server on the current map.
- `get5_scrim`: Creates a BO1 match with the using settings from `addons/sourcemod/configs/get5/scrim_template.cfg`, relative from the `csgo` directory.
- `get5_scrim`: Creates a BO1 match with the using settings from `addons/sourcemod/configs/get5/scrim_template.cfg`,
relative from the `csgo` directory.
- `get5_addplayer <auth> <team1|team2|spec> [name]`: Adds a Steam ID to a team (can be any format for the Steam ID).
- `get5_removeplayer <auth>`: Removes a steamid from all teams (can be any format for the Steam ID).
- `get5_addkickedplayer <team1|team2|spec> [name]`: Adds the last kicked Steam ID to a team
Expand All @@ -40,5 +52,7 @@ Please note that these are meant to be used by *admins* in console.
- `get5_listbackups <matchid>`: Lists backup files for the current matchid or a given matchid if not provided.
- `get5_ringer <player>`: Adds/removes a ringer to/from the home scrim team.
- `sm_ringer <player>`: Same as `get5_ringer`.
- `get5_debuginfo <file>`: Dumps debug info to a file (addons/sourcemod/logs/get5_debuginfo.txt by default, if no file provided).
- `get5_test`: Runs get5 tests. **This should not be used on a live match server since it will reload a match config to test**.
- `get5_debuginfo <file>`: Dumps debug info to a file (`addons/sourcemod/logs/get5_debuginfo.txt` by default, if no file
provided).
- `get5_test`: Runs get5 tests. **This should not be used on a live match server since it will reload a match config to
test**.
42 changes: 29 additions & 13 deletions documentation/docs/developer_api.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# API for developers

Get5 can be interacted with in several ways. At a glance:

1) You can write another sourcemod plugin that uses the [Get5 natives and forwards](https://github.com/splewis/get5/blob/master/scripting/include/get5.inc). This is exactly what the [get5_apistats](https://github.com/splewis/get5/blob/master/scripting/get5_apistats.sp) and [get5_mysqlstats](https://github.com/splewis/get5/blob/master/get5_mysqlstats.sp) plugins do. Please use these as a general guide/starting point, don't fork this repository to make changes to these plugins alone, but use these as a template and create a new repository for your plugin!
1) You can write another SourceMod plugin that uses
the [Get5 natives and forwards](https://github.com/splewis/get5/blob/master/scripting/include/get5.inc). This is
exactly what the [get5_apistats](https://github.com/splewis/get5/blob/master/scripting/get5_apistats.sp)
and [get5_mysqlstats](https://github.com/splewis/get5/blob/master/get5_mysqlstats.sp) plugins do. Please use these as
a general guide/starting point, don't fork this repository to make changes to these plugins alone, but use these as a
template and create a new repository for your plugin!

2) You can read [event logs](./event_logs.md) from a file on disk (set by [`get5_event_log_format`](./get5_configuration.md#file-name-formatting)), through a RCON connection to the server console since they are output there, or through another sourcemod plugin (see #1).
2) You can read [event logs](./event_logs.md) from a file on disk (set
by [`get5_event_log_format`](./get5_configuration.md#file-name-formatting)), through a RCON connection to the server
console since they are output there, or through another SourceMod plugin (see #1).

3) You can read the [stats](./stats_system.md) get5 collects from a file on disk (set by [`get5_stats_path_format`](./get5_configuration.md#file-name-formatting)), or through another sourcemod plugin (see #1).
3) You can read the [stats](./stats_system.md) get5 collects from a file on disk (set
by [`get5_stats_path_format`](./get5_configuration.md#file-name-formatting)), or through another SourceMod plugin (
see #1).

4) You can execute the `get5_loadmatch` command or `get5_loadmatch_url` commands via another plugin or via a RCON connection to begin matches. Of course, you could execute any get5 command you want as well.
4) You can execute the `get5_loadmatch` command or `get5_loadmatch_url` commands via another plugin or via a RCON
connection to begin matches. Of course, you could execute any get5 command you want as well.

## Status Schema

The following is the `get_status` response's schema.

### Static

- `plugin_version`: Get5's version number.
- `commit`: Only here if `COMMIT_STRING` is defined (probably not your case).
- `gamestate`: A number representing the game's state.
Expand All @@ -38,21 +51,24 @@ The following is the `get_status` response's schema.
- `"postgame"`

#### Additional Parts

*If the current game state is not "none"*:

- `matchid`: The current match's id. You can set it in match configs, with the property which has the same name.
- `loaded_config_file`: The name of the loaded config file. If you used `get5_loadmatch <file>`, it's this file's name. If you used `get5_loadmatch_url`, the pattern of the file is `remote_config%d.json`, where `%d` is the server's id, which you can set with `get5_server_id`.
- `loaded_config_file`: The name of the loaded config file. If you used `get5_loadmatch <file>`, it's this file's name.
If you used `get5_loadmatch_url`, the pattern of the file is `remote_config%d.json`, where `%d` is the server's id,
which you can set with `get5_server_id`.
- `map_number`: The current map number in the series.
- `team1` and `team2`: Two JSON objects which share the same properties.
- `name`: Name of the team.
- `series_score`: The score in the series.
- `ready`: Boolean indicating if the team is ready.
- `side`: The side on which the team is. Can be `"CT"`, `"T"`, or `"none"`.
- `connected_clients`: The number of human clients connected on the team.
- `current_map_score`: The team's score on the current map.
- `name`: Name of the team.
- `series_score`: The score in the series.
- `ready`: Boolean indicating if the team is ready.
- `side`: The side on which the team is. Can be `"CT"`, `"T"`, or `"none"`.
- `connected_clients`: The number of human clients connected on the team.
- `current_map_score`: The team's score on the current map.

*If the current game state is past the veto stage*

- `maps`: A JSON Object which contains one property per map.
- Key: `"map%d"` where `%d` is the map index in the array.
- Value: The name of the map (taken from the [match config](./match_configuration.md)).
- Key: `"map%d"` where `%d` is the map index in the array.
- Value: The name of the map (taken from the [match config](./match_configuration.md)).
49 changes: 33 additions & 16 deletions documentation/docs/event_logs.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# Event Logs
Get5 contains an event-logging system that logs many client actions and what is happening in the game. These supplement the logs CS:GO does on its own, but adds additional information about the ongoing match.

Get5 contains an event-logging system that logs many client actions and what is happening in the game. These supplement
the logs CS:GO does on its own, but adds additional information about the ongoing match.

An `event` is a json object that looks something like this:

```json
{
"matchid": "1",
"event": "series_start",
"params": {
"team1_name": "EnvyUs",
"team2_name": "Fnatic"
}
"matchid": "1",
"event": "series_start",
"params": {
"team1_name": "EnvyUs",
"team2_name": "Fnatic"
}
}
```

Events will have variable parameters depending on what type of event it is. In the example, we see the event name is "series_start". All events include the "matchid" field and have a name under `event`.
Events will have variable parameters depending on what type of event it is. In the example, we see the event name is "
series_start". All events include the "matchid" field and have a name under `event`.

## Interfacing With Events
From a plugin, you can use the `void Get5_OnEvent(const char[] eventJson)` forward to do anything you like with Get5 events.
You can also use the builtin server `logaddress_add` command to add a server `ip:port` that is listening to the game server log and reading events (it could also read plain CS:GO server log lines - this is what [eBot](https://github.com/deStrO/eBot-CSGO) does).

Finally, event can be logged to a file by settting the [`get5_event_log_format`](./get5_configuration.md#file-name-formatting) cvar. The file will look something like this:
From a plugin, you can use the `void Get5_OnEvent(const char[] eventJson)` forward to do anything you like with Get5
events.
You can also use the builtin server `logaddress_add` command to add a server `ip:port` that is listening to the game
server log and reading events (it could also read plain CS:GO server log lines - this is
what [eBot](https://github.com/deStrO/eBot-CSGO) does).

Finally, event can be logged to a file by settting
the [`get5_event_log_format`](./get5_configuration.md#file-name-formatting) cvar. The file will look something like
this:

```log
L 11/26/2016 - 02:58:39: {
"matchid": "example_match",
Expand All @@ -30,19 +41,23 @@ L 11/26/2016 - 02:58:39: {
}
}
```
You'd have to do some processing to handle parsing the logging timestamp before each json event, but it isn't very hard (a simple regex replacement would be fine).

You'd have to do some processing to handle parsing the logging timestamp before each json event, but it isn't very
hard (a simple regex replacement would be fine).

## List of Events and Their Params

Some rules are followed in these settings:

1. `Winner` is a match team, i.e. `team1` or `team2`
2. `team` is a match team, i.e. `team1` or `team2`
3. `side` is a CS team, i.e. `CT` or `T`
4. `map_number` is 0-indexed
5. `client` fields (`client`, `attacker`, `victim`, etc.) will use `%L` sourcemod formatting
5. `client` fields (`client`, `attacker`, `victim`, etc.) will use `%L` SourceMod formatting
6. `site` is `"A"` or `"B"`

### Series Flow

*The events listed below are rather self-documenting in a sense as to when they will be called.*.

- `series_start`:
Expand Down Expand Up @@ -88,7 +103,8 @@ Some rules are followed in these settings:
- `winner`: Either `"team1"`, `"team2"`.
- `team1_score`: The current score for `team1`.
- `team2_score`: The current score for `team2`.
- `reason`: The number that represents the [CSRoundEndReason](https://sm.alliedmods.net/new-api/cstrike/CSRoundEndReason)
- `reason`: The number that represents
the [CSRoundEndReason](https://sm.alliedmods.net/new-api/cstrike/CSRoundEndReason)
- `side_swap`:
- `map_name`: The name of the map being vetoed.
- `map_number`: The current map number.
Expand All @@ -113,6 +129,7 @@ Some rules are followed in these settings:
- `map_number`: The current map number.

### Client Actions

- `player_death`:
- `map_name`: The name of the map being vetoed.
- `map_number`: The current map number.
Expand Down Expand Up @@ -157,7 +174,7 @@ Some rules are followed in these settings:
- `match_config_load_fail`:
- `reason`: Reason as to why the match configuration failed to load.
- `backup_loaded`:
`file`: Location of the backup.
`file`: Location of the backup.
- `team_ready`
- `team`: Either `"team1"`, `"team2"`, or `"spec"` if spectators are required to ready.
- `stage`: one of `"veto"`, `"backup_restore"`, `"knife"`, or `"start"`
- `stage`: one of `"veto"`, `"backup_restore"`, `"knife"`, or `"start"`
Loading

0 comments on commit 62bb039

Please sign in to comment.