plugins/include/mapchooser.inc
author David Anderson <dvander@alliedmods.net>
Sun Jul 06 04:49:55 2008 +0000 (2008-07-06)
branchrefac-jit
changeset 2168 c24a6fa957db
child 2212 24fcd7ac70f7
permissions -rw-r--r--
jit refactoring branch
     1 #if defined _mapchooser_included_
     2   #endinput
     3 #endif
     4 #define _mapchooser_included_
     5 
     6 enum NominateResult
     7 {
     8 	Nominate_Added,			/** The map was added to the nominate list */
     9 	Nominate_Replaced,		/** A clients existing nomination was replaced */
    10 	Nominate_AlreadyInVote,	/** Specified map was already in the vote */
    11 	Nominate_InvalidMap,	/** Mapname specifed wasn't a valid map */
    12 	Nominate_VoteFull,		/** This will only occur if force was set to false */
    13 };
    14 
    15 enum MapChange
    16 {
    17 	MapChange_Instant,		/** Change map as soon as the voting results have come in */
    18 	MapChange_RoundEnd,		/** Change map at the end of the round */
    19 	MapChange_MapEnd,		/** Change the sm_nextmap cvar */
    20 };
    21 
    22 /**
    23  * Attempt to add a map to the mapchooser map list.
    24  *
    25  * @param map		Map to add.
    26  * @param force		Should we force the map in even if it requires overwriting an existing nomination?
    27  * @param owner		Client index of the nominater. If the client disconnects the nomination will be removed. Use 0 for constant nominations
    28  * @return			Nominate Result of the outcome
    29  */
    30 native NominateResult:NominateMap(const String:map[], bool:force, owner);
    31 
    32 /**
    33  * Gets the current list of excluded maps.
    34  *
    35  * @param array		An ADT array handle to add the map strings to. Needs to be 
    36  * @noreturn
    37  */
    38 native GetExcludeMapList(Handle:array);
    39 
    40 /**
    41  * Checks if MapChooser will allow a vote
    42  *
    43  * @return			True if a vote can be held, or false if mapchooser is already holding a vote.
    44  */
    45 native bool:CanMapChooserStartVote();
    46 
    47 /**
    48  * Initiates a MapChooser map vote
    49  *
    50  * Note: If no input array is specified mapchooser will use its internal list. This includes
    51  * any nominations and excluded maps (as per mapchoosers convars).
    52  *
    53  * @param when			MapChange consant of when the resulting mapchange should occur.
    54  * @param inputarray	ADT array list of maps to add to the vote.
    55  */
    56 native InitiateMapChooserVote(MapChange:when, Handle:inputarray=INVALID_HANDLE);
    57 
    58 
    59 /**
    60  * A horribly named native that checks if MapChooser's end of map vote has completed.
    61  */
    62 native bool:HasEndOfMapVoteFinished();
    63 
    64 /**
    65  * Called when mapchooser removes a nomination from its list.
    66  * Nominations cleared on map start will not trigger this forward
    67  */
    68 forward OnNominationRemoved(String:map[], owner);
    69 
    70 
    71 public SharedPlugin:__pl_mapchooser = 
    72 {
    73 	name = "mapchooser",
    74 	file = "mapchooser.smx",
    75 #if defined REQUIRE_PLUGIN
    76 	required = 1,
    77 #else
    78 	required = 0,
    79 #endif
    80 };