Event system
Event system Events were introduced to let server admins customize actions performed by server when something happens. For example, you can enable kick on third betray with the following command:
event_tk $tk=3 'sv_kick $n'
General syntax for adding events is: event_[type] [event condition] 'command'
Here is the list of variables that can be used in event's command line and also as argument:
$n - PlayerIndex from sv_players / pl
$name - Player's name
$hash - Player's cd-key hash
$ip - Player's ip
$tk - Player's TK (betray) count
$kills - Player's kill count
$assists - Player's assist count
$deaths - Player's death count
$suicides - Player's suicide count
$streak - Killstreak count of the player (number of kills without die)
$combo - Combo count, like 2: double kill, 3: triple kill etc.
$score - Player's CTF score count
$botscore - The player's current aimbot score
$x - Player's x coordinate
$y - Player's y coordinate
$z - Player's z coordinate
$hp - Player's health
$sh - Player's shield
$invis - 0: Player is visible, 1: Player is invisible
$team - Player's team
$oteam - Opposite team of the player
$lvl - Admin level of the player, not admin: -1, admin : 0 to 4
$map - The name of the current map
$mode - The name of the current gamemode
$gt - The type of the current game (ex: ctf, slayer, etc.)
$svname - The name of the server
$pn - The number of the players in the server
$reds - The number of the players in the red team
$blues - The number of the players in the blue team
$rand - Gives a random number from 1 to 16
If an event doesn't have any arguments, it will execute always when its get called. If it has arguments, it will only execute if all passed. The operators in the arguments can be the following:
: and !: at a string, ex: $map:bloodgulch, $mode!:cbctf, $name:New1337
= != > => < <= at a number, ex: $kills=25, $lvl>=0, $kills<$deaths, etc.
ps.: !: and != referrers to "not equal"
event_alive | event is executed once a second if the player is alive |
event_tk arguments 'command' | event is executed when a player betrays somebody |
event_kill arguments 'command' | event is executed when a player kills someone. special argument: $killed; 1-16 the player who got killed by the current one |
event_score arguments 'command' | event is executed when a player Captures a Flag. |
event_suicide arguments 'command' | event is executed when a player committed suicide |
event_start arguments 'command' | event is executed when a map starts |
event_end arguments 'command' | event is executed when a specified map ends |
event_join arguments 'command' | event is executed when player joins the server |
event_leave arguments 'command' | event is executed when player leaves the server |
event_spawn arguments 'command' | event is executed when player spawns |
event_die arguments 'command' | event is executed when player dies. special argument: $killer; -1:"died", 0:player was killed by a vehicle, ai, "guardians", 1-16: the $n of the player who killed the current one |
event_teamswitch arguments 'command' | event executed on player's team change. |
event_wpickup arguments 'command' | event executed when a player picks up a weapon. special argument: $type; 1-weapon, 2-frag, 3-plasma nade |
event_venter arguments 'command' | event executed when a player enters to a vehicle |
event_vexit arguments 'command' | event executed when a player exits from a vehicle |
event_snap arguments 'command' | event executed when a player snaps to another player (if aimbot scan is enabled). Special argument: $score, the amount of score gained with this snap |
event_camp arguments 'command' | special event for the command anticamp, executes when a player is camping and kills a player, special argument: $campkills, the number of kills that the player gained during camp |
event_warp arguments 'command' | event executed after the player warped 'n' amount of times defined with 'antiwarp n' command (if n > 0). Note that the number of warps of a player will be reset to 0 after the player didn't warp for 5 seconds. |
event_login arguments 'command' | event executed when an admin logged in with the login command |
events | Displays all events |
eventdel index | Deletes event from queue. Use 'events' to find index |
wait n | Wait n milliseconds before executing next command (1 second = 1000 milliseconds) |
w8 n | Wait n seconds before executing next command |
See the example below:
Place this into the "gametypes folder"\sapp\events.txt: (for ex "C:\Users\Username\Documents\My Games\Halo CE\sapp", or cg\sapp in Gameservers)
event_join 'w8 10;say $n "Please follow the rules or you might get kicked or banned!" '
event_kill $kills=25 'say $n "25 kills, not bad $name!" '
event_kill $kills=100 'say $n "WoW, you have 100 kills $name!" '
event_kill $kills=500 'say $n "MDROFLOLMFAOMFG $name, you have 500 kills !!!" '
event_score 'say $n "Good Job, $name!" '
event_tk 'say $n "$name do not betray your teammates you idiot!" '
event_start 'w8 15;say * "Map skipping is enabled! Type SKIP to vote to skip this map!"'
event_end 'say * "Server Powered by SAPP, xhalo.tk"'
event_teamswitch 'say $n "Welcome to the $team team, $name!" '
Note: Do NOT use the ' (apostrophe) character in the say command at the events!
(Example: Good usage: "do not", "will not", etc. Bad usage: "don't", "won't", etc.)