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