avpmod.inc

/*================================================================================
	
	----------------------------------------
	-*- Aliens vs Predator Includes File -*-
	----------------------------------------
	
	~~~~~~~~~~
	- How To -
	~~~~~~~~~~
	
	To make use of the Aliens vs Predator API features in your plugin, just
	add the following line at the beginning of your script:
	
	#include <avpmod>
	
	~~~~~~~~~~~
	- Natives -
	~~~~~~~~~~~
	
	These work just like any other functions: you may have to pass
	parameters and they usually return values.
	
	Example:
	
	if ( is_user_alive( id ) && avp_get_user_alien( id ) )
	{
		server_print( "Player %d is alive and a alien", id )
	}
	
	~~~~~~~~~~~~
	- Forwards -
	~~~~~~~~~~~~
	
	Forwards get called whenever an event happens during the game.
	You need to make a public callback somewhere on your script,
	and it will automatically be triggered when the event occurs.
	
	Example:
	
	public avp_user_aliened_post( id, berseker )
	{
		if ( berseker )
			return;
		
		server_print( "Player %d just got turned into alien!", id )
	}
	
	Also, take note of cases when there's a suffix:
	
	* _pre  : means the forward will be called BEFORE the event happens
	* _post : means it will be called AFTER the event takes place
	
=================================================================================*/

#if defined _avpmod_included
  #endinput
#endif
#define _avpmod_included

/* Game modes for avp_round_started() */
enum
{
	MODE_CHAOS = 1,
	MODE_BERSEKER
}

/* Winner teams for avp_round_ended() */
enum
{
	WIN_NO_ONE = 0,
	WIN_ALIENS,
	WIN_PREDATORS
}

/* Custom forward return values */
#define AVP_PLUGIN_HANDLED 97

/**
 * Returns whether a player is a alien.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native avp_get_user_alien(id)

/**
 * Returns whether a player is a berseker.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native avp_get_user_berseker(id)

/**
 * Returns whether a player is a predator.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native avp_get_user_predator(id)

/**
 * Forces a player to become a alien.
 *
 * Note: Unavailable for last predator.
 *
 * @param id		Player index to turn into alien.
 * @return		True on success, false otherwise.
 */
native avp_make_user_alien(id)

/**
 * Forces a player to become a berseker.
 *
 * Note: Unavailable for last predator.
 *
 * @param id		Player index to turn into berseker.
 * @return		True on success, false otherwise.
 */
native avp_make_user_berseker(id)

/**
 * Forces a player to become a predator.
 *
 * Note: Unavailable for last alien/berseker.
 *
 * @param id		Player index to turn into predator.
 * @return		True on success, false otherwise.
 */
native avp_make_user_predator(id)

/**
 * Check if the player is allowed to turn into alien.
 *
 * @param id		Player index to check.
 * @return		True on success, false otherwise.
 */
native avp_allowed_alien(id)

/**
 * Check if the player is allowed to turn into berseker.
 *
 * @param id		Player index to check.
 * @return		True on success, false otherwise.
 */
native avp_allowed_berseker(id)

/**
 * Check if the player is allowed to turn into predator.
 *
 * @param id		Player index to check.
 * @return		True on success, false otherwise.
 */
native avp_allowed_predator(id)

/**
 * Called when a player turn into predator.
 *
 * @param id		Player index who was "predatored".
 */
forward avp_user_predatored_pre(id)
forward avp_user_predatored_post(id)

/**
 * Called when a player turn into alien.
 *
 * @param id		Player index who was "aliened".
 * @param berseker	Whether the player was turned into a berseker.
 */
forward avp_user_aliened_pre(id, berseker)
forward avp_user_aliened_post(id, berseker)

/**
 * Returns number of alive aliens.
 *
 * @return		Alien count.
 */
native avp_get_aliens_count()

/**
 * Returns number of alive predators.
 *
 * @return		Predator count.
 */
native avp_get_predator_count()

/**
 * Called when the AvP round starts, i.e. berseker
 * is chosen or a game mode begins.
 *
 * @param gamemode	Mode which has started.
 * @param id		Affected player's index (if applicable).
 */
forward avp_round_started(gamemode, id)

/**
 * Called when the round ends.
 *
 * @param winteam	Team which has won the round.
 */
forward avp_round_ended(winteam)

/**
 * Called to force the start of round.
 *
 * @param gamemode	Mode which has start.
 * @param id		Affected player's index (if applicable).
 */
native avp_start_round(gamemode, id)

/**
 * Check if the Chaos Mode is allowed to start.
 */
native avp_allowed_chaos()