plugins/include/mapchooser.inc
author Nicholas Hastings <skamonkey@gmail.com>
Fri Aug 30 14:15:02 2013 -0400 (2013-08-30)
changeset 4102 0eb66c45a884
parent 3150 a7a63f60830b
permissions -rw-r--r--
Reserved slot fixes for OB games when SourceTV or Replay are enabled (bug 5499, r=drifter).
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
/**
crimson@3150
    33
 * Attempt to remove a map from the mapchooser map list.
crimson@3150
    34
 *
crimson@3150
    35
 * @param map		Map to remove.
crimson@3150
    36
 * @return			True if the nomination was found and removed, or false if the nomination was not found.
crimson@3150
    37
 */
crimson@3150
    38
native bool:RemoveNominationByMap(const String:map[]);
crimson@3150
    39
crimson@3150
    40
/**
crimson@3150
    41
 * Attempt to remove a map from the mapchooser map list.
crimson@3150
    42
 *
crimson@3150
    43
 * @param owner		Client index of the nominater.
crimson@3150
    44
 * @return			True if the nomination was found and removed, or false if the nomination was not found.
crimson@3150
    45
 */
crimson@3150
    46
native bool:RemoveNominationByOwner(owner);
crimson@3150
    47
crimson@3150
    48
/**
pred@2133
    49
 * Gets the current list of excluded maps.
pred@2133
    50
 *
crimson@3150
    51
 * @param array		An ADT array handle to add the map strings to.
pred@2133
    52
 * @noreturn
pred@2133
    53
 */
pred@2133
    54
native GetExcludeMapList(Handle:array);
pred@2133
    55
pred@2133
    56
/**
crimson@3150
    57
 * Gets the current list of nominated maps.
crimson@3150
    58
 *
crimson@3150
    59
 * @param maparray		An ADT array handle to add the map strings to.
crimson@3150
    60
 * @param ownerarray	An optional ADT array handle to add the nominator client indexes to.
crimson@3150
    61
 * @noreturn
crimson@3150
    62
 */
crimson@3150
    63
native GetNominatedMapList(Handle:maparray, Handle:ownerarray = INVALID_HANDLE);
crimson@3150
    64
crimson@3150
    65
/**
pred@2133
    66
 * Checks if MapChooser will allow a vote
pred@2133
    67
 *
pred@2133
    68
 * @return			True if a vote can be held, or false if mapchooser is already holding a vote.
pred@2133
    69
 */
pred@2133
    70
native bool:CanMapChooserStartVote();
pred@2133
    71
pred@2133
    72
/**
pred@2133
    73
 * Initiates a MapChooser map vote
pred@2133
    74
 *
pred@2133
    75
 * Note: If no input array is specified mapchooser will use its internal list. This includes
pred@2133
    76
 * any nominations and excluded maps (as per mapchoosers convars).
pred@2133
    77
 *
pred@2133
    78
 * @param when			MapChange consant of when the resulting mapchange should occur.
pred@2133
    79
 * @param inputarray	ADT array list of maps to add to the vote.
pred@2133
    80
 */
pred@2133
    81
native InitiateMapChooserVote(MapChange:when, Handle:inputarray=INVALID_HANDLE);
pred@2133
    82
pred@2133
    83
/**
pred@2212
    84
 * Checks if MapChooser's end of map vote has completed.
pred@2223
    85
 *
pred@2223
    86
 * @return			True if complete, false otherwise.
pred@2133
    87
 */
pred@2133
    88
native bool:HasEndOfMapVoteFinished();
pred@2133
    89
pred@2133
    90
/**
pred@2223
    91
 * Checks if MapChooser is set to run an end of map vote.
pred@2223
    92
 *
pred@2223
    93
 * @return			True if enabled, false otherwise.
pred@2223
    94
 */
pred@2223
    95
native bool:EndOfMapVoteEnabled();
pred@2223
    96
pred@2223
    97
/**
pred@2133
    98
 * Called when mapchooser removes a nomination from its list.
pred@2133
    99
 * Nominations cleared on map start will not trigger this forward
pred@2133
   100
 */
pred@2350
   101
forward OnNominationRemoved(const String:map[], owner);
pred@2133
   102
crimson@3150
   103
/**
crimson@3150
   104
 * Called when mapchooser starts a Map Vote.
crimson@3150
   105
 */
crimson@3150
   106
forward OnMapVoteStarted();
crimson@3150
   107
pred@2133
   108
pred@2133
   109
public SharedPlugin:__pl_mapchooser = 
pred@2133
   110
{
pred@2133
   111
	name = "mapchooser",
pred@2133
   112
	file = "mapchooser.smx",
pred@2133
   113
#if defined REQUIRE_PLUGIN
pred@2133
   114
	required = 1,
pred@2133
   115
#else
pred@2133
   116
	required = 0,
pred@2133
   117
#endif
pred@2212
   118
};
pred@2212
   119
pred@2212
   120
public __pl_mapchooser_SetNTVOptional()
pred@2212
   121
{
pred@2212
   122
	MarkNativeAsOptional("NominateMap");
crimson@3150
   123
	MarkNativeAsOptional("RemoveNominationByMap");
crimson@3150
   124
	MarkNativeAsOptional("RemoveNominationByOwner");
pred@2212
   125
	MarkNativeAsOptional("GetExcludeMapList");
crimson@3150
   126
	MarkNativeAsOptional("GetNominatedMapList");
pred@2212
   127
	MarkNativeAsOptional("CanMapChooserStartVote");
pred@2212
   128
	MarkNativeAsOptional("InitiateMapChooserVote");
pred@2212
   129
	MarkNativeAsOptional("HasEndOfMapVoteFinished");
dvander@2229
   130
	MarkNativeAsOptional("EndOfMapVoteEnabled");
dvander@2229
   131
}
dvander@2229
   132