\GSPPanel\Games
Methods
AddGame(array $params) : arrayAdds 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
AddGameAddon(array $params) : arrayAdds 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
AddGameConfig(array $params) : arrayAdds 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
AddGameScript(array $params) : arrayAdds 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
AddGameUpdate(array $params) : arrayAdds 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
AddUserGame(array $params) : arrayAdds 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)
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
CheckMachines(array $params) : arrayReturns 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)
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
ControlGame(array $params) : arrayStarts, 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
DeleteAddon(integer $gid, integer $addonid) : voidDeletes a game addon
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| $addonid | integer | The addon's ID | 
DeleteConfig(integer $gid, integer $configid) : voidDeletes a game config
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| $configid | integer | The configs's ID | 
DeleteConfigurableOption(integer $gid, integer $optionid) : voidDeletes a configurable option
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| $optionid | integer | The option's ID | 
DeleteFromUser(integer $ugid, boolean $deletedb = true, boolean $forceremove = false) : arrayDeletes 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | User's game server id | 
| $deletedb | boolean | Deletes the user's game from the database | 
| $forceremove | boolean | 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 | 
| Type | Description | 
|---|---|
| array | 
DeleteGame(mixed $gid) : arrayDeletes 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
 
| Name | Type | Description | 
|---|---|---|
| $gid | mixed | The Game's ID | 
| Type | Description | 
|---|---|
| array | 
DeleteScript(integer $gid, integer $scriptid) : voidDeletes a game script
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| $scriptid | integer | The script's ID | 
DeleteUpdate(integer $gid, integer $updateid) : voidDeletes a game update
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| $updateid | integer | The update's ID | 
DisableGame(integer $gid, integer $sid) : booleanDisables the game on the machine
| Name | Type | Description | 
|---|---|---|
| $gid | integer | The game's ID | 
| $sid | integer | The server's ID | 
| Type | Description | 
|---|---|
| boolean | 
DisableMaintenance(string $ugid) : arrayDisables 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | string | The users game id | 
| Type | Description | 
|---|---|
| array | 
EditGame(array $params) : arrayEdits 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
EditGameAddon(array $params) : arrayEdits 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
EditGameConfig(array $params) : arrayEdits 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
EditGameScript(array $params) : arrayEdits 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
EditGameUpdate(array $params) : arrayEdits 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
EditUserGame(array $params) : arrayEdits 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
EnableGame(integer $gid, integer $sid) : booleanEnables the game on the machine
| Name | Type | Description | 
|---|---|---|
| $gid | integer | The game's ID | 
| $sid | integer | The server's ID | 
| Type | Description | 
|---|---|
| boolean | 
EnableMaintenance(string $ugid) : arrayEnables 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | string | The users game id | 
| Type | Description | 
|---|---|
| array | 
ExportGameTemplate(integer $gid, string $method = "xml") : stringGathers all the info to export a game template
Returns all of the game info as json or xml
| Name | Type | Description | 
|---|---|---|
| $gid | integer | |
| $method | string | json or xml | 
| Type | Description | 
|---|---|
| string | 
FindSuitableHost(array $params) : arrayFind 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
GetGameConsole(integer $ugid) : arrayRetrieves 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
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | User's game id | 
| Type | Description | 
|---|---|
| array | 
GetGameInfo(integer $gid) : arrayReturns an array of game information
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| Type | Description | 
|---|---|
| array | 
GetUserGameInfo(integer $ugid) : voidReturn 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
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | Users gameserver ID | 
Import(string $data) : arrayImports 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
 
| Name | Type | Description | 
|---|---|---|
| $data | string | XML Data from a GSP-Panel game export | 
| Type | Description | 
|---|---|
| array | 
InstallAddon(integer $ugid, integer $addonid) : arrayInstalls 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
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | User's game server id | 
| $addonid | integer | The addons id | 
| Type | Description | 
|---|---|
| array | 
InstallToUser(array $params) : arrayStarts 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)
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
InstallUpdate(integer $ugid, integer $updateid, string $pingback = "api/backendtask.php?taskid={taskid}") : arrayInstalls 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | User's game server id | 
| $updateid | integer | The game updates id | 
| $pingback | string | The pingback url | 
| Type | Description | 
|---|---|
| array | 
ListAddons(integer $gid, integer $useraccess = null) : arrayReturns an array of addons for the specified game
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| $useraccess | integer | null for all updates and 1 for client accessible addons | 
| Type | Description | 
|---|---|
| array | 
ListConfigs(integer $gid) : arrayReturns an array of configs for the specified game
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| Type | Description | 
|---|---|
| array | 
ListGameServers(array $params = array()) : arrayReturns 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
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
ListGames() : arrayReturns an array of games
| Type | Description | 
|---|---|
| array | 
ListProtocols() : arrayReturns an array of all protocols as a key value pair
| Type | Description | 
|---|---|
| array | 
ListScripts(integer $gid) : arrayReturns an array of scripts for the specified game
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| Type | Description | 
|---|---|
| array | 
ListUpdates(integer $gid, integer $useraccess = null) : arrayReturns an array of updates for the specified game
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Games ID | 
| $useraccess | integer | null for all updates and 1 for client accessible updates | 
| Type | Description | 
|---|---|
| array | 
LockGame(string $ugid) : arrayLocks 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | string | The users game id | 
| Type | Description | 
|---|---|
| array | 
MoveUserGame(array $params) : arrayMoves 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
QueryGame(array $params) : arrayQueries 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
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
Rcon(array $params) : arraySends 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
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
RebuildStartMode(array $params) : arrayRebuilds 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
 
| Name | Type | Description | 
|---|---|---|
| $params | array | 
| Type | Description | 
|---|---|
| array | 
RunCustomScript(integer $ugid, string $event) : voidRun any event scripts for this game
Returns nothing
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | User's game server id | 
| $event | string | Type of script to run | 
SuspendServer(integer $ugid) : arraySuspends 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | User's game server id | 
| Type | Description | 
|---|---|
| array | 
UnlockGame(string $ugid) : arrayUnlocks 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | string | The users game id | 
| Type | Description | 
|---|---|
| array | 
UnsuspendServer(integer $ugid) : arrayUnsuspends 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
 
| Name | Type | Description | 
|---|---|---|
| $ugid | integer | User's game server id | 
| Type | Description | 
|---|---|
| array | 
WriteConfig(integer $cfid, integer $ugid) : arrayWrites 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
 
| Name | Type | Description | 
|---|---|---|
| $cfid | integer | Game's config ID | 
| $ugid | integer | User's game server id | 
| Type | Description | 
|---|---|
| array | 
downloadGameFile(integer $gid, integer $sid, integer $fromsid) : arrayDownloads 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
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Game ID | 
| $sid | integer | Machine ID | 
| $fromsid | integer | Machine ID to download from | 
| Type | Description | 
|---|---|
| array | 
inMaintenance(string $ugid) : booleanChecks if a game server is in maintenance mode
Returns true if the server is in maintenance mode, false if it's not
| Name | Type | Description | 
|---|---|---|
| $ugid | string | The users game id | 
| Type | Description | 
|---|---|
| boolean | 
isLocked(string $ugid) : booleanChecks if a game server is locked
Returns true if the server is locked, false if it's not
| Name | Type | Description | 
|---|---|---|
| $ugid | string | The users game id | 
| Type | Description | 
|---|---|
| boolean | 
needNewGameFiles(integer $gid, integer $sid, integer $fileserver) : booleanReturns true if the game files should be redownloaded from the specified fileserver for the machine
| Name | Type | Description | 
|---|---|---|
| $gid | integer | Game ID | 
| $sid | integer | Machine ID | 
| $fileserver | integer | ID of the machine to use as the fileserver | 
| Type | Description | 
|---|---|
| boolean | 
