map_manager.inc
Original include source with line numbers.
| 1 | #if defined _map_manager_core_included |
| 2 | #endinput |
| 3 | #endif |
| 4 | #define _map_manager_core_included |
| 5 | |
| 6 | #if AMXX_VERSION_NUM >= 175 |
| 7 | #pragma reqlib map_manager_core |
| 8 | #if !defined AMXMODX_NOAUTOLOAD |
| 9 | #pragma loadlib map_manager_core |
| 10 | #endif |
| 11 | #else |
| 12 | #pragma library map_manager_core |
| 13 | #endif |
| 14 | |
| 15 | #include <map_manager_consts> |
| 16 | #include <map_manager_stocks> |
| 17 | |
| 18 | /** |
| 19 | * Load maps from file. |
| 20 | * File loads from configs dir. |
| 21 | * |
| 22 | * @param filename File name |
| 23 | * @param clearlist Clear old maplist before new load. |
| 24 | * @param silent If false then will be call forward mapm_maplist_loaded. |
| 25 | * |
| 26 | * @noreturn |
| 27 | */ |
| 28 | native mapm_load_maplist(filename[], bool:clearlist = true, bool:silent = false); |
| 29 | |
| 30 | /** |
| 31 | * Load maps from file. |
| 32 | * File loads from configs dir. |
| 33 | * |
| 34 | * @param array Array with item size MapStruct. |
| 35 | * @param filename File name |
| 36 | * |
| 37 | * @return 1 if success load, 0 otherwise |
| 38 | */ |
| 39 | native mapm_load_maplist_to_array(Array:array, filename[]); |
| 40 | |
| 41 | /** |
| 42 | * Block default load maplist. |
| 43 | * Use before call plugin_cfg(). |
| 44 | * |
| 45 | * @noreturn |
| 46 | */ |
| 47 | native mapm_block_load_maplist(); |
| 48 | |
| 49 | /** |
| 50 | * Add map to maplist |
| 51 | * |
| 52 | * @param name Map name |
| 53 | * @param minplayers Min players for sort |
| 54 | * @param maxplayers Max players for sort |
| 55 | * @param priority Map priority |
| 56 | * |
| 57 | * @return 0 if invalid map or already in array |
| 58 | */ |
| 59 | native mapm_add_map_to_list(name[], minplayers = 0, maxplayers = 32, priority = 0); |
| 60 | |
| 61 | /** |
| 62 | * Get map index in mapslist array. |
| 63 | * |
| 64 | * @param map Map name |
| 65 | * |
| 66 | * @return Map index or INVALID_MAP_INDEX if map not exist in mapslist |
| 67 | */ |
| 68 | native mapm_get_map_index(map[]); |
| 69 | |
| 70 | /** |
| 71 | * Get prefix from core. |
| 72 | * |
| 73 | * @param prefix Prefix string |
| 74 | * @param len String lenght |
| 75 | * |
| 76 | * @noreturn |
| 77 | */ |
| 78 | native mapm_get_prefix(prefix[], len); |
| 79 | |
| 80 | /** |
| 81 | * Set value for vote finished variable. |
| 82 | * |
| 83 | * @param value Bool value |
| 84 | * |
| 85 | * @noreturn |
| 86 | */ |
| 87 | native mapm_set_vote_finished(bool:value); |
| 88 | |
| 89 | /** |
| 90 | * Start vote. |
| 91 | * |
| 92 | * @param type Vote type, use const VOTE_BY_* |
| 93 | * |
| 94 | * @noreturn |
| 95 | */ |
| 96 | native mapm_start_vote(type); |
| 97 | |
| 98 | /** |
| 99 | * Stop vote. |
| 100 | * |
| 101 | * @noreturn |
| 102 | */ |
| 103 | native mapm_stop_vote(); |
| 104 | |
| 105 | /** |
| 106 | * Blocks show vote menu from core. |
| 107 | * |
| 108 | * @noreturn |
| 109 | */ |
| 110 | native mapm_block_show_vote(); |
| 111 | |
| 112 | /** |
| 113 | * Get votelist size const from core. |
| 114 | * |
| 115 | * @return Votelist size |
| 116 | */ |
| 117 | native mapm_get_votelist_size(); |
| 118 | |
| 119 | /** |
| 120 | * Set max items in vote. |
| 121 | * |
| 122 | * @param value Amount items in vote |
| 123 | * |
| 124 | * @noreturn |
| 125 | */ |
| 126 | native mapm_set_votelist_max_items(value); |
| 127 | |
| 128 | /** |
| 129 | * Push map in votelist. |
| 130 | * |
| 131 | * @note Use native in forward mapm_prepare_votelist(). |
| 132 | * |
| 133 | * @param map Map name |
| 134 | * @param type Type for addons |
| 135 | * @param ignore_check Allow ignore some checks, bit sum, use const CHECK_* |
| 136 | * |
| 137 | * @return Result of pushing, const PUSH_* |
| 138 | */ |
| 139 | native mapm_push_map_to_votelist(map[], type = PUSH_BY_NATIVE, ignore_check = CHECK_NOT_IGNORED); |
| 140 | |
| 141 | /** |
| 142 | * Get amount maps in votelist. |
| 143 | * |
| 144 | * @note Use in mapm_analysis_of_results() |
| 145 | * |
| 146 | * @noreturn |
| 147 | */ |
| 148 | native mapm_get_count_maps_in_vote(); |
| 149 | |
| 150 | /** |
| 151 | * Get info about votelist item. |
| 152 | * |
| 153 | * @note Use in mapm_analysis_of_results() |
| 154 | * |
| 155 | * @param item Index in votelist |
| 156 | * @param map Map name |
| 157 | * @param len Map name string lenght |
| 158 | * |
| 159 | * @return Votes |
| 160 | */ |
| 161 | native mapm_get_voteitem_info(item, map[], len); |
| 162 | |
| 163 | /** |
| 164 | * Returns vote type. |
| 165 | * |
| 166 | * @return Type of vote, used const VOTE_BY_* |
| 167 | */ |
| 168 | native mapm_get_vote_type(); |
| 169 | |
| 170 | /** |
| 171 | * Adds votes to vote item. |
| 172 | * |
| 173 | * @note Use while vote continues. |
| 174 | * |
| 175 | * @param item Index in votelist |
| 176 | * @param value Map name |
| 177 | * |
| 178 | * @return 1 if success |
| 179 | */ |
| 180 | native mapm_add_vote_to_item(item, value); |
| 181 | |
| 182 | /** |
| 183 | * Returns if vote started. |
| 184 | * |
| 185 | * @return true/false |
| 186 | */ |
| 187 | native bool:is_vote_started(); |
| 188 | |
| 189 | /** |
| 190 | * Returns if vote finished. |
| 191 | * |
| 192 | * @return true/false |
| 193 | */ |
| 194 | native bool:is_vote_finished(); |
| 195 | |
| 196 | /** |
| 197 | * Called after load map list. |
| 198 | * |
| 199 | * @param maplist Array with loaded maps |
| 200 | * @param nextmap Nextmap after current map in loaded list |
| 201 | * |
| 202 | * @noreturn |
| 203 | */ |
| 204 | forward mapm_maplist_loaded(Array:maplist, const nextmap[]); |
| 205 | |
| 206 | /** |
| 207 | * Called after clear maplist. |
| 208 | * |
| 209 | * @noreturn |
| 210 | */ |
| 211 | forward mapm_maplist_unloaded(); |
| 212 | |
| 213 | /** |
| 214 | * Called every second before vote or in vote. |
| 215 | * |
| 216 | * @param type Type of countdown, used const COUNTDOWN_* |
| 217 | * @param time Current second of countdown |
| 218 | * |
| 219 | * @noreturn |
| 220 | */ |
| 221 | forward mapm_countdown(type, time); |
| 222 | |
| 223 | /** |
| 224 | * Called before vote. |
| 225 | * |
| 226 | * @param type Type of vote, used const VOTE_BY_* |
| 227 | * |
| 228 | * @noreturn |
| 229 | */ |
| 230 | forward mapm_prepare_votelist(type); |
| 231 | |
| 232 | /** |
| 233 | * Called when core or addons are trying add map in votelist. |
| 234 | * |
| 235 | * @param map Map name |
| 236 | * @param type Type of vote, used const VOTE_BY_* |
| 237 | * @param index Index in mapslist array |
| 238 | * |
| 239 | * @return MAP_ALLOWED |
| 240 | * MAP_BLOCKED |
| 241 | */ |
| 242 | forward mapm_can_be_in_votelist(const map[], type, index); |
| 243 | |
| 244 | /** |
| 245 | * Called for permission to extend current map. |
| 246 | * |
| 247 | * @param type Type of vote, used const VOTE_BY_* |
| 248 | * |
| 249 | * @return EXTEND_ALLOWED to allow extend current map |
| 250 | * EXTEND_BLOCKED to block extend current map |
| 251 | */ |
| 252 | forward mapm_can_be_extended(type); |
| 253 | |
| 254 | /** |
| 255 | * Called when core start show menu with vote. |
| 256 | * |
| 257 | * @param type Type of vote, used const VOTE_BY_* |
| 258 | * |
| 259 | * @noreturn |
| 260 | */ |
| 261 | forward mapm_vote_started(type); |
| 262 | |
| 263 | /** |
| 264 | * Called when core canceled vote. |
| 265 | * |
| 266 | * @param type Type of vote, used const VOTE_BY_* |
| 267 | * |
| 268 | * @noreturn |
| 269 | */ |
| 270 | forward mapm_vote_canceled(type); |
| 271 | |
| 272 | /** |
| 273 | * Called before vote finish. |
| 274 | * |
| 275 | * @param type Type of vote, used const VOTE_BY_* |
| 276 | * @param total_votes Count of players votes |
| 277 | * |
| 278 | * @return ALLOW_VOTE to allow finish vote |
| 279 | * ABORT_VOTE to block finish vote, forward mapm_vote_finished() will not be called |
| 280 | */ |
| 281 | forward mapm_analysis_of_results(type, total_votes); |
| 282 | |
| 283 | /** |
| 284 | * Called when vote finished. |
| 285 | * |
| 286 | * @note Can be blocked in forward mapm_analysis_of_results() |
| 287 | * |
| 288 | * @param map Nextmap |
| 289 | * @param type Type of vote, used const VOTE_BY_* |
| 290 | * @param total_votes Count of players votes |
| 291 | * |
| 292 | * @noreturn |
| 293 | */ |
| 294 | forward mapm_vote_finished(const map[], type, total_votes); |
| 295 | |