We hit a milestone the other night, and I was so pleased with myself that I wanted to post an update.
The AK2 script engine was fired up and tested successfully for the first time. What's the AK2 script engine, you ask? Well, it gives you, the server admin, some very granular control over how AK2 handles scanning, kicking, and banning.
AK2 will execute scripts for various things (such as a player joining a game server). These scripts can be modified to accomodate different games, capabilities, and special configurations. Here's a sample:
// set the script's name
script(Default_PlayerJoined);
// search the global banlist for this player's CoD GUID
search(global,auth,cod,%auth);
// if we found player's GUID, take whatever action was specified in the database
if (%found)%action;
// search for player's IP address
search(global,source,%ip);
if (%found)%action;
search(global,nickname,%nickname);
if (%found)%action;
accept;
Some things to note:
- "%something" indicates a variable. Most data gleaned from the game's status command or available in one of AK2's databases can be referenced.
- If your game server doesn't support authentication data (ex: CoD's GUID) then there's no reason to search for it. This accelerates AK2's performance by eliminating unnecessary steps.
- "search(global....)" searches for items in the global banlist. Multiple banlists will be supported, so you can have some servers with a more restricted player list.
- The first player-disposition action (accept, kick, or ban) found stops execution of the script (if we already know what to do with this player, there's no reason to keep looking). Again, this accelerates AK2's performance by eliminating unnecessary steps.
- The last line ("accept;") tells AK2 to accept this player if he wasn't already accepted, banned, or kicked by one of the above commands (ie the current AK's default behavior, "accept if not denied"). The opposite behavior ("deny if not accepted") could be easily accomdated by changing the last line to "kick;"
Here're a few more scripts that are fairly self-explanatory, and would be executed after Player_Joined when the appropriate %action was determined:
script(Default_Accept);
if (%new) say(Welcome to the server, %nickname);
ifnot (%new) say(Welcome back, %nickname);
script(Default_Kick);
say(%nickname kicked for %reason);
script(Default_Ban);
say(AMF, %nickname);
As I said, the script engine was tested successfully for the first time... as demonstrated by it's ability to kick me off my own server (quite rude, that). I'm considering a hard-coded accept for my nickname, IP, and GUID.
Hmmm...