plugins/include/mapchooser.inc
author Erik Minekus <erik@interwavestudios.com>
Wed Jun 23 23:41:47 2010 -0400 (2010-06-23)
changeset 3052 a102c645bf4b
parent 2350 c27e177a39d7
child 3150 a7a63f60830b
permissions -rw-r--r--
Fixed lack of error checking on sm_motd. (bug 4460, r=dvander)
     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  * Checks if MapChooser's end of map vote has completed.
    60  *
    61  * @return			True if complete, false otherwise.
    62  */
    63 native bool:HasEndOfMapVoteFinished();
    64 
    65 /**
    66  * Checks if MapChooser is set to run an end of map vote.
    67  *
    68  * @return			True if enabled, false otherwise.
    69  */
    70 native bool:EndOfMapVoteEnabled();
    71 
    72 /**
    73  * Called when mapchooser removes a nomination from its list.
    74  * Nominations cleared on map start will not trigger this forward
    75  */
    76 forward OnNominationRemoved(const String:map[], owner);
    77 
    78 
    79 public SharedPlugin:__pl_mapchooser = 
    80 {
    81 	name = "mapchooser",
    82 	file = "mapchooser.smx",
    83 #if defined REQUIRE_PLUGIN
    84 	required = 1,
    85 #else
    86 	required = 0,
    87 #endif
    88 };
    89 
    90 public __pl_mapchooser_SetNTVOptional()
    91 {
    92 	MarkNativeAsOptional("NominateMap");
    93 	MarkNativeAsOptional("GetExcludeMapList");
    94 	MarkNativeAsOptional("CanMapChooserStartVote");
    95 	MarkNativeAsOptional("InitiateMapChooserVote");
    96 	MarkNativeAsOptional("HasEndOfMapVoteFinished");
    97 	MarkNativeAsOptional("EndOfMapVoteEnabled");
    98 }
    99