Triggers
Triggers allows you to execute commands based on events.
Examples
alias on_enter "/say Hello everyone!"
alias f_demoend "/screenshot" // take screenshot at end of demo
Apply settings based on map name with a default fallback:
alias f_newmap "apply_map_settings"
alias apply_map_settings "if_exists alias map_settings_$mapname map_settings_$mapname map_settings_default"
alias map_settings_default "hud_ammo4_show 1; hud_gun8_show 1" // show lg/cells in HUD
alias map_settings_dm2 "hud_ammo4_show 0; hud_gun8_show 0" // hide lg/cells in HUD
f_triggers
"Restricted" means it cannot be used in combination with teamplay macros.
Name | Restricted | Description |
---|---|---|
f_spawn | no | Triggered when spawning |
f_respawn | yes | Triggered when respawning |
f_death | yes | Triggered at death |
f_flagdeath | yes | Triggered at death while holding the flag |
f_weaponchange | no | Triggered when changing weapon |
f_took | yes | Triggered when picking up an item |
f_newmap | no | Triggered when a map is loaded |
f_mapend | no | Triggered when map is completed |
f_demostart | no | Triggered when demo starts (countdown) |
f_demomatchstart | no | Triggered when match in demo starts (after countdown) |
f_demoend | no | Triggered at end of demo |
f_reloadstart | no | |
f_reloadend | no | |
f_cfgload | no | |
f_exit | no | Triggered when exiting the game |
f_sbrefreshdone | no | Triggered after servers are updated in server browser |
f_sbupdatesourcesdone | no | Triggered after sources are updated in server browser |
f_focusgained | no | Triggered when application gains focus |
f_freeflyspectate | no | Triggered when spectating in free fly mode |
f_trackspectate | no | Triggered when spectating a player |
f_captureframe | no | |
f_conc | yes | |
f_flash | yes | |
f_bonusflash | yes |
on_triggers
Name | Description | Event value |
---|---|---|
on_enter | Triggered when entering a server as player | (enabled by default) |
on_spec_enter | Triggered when entering a server as spectator | (enabled by default) |
on_enter_ctf | Triggered when entering a ctf server as player | (enabled by default) |
on_enter_ffa | Triggered when entering a ffa server as player | (enabled by default) |
on_connect | Triggered when connected to a server | 1 |
on_matchstart | Triggered when match starts (countdown) | 4 |
on_matchend | Triggered when match ends | 8 |
on_matchbreak | Triggered when match is paused | 16 |
on_admin | Triggered when ganing admin status | 128 |
on_unadmin | Triggered when losing admin status | 256 |
Notes
on_enter, on_spec_enter, on_enter_ctf, on_enter_ffa
are enabled by default.- The other
on_
triggers requires you to callcmd info ev x
wherex
is the sum of event values to enable. - Calling
cmd info ev
can be done automatically by defining aninfoset
alias in your config, e.g:alias infoset "cmd info ev 413" // Enable all
alias infoset "cmd info ev 8" // Enable on_matchend
If you want to customize even further:
on_connect
also enableson_connect_ctf on_connect_ffa on_observe on_observe_ctf on_observe_ffa
on_matchstart
also enableson_spec_matchstart
on_matchend
also enableson_spec_matchend
on_matchbreak
also enableson_spec_matchbreak