Games

API Documentation

\GSPPanel\Games

This class allows interaction with gameservers

Methods

AddGame(array $params) : array

Adds a game to the database

$params requires the following:

  • gamename: The name of the game(REQUIRED)
  • files_path: The folder for the game files(REQUIRED)
  • linux_enable: 0/1 to enable for linux servers
  • linux_startmode: The startmode for linux(Required of linux_enable is 1)
  • linux_installtype: The type of installation to do for user game files(folder, zip, tar, tar.gz)
  • linux_logfile: The linux log file to display in the web console
  • windows_enable: 0/1 to enable for windows servers
  • windows_startmode: The startmode for windows
  • windows_exec: The startmode for windows(Required of windows_enable is 1)
  • windows_installtype: The type of installation to do for user game files(folder, zip)
  • windows_workingpath: The relative path to run the executable from (only some games require this)
  • windows_logfile: The windows log file to display in the web console
  • port_increment: Integer to increment the port count by for new servers
  • port_default: The game's default port
  • port_querydefault: The game's default query port(0 to disable)
  • port_rcondefault: The game's default rcon port(0 to disable)
  • port_custom1: The game's custom port(0 to disable)
  • port_custom2: The game's custom port(0 to disable)
  • port_custom3: The game's custom port(0 to disable)
  • port_custom4: The game's custom port(0 to disable)
  • reinstall_enable: 0/1 to allow users to reinstall the gameserver
  • ftp: 0/1 to enable the ftp server for this game
  • windows_console: 0/1 to enable the console logging in windows for this game
  • querycode: The GameQ query code for this game
  • maxslots: Array for the maxslots variable(value, control, name)
  • configoptions: Array of configurable options(option, name, control, fieldtype, order)
  • servermon: 0/1 to enable server monitor actions for this game
  • graphs: 0/1 to enable slot and uptime graphs for this game
  • redirectfolder: A folder for the FTP to redirect users to
  • alertdiskusage: The size in bytes the user is allowed to use on the disk
  • fastdl: 0/1 to enable Fast Download option for this game
  • fastdlurl: The path to append to the URL for Fast Download
  • fastdlallowed: Extensions that are allowed to be downloaded
  • fastdlexclude: Files that are not allowed to be downloaded(wildcard accepted)
  • rconprotocol: The protocol required for rcon commands
  • backups: 0/1 to enable game server backups for this game
  • backupclientaccess: Client permissions for backups (0 none, 1 backup, 2 backup and restore)
  • backuplimit: The number of backups that can be stored per game server
  • servermon_offline_1: Action to take if offline once
  • servermon_offline_2: Action to take if offline twice
  • servermon_offline_3: Action to take if offline three times
  • servermon_private_1: Action to take if not private once
  • servermon_private_2: Action to take if not private twice
  • servermon_private_3: Action to take if not private three times
  • servermon_slots_1: Action to take if slots exceeded once
  • servermon_slots_2: Action to take if slots exceeded twice
  • servermon_slots_3: Action to take if slots exceeded three times
  • servermon_cpulimit: CPU Limit Percentage (0-100)
  • servermon_cpu_1: Action to take if CPU exceeded once
  • servermon_cpu_2: Action to take if CPU exceeded twice
  • servermon_cpu_3: Action to take if CPU exceeded three times
  • servermon_ramlimit: RAM Limit Percentage (0-100)
  • servermon_ram_1: Action to take if RAM exceeded once
  • servermon_ram_2: Action to take if RAM exceeded twice
  • servermon_ram_3: Action to take if RAM exceeded three times
  • database_allowed: 0/1 Allow databases to be created for this game
  • database_autocreate: 0/1 Automatically create a database for this game
  • database_adminurl: URL to phpMyAdmin or a similar tool for clients to access
  • database_limit: The number of databases that can be created for a game server

Returns one of the following in an array format:

  • error
    • -1 - Required parameter empty
    • -2 - No linux startmode
    • -3 - No windows executable
    • -4 - No OS selected
    • 0 - Added successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
AddGameAddon(array $params) : array

Adds a game addon

$params uses the following:

  • gid: The games id (REQUIRED)
  • name: The updates name(REQUIRED)
  • copyfolder: 1 to copy folders, otherwise 0
  • windows_path: The windows path to copy
  • linux_path: The linux path to copy
  • systemcommands: 1 to run system commands, otherwise 0
  • windows_command: Windows commands(batch)
  • linux_command: Linux commands(bash)
  • userinstall: 1 to allow the user to install, otherwise 0
  • message: Message to be displayed after installed
  • description: Description of addon
  • restart: 1 to restart after install, otherwise 0

Returns one of the following in an array format:

  • error
    • -1 - No name specified
    • -2 - No addonid specified
    • 0 - Game addon saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
AddGameConfig(array $params) : array

Adds a game config

$params uses the following:

  • filename: The name of the config (REQUIRED)
  • gid: The games id (REQUIRED)
  • directory: Relative path to the config
  • content: File contents
  • rewrite: When to recreate the config (never,start,edit)
  • quickedit: 0 for disable, 1 for enable
  • install: 0 to not create during install, 1 to create

Returns one of the following in an array format:

  • error
    • -1 - No filename specified
    • -2 - No gid specified
    • 0 - Game config saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
AddGameScript(array $params) : array

Adds a game event script

$params uses the following:

  • gid: The games id (REQUIRED)
  • description: Description of the script
  • os: 0 for Linux, 1 for Windows
  • content: Script contents (batch/bash)
  • event: Event to run this script on (aftercreated, beforedeleted, beforestart, afterstart, beforestop, afterstop)
  • wait: Wait for the script to finish before continuing (true/false)

Returns one of the following in an array format:

  • error
    • -1 - No content specified
    • -2 - No gid specified
    • 0 - Game script saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
AddGameUpdate(array $params) : array

Adds a game update

$params uses the following:

  • gid: The games id (REQUIRED)
  • name: The updates name(REQUIRED)
  • copyfolder: 1 to copy folders, otherwise 0
  • windows_path: The windows path to copy
  • linux_path: The linux path to copy
  • systemcommands: 1 to run system commands, otherwise 0
  • windows_command: Windows commands(batch)
  • linux_command: Linux commands(bash)
  • userinstall: 1 to allow the user to install, otherwise 0
  • message: Message to be displayed after installed
  • description: Description of update

Returns one of the following in an array format:

  • error
    • -1 - No name specified
    • -2 - No gid specified
    • 0 - Game update saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
AddUserGame(array $params) : array

Adds a game to the user

$params requires the following:

  • uid: The user's ID to add the game to(REQUIRED)
  • sid: The server ID to add the game to(REQUIRED, location[name], machine[id], ip_[ipid], any)
  • gid: The Game's ID(REQUIRED)
  • maxslots: The maximum number of slots to allocate this game server
  • private: 0/1 to mark this server as a private server
  • affinity: The CPU core the game should run on(-1 disables affinity assignment)
  • priority: Controls the service priority(Below Normal, Normal, Above Normal, High, Real Time)
  • config: Array of configurable options(optionid, value)
  • install: Install the game server to the server(true/false)
  • email: Send an email to the user once the install is complete(true/false)
  • billingid: A reference ID sent from billing systems such as WHMCS
  • dedicatedip: 0/1 - 1 if the server should be on its own ip, 0 otherwise
  • fastdl: 0/1 - 1 if Fast Download should be enabled on this server, 0 otherwise
  • port_main: The port the server should use, this is NOT checked against existing servers
  • port_query: The port the server should use, this is NOT checked against existing servers
  • port_rcon: The port the server should use, this is NOT checked against existing servers
  • port_custom1: The port the server should use, this is NOT checked against existing servers
  • port_custom2: The port the server should use, this is NOT checked against existing servers
  • port_custom3: The port the server should use, this is NOT checked against existing servers
  • port_custom4: The port the server should use, this is NOT checked against existing servers
  • usermustownmachine: true/false, Make sure the server is owned by the specified user (uid). Default is false.

Returns one of the following in an array format:

  • error
    • -1 - Field left empty
    • -2 - No user
    • -3 - Game not found in database
    • -4 - Server not found in database (REMOVED)
    • -5 - Game does not exist on server (REMOVED)
    • -6 - Server is offline (REMOVED)
    • -7 - Error during installation
    • -8 - Unable to find matching server
    • -9 - Not enough slots available on the server (REMOVED)
    • -10 - Your license does not allow any more game servers
    • -11 - The specified billingid is already associated with a server
    • -12 - No IPs added to the selected machine (REMOVED)
    • 0 - Added successfully
  • ugid: User's game id(supplied if there was no error, or if error was -7)
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
CheckMachines(array $params) : array

Returns an array of servers with the game

$params requires the following:

  • gid: The game ID(REQUIRED)

Returns one of the following in an array format:

  • error
    • -1 - No game id provided
  • array of server information(serverid, serveralias, serverip, gamexists(true/false), folder, size)
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
ControlGame(array $params) : array

Starts, stops, and restarts the users game server.

$params requires the following:

  • ugid: The user's game id to control(REQUIRED)
  • action: start,stop,restart(REQUIRED)

Returns one of the following in an array format:

  • error
    • -1 - No gameid or action provided
    • -2 - Unable to find users game
    • -3 - Unable to complete action
    • -4 - Cannot do the requested action, server suspended
    • -5 - Cannot do the requested action, server is locked by another task
    • 0 - Controlled successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
DeleteAddon(integer $gid, integer $addonid) : void

Deletes a game addon

Parameters
NameTypeDescription
$gidinteger

Games ID

$addonidinteger

The addon's ID

DeleteConfig(integer $gid, integer $configid) : void

Deletes a game config

Parameters
NameTypeDescription
$gidinteger

Games ID

$configidinteger

The configs's ID

DeleteConfigurableOption(integer $gid, integer $optionid) : void

Deletes a configurable option

Parameters
NameTypeDescription
$gidinteger

Games ID

$optionidinteger

The option's ID

DeleteFromUser(integer $ugid, boolean $deletedb = true, boolean $forceremove = false) : array

Deletes a game server from a user

Returns one of the following in an array format:

  • error
    • -1 - No user game supplied
    • -2 - User game not found in database
    • -3 - Server is offline
    • -4 - Unable to remove the game server
    • 0 - Deleted successfully
Parameters
NameTypeDescription
$ugidinteger

User's game server id

$deletedbboolean

Deletes the user's game from the database

$forceremoveboolean

Deletes the user's game from the database(if deletedb = true) or sets it to not installed (if deletedb = false) even if the server is offline

Returns
TypeDescription
array
DeleteGame(mixed $gid) : array

Deletes a game from the database

$params requires the following:

  • templateid: The template id to delete

Returns one of the following in an array format:

  • error
    • -1 - No game id provided
    • -2 - Game has servers installed
    • 0 - Deleted successfully
Parameters
NameTypeDescription
$gidmixed

The Game's ID

Returns
TypeDescription
array
DeleteScript(integer $gid, integer $scriptid) : void

Deletes a game script

Parameters
NameTypeDescription
$gidinteger

Games ID

$scriptidinteger

The script's ID

DeleteUpdate(integer $gid, integer $updateid) : void

Deletes a game update

Parameters
NameTypeDescription
$gidinteger

Games ID

$updateidinteger

The update's ID

DisableGame(integer $gid, integer $sid) : boolean

Disables the game on the machine

Parameters
NameTypeDescription
$gidinteger

The game's ID

$sidinteger

The server's ID

Returns
TypeDescription
boolean
DisableMaintenance(string $ugid) : array

Disables maintenance mode for the gameserver

Returns one of the following in an array format:

  • error
    • -1 - No user game id
    • -2 - Users game does not exist
    • -3 - Users game is already in maintenance
    • 0 - Server has been removed from maintenance
Parameters
NameTypeDescription
$ugidstring

The users game id

Returns
TypeDescription
array
EditGame(array $params) : array

Edits a game in the database

$params requires the following:

  • gid: GameID to edit(REQUIRED)
  • gamename: The name of the game(REQUIRED)
  • files_path: The folder for the game files(REQUIRED)
  • linux_enable: 0/1 to enable for linux servers
  • linux_startmode: The startmode for linux(Required of linux_enable is 1)
  • linux_installtype: The type of installation to do for user game files(folder, zip, tar, tar.gz)
  • linux_logfile: The linux log file to display in the web console
  • windows_enable: 0/1 to enable for windows servers
  • windows_startmode: The startmode for windows
  • windows_exec: The startmode for windows(Required of windows_enable is 1)
  • windows_installtype: The type of installation to do for user game files(folder, zip)
  • windows_workingpath: The relative path to run the executable from (only some games require this)
  • windows_logfile: The windows log file to display in the web console
  • port_increment: Integer to increment the port count by for new servers
  • port_default: The game's default port
  • port_querydefault: The game's default query port(0 to disable)
  • port_rcondefault: The game's default rcon port(0 to disable)
  • port_custom1: The game's custom port(0 to disable)
  • port_custom2: The game's custom port(0 to disable)
  • port_custom3: The game's custom port(0 to disable)
  • port_custom4: The game's custom port(0 to disable)
  • reinstall_enable: 0/1 to allow users to reinstall the gameserver
  • ftp: 0/1 to enable the ftp server for this game
  • windows_console: 0/1 to enable the console logging in windows for this game
  • querycode: The GameQ query code for this game
  • maxslots: Array for the maxslots variable(value, control, name)
  • configoptions: Array of configurable options(option, name, control, fieldtype, order)
  • servermon: 0/1 to enable server monitor actions for this game
  • graphs: 0/1 to enable slot and uptime graphs for this game
  • redirectfolder: A folder for the FTP to redirect users to
  • alertdiskusage: The size in bytes the user is allowed to use on the disk
  • fastdl: 0/1 to enable Fast Download option for this game
  • fastdlurl: The path to append to the URL for Fast Download
  • fastdlallowed: Extensions that are allowed to be downloaded
  • fastdlexclude: Files that are not allowed to be downloaded(wildcard accepted)
  • rconprotocol: The protocol required for rcon commands
  • backups: 0/1 to enable game server backups for this game
  • backupclientaccess: Client permissions for backups (0 none, 1 backup, 2 backup and restore)
  • backuplimit: The number of backups that can be stored per game server
  • servermon_offline_1: Action to take if offline once
  • servermon_offline_2: Action to take if offline twice
  • servermon_offline_3: Action to take if offline three times
  • servermon_private_1: Action to take if not private once
  • servermon_private_2: Action to take if not private twice
  • servermon_private_3: Action to take if not private three times
  • servermon_slots_1: Action to take if slots exceeded once
  • servermon_slots_2: Action to take if slots exceeded twice
  • servermon_slots_3: Action to take if slots exceeded three times
  • servermon_cpulimit: CPU Limit Percentage (0-100)
  • servermon_cpu_1: Action to take if CPU exceeded once
  • servermon_cpu_2: Action to take if CPU exceeded twice
  • servermon_cpu_3: Action to take if CPU exceeded three times
  • servermon_ramlimit: RAM Limit Percentage (0-100)
  • servermon_ram_1: Action to take if RAM exceeded once
  • servermon_ram_2: Action to take if RAM exceeded twice
  • servermon_ram_3: Action to take if RAM exceeded three times
  • database_allowed: 0/1 Allow databases to be created for this game
  • database_autocreate: 0/1 Automatically create a database for this game
  • database_adminurl: URL to phpMyAdmin or a similar tool for clients to access
  • database_limit: The number of databases that can be created for a game server

Returns one of the following in an array format:

  • error
    • -1 - No game id provided
    • -2 - Field left empty
    • -3 - No linux startmode
    • -4 - No windows executable
    • -5 - No OS selected
    • 0 - Added successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
EditGameAddon(array $params) : array

Edits a game addon

$params uses the following:

  • addonid: The addons id (REQUIRED)
  • name: The updates name(REQUIRED)
  • copyfolder: 1 to copy folders, otherwise 0
  • windows_path: The windows path to copy
  • linux_path: The linux path to copy
  • systemcommands: 1 to run system commands, otherwise 0
  • windows_command: Windows commands(batch)
  • linux_command: Linux commands(bash)
  • userinstall: 1 to allow the user to install, otherwise 0
  • message: Message to be displayed after installed
  • description: Description of addon
  • restart: 1 to restart after install, otherwise 0

Returns one of the following in an array format:

  • error
    • -1 - No name specified
    • -2 - No addonid specified
    • 0 - Game addon saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
EditGameConfig(array $params) : array

Edits a game config

$params uses the following:

  • filename: The name of the config (REQUIRED)
  • configid: The configs id if it exists (REQUIRED)
  • directory: Relative path to the config
  • content: File contents
  • rewrite: When to recreate the config (never,start,edit)
  • quickedit: 0 for disable, 1 for enable
  • install: 0 to not create during install, 1 to create

Returns one of the following in an array format:

  • error
    • -1 - No filename specified
    • -2 - No configid specified
    • 0 - Game config saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
EditGameScript(array $params) : array

Edits a game script

$params uses the following:

  • scriptid: The scripts id (REQUIRED)
  • description: Description of the script
  • os: 0 for Linux, 1 for Windows
  • content: Script contents (batch/bash)
  • event: Event to run this script on (aftercreated, beforedeleted, beforestart, afterstart, beforestop, afterstop)
  • wait: Wait for the script to finish before continuing (true/false)

Returns one of the following in an array format:

  • error
    • -1 - No content specified
    • -2 - No scriptid specified
    • 0 - Game script saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
EditGameUpdate(array $params) : array

Edits a game update

$params uses the following:

  • updateid: The update id (REQUIRED)
  • name: The updates name(REQUIRED)
  • copyfolder: 1 to copy folders, otherwise 0
  • windows_path: The windows path to copy
  • linux_path: The linux path to copy
  • systemcommands: 1 to run system commands, otherwise 0
  • windows_command: Windows commands(batch)
  • linux_command: Linux commands(bash)
  • userinstall: 1 to allow the user to install, otherwise 0
  • message: Message to be displayed after installed
  • description: Description of addon

Returns one of the following in an array format:

  • error
    • -1 - No name specified
    • -2 - No updateid specified
    • 0 - Game update saved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
EditUserGame(array $params) : array

Edits a user's game.

Upon success the user's game server will be restarted.

$params requires the following:

  • ugid: The user's game id to edit(REQUIRED)
  • maxslots: The maximum number of slots to allocate this game server
  • private: 0/1 to mark this server as a private server
  • affinity: The CPU core the game should run on(-1 disables affinity assignment)
  • priority: Controls the service priority(Below Normal, Normal, Above Normal, High, Real Time)
  • config: Array of configurable options(optionid, value)
  • billingid: A reference ID sent from billing systems such as WHMCS
  • dedicatedip: 0/1 - 1 if the server should be on its own ip, 0 otherwise
  • fastdl: 0/1 - 1 if Fast Download should be enabled on this server, 0 otherwise
  • restartserver: 0/1 - 1 If the gameserver should be restarted after settings are applied, 0 otherwise
  • commandline: A custom command line for this gameserver, if empty then the default will be used
  • port_main: If this is set then GSP-Panel will attempt to move the gameserver to this port
  • port_query: If this is set then GSP-Panel will attempt to move the gameserver to this port
  • port_rcon: If this is set then GSP-Panel will attempt to move the gameserver to this port
  • port_custom1: If this is set then GSP-Panel will attempt to move the gameserver to this port
  • port_custom2: If this is set then GSP-Panel will attempt to move the gameserver to this port
  • port_custom3: If this is set then GSP-Panel will attempt to move the gameserver to this port
  • port_custom4: If this is set then GSP-Panel will attempt to move the gameserver to this port

Returns one of the following in an array format:

  • error
    • -1 - No ugid provided
    • -2 - User's game not found
    • -3 - Game does not exist in database
    • -4 - One of the specified ports is unavailable
    • -5 - Server is offline, unable to edit
    • 0 - Edited successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
EnableGame(integer $gid, integer $sid) : boolean

Enables the game on the machine

Parameters
NameTypeDescription
$gidinteger

The game's ID

$sidinteger

The server's ID

Returns
TypeDescription
boolean
EnableMaintenance(string $ugid) : array

Enables maintenance mode for the gameserver

Returns one of the following in an array format:

  • error
    • -1 - No user game id
    • -2 - Users game does not exist
    • -3 - Users game is already in maintenance
    • 0 - Server is in maintenance
Parameters
NameTypeDescription
$ugidstring

The users game id

Returns
TypeDescription
array
ExportGameTemplate(integer $gid, string $method = "xml") : string

Gathers all the info to export a game template

Returns all of the game info as json or xml

Parameters
NameTypeDescription
$gidinteger
$methodstring

json or xml

Returns
TypeDescription
string
FindSuitableHost(array $params) : array

Find a suitable host matching the specified requirements

$params can contain the following:

  • gid: The game to search for (REQUIRED)
  • type: How to search for the host (any, ip, location, machine)
  • location: The location name to search by, required if type is 'location'
  • ip: The IP to search by, required if type is 'ip'
  • sid: The server's ID, required if type is 'machine'
  • dedicatedip: 0/1, 1 if this game server requires it's own IP
  • maxslots: The slots required for the game server, this is used to check quotas
  • uid: Find a server that belongs to this user

Returns one of the following in an array format:

  • error
    • -1 - No game ID specified
    • -2 - No servers found matching the type specified
    • -3 - Unable to find a suitable host
    • 0 - Host found
  • data
    • sid
    • ipid
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
GetGameConsole(integer $ugid) : array

Retrieves the servers console log

Returns one of the following in an array format:

  • error
    • -1 - No user game provided
    • -2 - Users game not found in database
    • -3 - Server offline
    • -4 - Console logging disabled for this game
    • 0 - Received data
  • data: Returned data
Parameters
NameTypeDescription
$ugidinteger

User's game id

Returns
TypeDescription
array
GetGameInfo(integer $gid) : array

Returns an array of game information

Parameters
NameTypeDescription
$gidinteger

Games ID

Returns
TypeDescription
array
GetUserGameInfo(integer $ugid) : void

Return an array of gameserver information

Since this information changes based on the game template you will need to dump the variables to view the array

Parameters
NameTypeDescription
$ugidinteger

Users gameserver ID

Import(string $data) : array

Imports a game export, this calls Games::AddGame

Returns one of the following in an array format:

  • error
    • -1 - No data supplied
    • -2 - Field left empty
    • -3 - No linux startmode
    • -4 - No windows startmode
    • -5 - No OS selected
    • 0 - Imported successfully
Parameters
NameTypeDescription
$datastring

XML Data from a GSP-Panel game export

Returns
TypeDescription
array
InstallAddon(integer $ugid, integer $addonid) : array

Installs the addon to the users game server

Returns one of the following in an array format:

  • error
    • -1 - No user game supplied
    • -2 - No addonid provided
    • -3 - User game not found in database
    • -4 - Addon not found in database
    • -5 - Addon is not setup for this OS
    • -6 - Users game is not installed
    • -7 - Unable to install
    • -8 - Client does not have permission to install this addon
    • 0 - Installed successfully
  • message: Addon's specified return message, if any
Parameters
NameTypeDescription
$ugidinteger

User's game server id

$addonidinteger

The addons id

Returns
TypeDescription
array
InstallToUser(array $params) : array

Starts an install of a user's game to the server.

When the installation is complete the pingback url is called.

$params requires the following:

  • ugid - The user's game id(REQUIRED)
  • email - Send an email to the user once completed(true/false)
  • pingback - The page to ping once the installation is complete. You can use {taskid} in the url and it will be replaced with the task's id.
  • file - The file to extract if you do not want to use the default game files, this should be a full path (Can use game variables)
  • deletefile - Will delete the specified file after the install is successful, used for moving game servers (true/false)

Returns one of the following in an array format:

  • error
    • -1 - No user game supplied
    • -2 - User game not found in database
    • -3 - Game does not exist on server
    • -4 - Unable to install the game server
    • -5 - Server is offline
    • -6 - Unable to install
    • -7 - File does not exist
    • 0 - Installed started
  • taskid - This id of the installgame task(Only sent if error = 0)
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
InstallUpdate(integer $ugid, integer $updateid, string $pingback = "api/backendtask.php?taskid={taskid}") : array

Installs the update to the users game server

Returns one of the following in an array format:

  • error
    • -1 - No user game supplied
    • -2 - No updateid provided
    • -3 - User game not found in database
    • -4 - Update not found in database
    • -5 - Update is not setup for this OS
    • -6 - Users game is not installed
    • -7 - Client does not have permission to install this update
    • 0 - Upgrade installation started
Parameters
NameTypeDescription
$ugidinteger

User's game server id

$updateidinteger

The game updates id

$pingbackstring

The pingback url

Returns
TypeDescription
array
ListAddons(integer $gid, integer $useraccess = null) : array

Returns an array of addons for the specified game

Parameters
NameTypeDescription
$gidinteger

Games ID

$useraccessinteger

null for all updates and 1 for client accessible addons

Returns
TypeDescription
array
ListConfigs(integer $gid) : array

Returns an array of configs for the specified game

Parameters
NameTypeDescription
$gidinteger

Games ID

Returns
TypeDescription
array
ListGameServers(array $params = array()) : array

Returns an array of game servers

$params can use the following:

  • uid: The users id
  • sid: The servers id
  • ipid: The id of the IP
  • gid: The games id
  • ip: The ip or alias (string)
  • limit: The number of gameservers to return
  • status: The status of the server (0,1,2)
  • location: Gameservers on machines in this location

Returns an array of game servers matching the specified criteria

Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
ListGames() : array

Returns an array of games

Returns
TypeDescription
array
ListProtocols() : array

Returns an array of all protocols as a key value pair

Returns
TypeDescription
array
ListScripts(integer $gid) : array

Returns an array of scripts for the specified game

Parameters
NameTypeDescription
$gidinteger

Games ID

Returns
TypeDescription
array
ListUpdates(integer $gid, integer $useraccess = null) : array

Returns an array of updates for the specified game

Parameters
NameTypeDescription
$gidinteger

Games ID

$useraccessinteger

null for all updates and 1 for client accessible updates

Returns
TypeDescription
array
LockGame(string $ugid) : array

Locks the users gameserver

Returns one of the following in an array format:

  • error
    • -1 - No user game id
    • -2 - Users game does not exist
    • -3 - Users game is already locked
    • 0 - Server locked
Parameters
NameTypeDescription
$ugidstring

The users game id

Returns
TypeDescription
array
MoveUserGame(array $params) : array

Moves a user's game to another server or IP

$params requires the following:

  • ugid: The user's game id to move(REQUIRED)
  • sid: The new server id to move the game to(REQUIRED, location[name], machine[id], ip_[ipid], any)
  • movefile: Set this to true to move the game files (Remotes have to be the same OS)

Returns one of the following in an array format:

  • error
    • -1 - Missing a required variable
    • -2 - User game does not exist
    • -3 - Game does not exist
    • -4 - Unable to find a server matching critera
    • -5 - Server already on the same ip
    • -6 - New server cannot run that game (REMOVED)
    • -7 - Error during installation
    • -8 - Old server is offline, cannot remove old server
    • -9 - Unable to remove the game server
    • -10 - Server not found in database (REMOVED)
    • -11 - Server is offline (REMOVED)
    • -12 - Not enough slots available on the server (REMOVED)
    • -13 - Unable to move a server that has a task in progress
    • -14 - Unable to move server files
    • 0 - Moved successfully
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
QueryGame(array $params) : array

Queries the game server for information

$params requires the following:

  • ugid: The user's game id(REQUIRED)
  • players: Report play list(true/false)
  • nomap: Report the current map(true/false)

Returns one of the following in an array format:

  • error
    • -1 - No users game id provided
    • -2 - User's game not found in the database
  • array of game information, this varies depending on game
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
Rcon(array $params) : array

Sends the rcon command to the server

$params requires the following:

  • ugid: The user's game id(REQUIRED)
  • command: The command to send(REQUIRED)
  • password: The rcon password

Returns one of the following in an array format:

  • error
    • -1 - No users game id provided
    • -2 - No command provided
    • -3 - User's game not found in the database
    • -4 - No protocol setup for this game
    • -5 - Protocol was not found
    • -6 - Unknown rcon error
  • array of game information, this varies depending on game
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
RebuildStartMode(array $params) : array

Rebuilds the start mode for windows servers.

$params requires the following:

  • ugid: The user's game id to rebuild the startmode of(REQUIRED)

Returns one of the following in an array format:

  • error
    • -1 - No gameid or action provided
    • -2 - Unable to find users game
    • -3 - Unable to complete action
    • 0 - Rebuild successful
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
RunCustomScript(integer $ugid, string $event) : void

Run any event scripts for this game

Returns nothing

Parameters
NameTypeDescription
$ugidinteger

User's game server id

$eventstring

Type of script to run

SuspendServer(integer $ugid) : array

Suspends the users game server

Returns one of the following in an array format:

  • error
    • -1 - No user game supplied
    • -2 - User's game does not exist
    • 0 - Suspend successfully
Parameters
NameTypeDescription
$ugidinteger

User's game server id

Returns
TypeDescription
array
UnlockGame(string $ugid) : array

Unlocks the users gameserver

Returns one of the following in an array format:

  • error
    • -1 - No user game id
    • -2 - Users game does not exist
    • -3 - Users game is already unlocked
    • 0 - Server unlocked
Parameters
NameTypeDescription
$ugidstring

The users game id

Returns
TypeDescription
array
UnsuspendServer(integer $ugid) : array

Unsuspends the users game server

Returns one of the following in an array format:

  • error
    • -1 - No user game supplied
    • -2 - User's game does not exist
    • 0 - Unsuspend successfully
Parameters
NameTypeDescription
$ugidinteger

User's game server id

Returns
TypeDescription
array
WriteConfig(integer $cfid, integer $ugid) : array

Writes a config to a user's game

Returns one of the following in an array format:

  • error
    • -1 - No cfid or ugid provided
    • -2 - Unable to find users game
    • -3 - Unable to write the config, view the backend's debug log
    • 0 - Wrote successfully
Parameters
NameTypeDescription
$cfidinteger

Game's config ID

$ugidinteger

User's game server id

Returns
TypeDescription
array
downloadGameFile(integer $gid, integer $sid, integer $fromsid) : array

Downloads game file from another server

Returns one of the following in an array format:

  • error
    • -1 - Server does not exist
    • -2 - Game does not exist
    • -3 - Unable to download files
    • -4 - Unable to download a folder
    • -5 - Already downloading
    • 0 - Download started
  • task - Task ID, specified if error is 0
Parameters
NameTypeDescription
$gidinteger

Game ID

$sidinteger

Machine ID

$fromsidinteger

Machine ID to download from

Returns
TypeDescription
array
inMaintenance(string $ugid) : boolean

Checks if a game server is in maintenance mode

Returns true if the server is in maintenance mode, false if it's not

Parameters
NameTypeDescription
$ugidstring

The users game id

Returns
TypeDescription
boolean
isLocked(string $ugid) : boolean

Checks if a game server is locked

Returns true if the server is locked, false if it's not

Parameters
NameTypeDescription
$ugidstring

The users game id

Returns
TypeDescription
boolean
needNewGameFiles(integer $gid, integer $sid, integer $fileserver) : boolean

Returns true if the game files should be redownloaded from the specified fileserver for the machine

Parameters
NameTypeDescription
$gidinteger

Game ID

$sidinteger

Machine ID

$fileserverinteger

ID of the machine to use as the fileserver

Returns
TypeDescription
boolean
Documentation was generated by phpDocumentor 2.9.0.