Hooks

Hooks enable you to create custom code that triggers during certain actions in GameCP. For example when a user edit's their game you can execute a custom function to do more then normal.

Example

Hooks are loaded from the includes/hooks folder of your GameCP web install. Name your file any name with the extension .php.

Example: my_hook.php

Use $_REQUEST, $_GET, $_POST, $_SESSION or $hook_vars for available variables.

<?php

function example(){
	global $GameCP, $Event, $hook_vars;

	echo "hello world";
}

add_hook("page_load", "example");

?>

Available Actions

page_load 
update_game - array
update_game_completed - array
config_restore - array
quick_mod - var
reinstall_game_pre - array
reinstall_game - array
edit_game - request data
edit_game_pre - userdata pre save
add_game_pre
change_password
run_rcon
game_command
check_install_exists
install_game_files
add_addon
exec_cmd
ban_ip
create_config
1.2.4+
unsuspend_user
suspend_user
unsuspend_game
suspend_game
suspend_voice
1.2.6+
monitor_service_stop - hook_vars = service id
monitor_service - hook_vars = array of gameq results 
monitor_voice - hook_vars = array of voice status 
monitor_machine - hook_vars = array of machine row details
daily_cron - no params - ran daily with auto.php
control_service - hook_vars = array of service details - global $method for the start/stop/restart

order_start - package info array
order_pickproduct - product info
order_pickpackageterm - term
order_uprofile
order_checkuser
order_dopayment
order_finishsetup
order_checkpromo
order_checkuser
order_checkusername

remove_user - cid (all db entrys left at this point)
add_user_toserver - username
remove_user_fromserver - username

map_uninstall - $hook_vars=array("map"=>$newmap, "ugid"=>$ugid, "details"=>$supportedGame, "homemapdir" => $homemapdir, "usermapdir"=>$usermapdir);
map_install - $hook_vars=array("map"=>$newmap, "ugid"=>$ugid, "details"=>$supportedGame, "homemapdir" => $homemapdir, "usermapdir"=>$usermapdir);

Need more Actions?

E-mail support! These are easy to add.





(wiki tools)
Personal tools
Views
Actions




Need help? Chat with us!