Server API Reference
From Hopmod Wiki
Contents |
Game Control Functions
| Name and Parameters | Description |
|---|---|
| pausegame(pause) | Pause or resume game. Argument value must be 1 or 0 |
| changetime(milliseconds) | Change time remaining |
| changemap(map,[mode],[time]) | Change map |
| delbot(cn) | Remove a bot from the game belonging to a player |
Game Control Variables
| Name and Parameters | Description |
|---|---|
| allow_quad = 0 or 1 | Disable quad item for games modes that support quad |
| allow_healthboost = 0 or 1 | Disable healthboost item for games modes that support quad |
| botlimit = between 0 and 32 | Set the maximum number of bots |
| botbalance = 0 or 1 | (what does this do?) |
Game State Variables
| Name and Parameters | Description |
|---|---|
| map | |
| gamemode | |
| timeleft | Value in minutes. |
| gamemillis | Milliseconds elapsed since the game started. |
| gamelimit | Length of the game set in milliseconds. Warning: this value can change if the game time is changed with changetime(). |
| playercount | |
| speccount | |
| botcount | |
| next_mode | Set next game mode (usually set from "setnextgame" event handler) |
| next_map | Set next map name (usually set from "setnextgame" event handler) |
| reassignteams = 0 or 1 | Reshuffle teams at the beginning of each game |
Server Functions
| Name and Parameters | Description |
|---|---|
| restart() | Restart server process at end of the game or immediately if the server is empty. |
| restart_now() | Restart server now |
| shutdown() | Shut down server process (which will also terminate the irc bot process) |
| reloadscripts() | Reload all the scripts without restarting the server |
| msg(text) | Broadcast message on server |
| clearbans() | Clear all temporary bans |
| loadbanlist(filename) | |
| writebanlist(filename) | |
| permban(ip) | |
| unsetban(ip) | |
| recorddemo(filename) | Immediately start recording the game (no server message is broadcast) |
| stopdemo() | Stop recording game |
Server State Variables
| Name and Parameters | Description |
|---|---|
| servername | Name as seen in the description column in the client's server browser. |
| serverip | Writable at initialization, read only when and after "started" event is dispatched. |
| serverport | Writable at initialization, read only when and after "started" event is dispatched. |
| uptime | Value in milliseconds |
| masterserver | Hostname of the master server |
| updatemaster = 0 or 1 | Useful for preventing server from being registered and appearing on the public server list |
| maxplayers | |
| admin_password | Password required for player to gain admin status |
| server_password | Password required for player to gain entry to server |
| allow_mm_veto = 0 or 1 | Permit master players to switch to veto mode |
| allow_mm_locked = 0 or 1 | Permit master players to switch to locked mode |
| allow_mm_private = 0 or 1 | Permit master players to switch to private mode |
| mastermode |
General Utility Functions
| Name and Parameters | Description |
|---|---|
| ip_to_country(ip) | Resolve IP address to country |
| ip_to_country_code(ip | Resolve IP address to a two letter country code |
| load_geoip_database(filename) | Resolve ip address to a two letter country code |
| gethostbyname(name) | Resolve FQDN to IP address. |
