-
Notifications
You must be signed in to change notification settings - Fork 2
/
multimod_manager_natives.inc
212 lines (189 loc) · 5.74 KB
/
multimod_manager_natives.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#if defined _multimod_manager_natives_included_
#endinput
#endif
#define _multimod_manager_natives_included_
/**
* Multimod Manager version check.
* Do not modify this!
*/
#define MM_VERSION_MAJOR 2
#define MM_VERSION_MINOR 1
#define MM_VERSION_PATCH 0
enum ChangeMap_e
{
CHANGEMAP_TIMELEFT,
CHANGEMAP_END_OF_ROUND,
CHANGEMAP_ONE_MORE_ROUND,
};
/* ===========================================================================
* [ MULTIMOD MANAGER NATIVES ]
* ============================================================================ */
/**
* Return the loaded mods count.
*
* @return (int) Number of loaded mods.
*/
native mm_get_mods_count();
/**
* Return if the mod is enabled or not.
*
* @param iModId Mod index.
*
* @return (bool) true if the mod is enabled, false otherwise.
*/
native bool:mm_get_mod_enabled(const iModId);
/**
* Retrieves mod name.
*
* @note If the destination buffer is too small to hold the source string, the
* destination will be truncated.
*
* @param iModId Mod index.
* @param szOutput Buffer to copy mod name to.
* @param iLen Buffer size.
*
* @return (int) -1 on error.
* >= 0 Number of cells written.
*/
native mm_get_mod_name(const iModId, szOutput[], const iLen);
/**
* Retrieves mod tag.
*
* @note If the destination buffer is too small to hold the source string, the
* destination will be truncated.
*
* @param iModId Mod index.
* @param szOutput Buffer to copy mod tag to.
* @param iLen Buffer size.
*
* @return (int) -1 on error.
* >= 0 Number of cells written.
*/
native mm_get_mod_tag(const iModId, szOutput[], const iLen);
/**
* Return the mod changemap type.
*
* @note See 'ChangeMap_e' enum for more information.
*
* @param iModId Mod index.
*
* @return (int) 0 on change map timeleft.
* 1 on change map end of round.
* 2 on change map one more round.
*/
native ChangeMap_e:mm_get_mod_changemap_type(const iModId);
/**
* Return the maps list of the mod.
*
* @param iModId Mod index.
*
* @return (Array) Maps list array handle, which must be freed via ArrayDestroy()
*/
native Array:mm_get_mod_maps(const iModId);
/**
* Return the cvars list of the mod.
*
* @param iModId Mod index.
*
* @return (Array) Cvars list array handle, which must be freed via ArrayDestroy()
*/
native Array:mm_get_mod_cvars(const iModId);
/**
* Return the plugin list of the mod.
*
* @param iModId Mod index.
*
* @return (Array) Plugins list array handle, which must be freed via ArrayDestroy()
*/
native Array:mm_get_mod_plugins(const iModId);
/**
* Return the current mod index based on JSON position.
*
* @return (int) Index of the current mod.
*/
native mm_get_currentmod_id();
/**
* Return the next mod index based on JSON position if nextmod is already chosen.
*
* @return (int) -1 if nextmod is not chosen yet.
* >= 0 Index of the next mod.
*/
native mm_get_nextmod_id();
/**
* Force a votemod.
*
* @return (bool) true on success, false otherwise
*/
native bool:mm_force_votemod();
/**
* Force a map change.
*
* @param iModId Mod index.
* @param szMap Map to change to.
* @param flChangeTime Time to wait before changing map.
* 0.0 to change map immediately.
*
* @return (bool) true on success, false otherwise.
*/
native bool:mm_force_change_map(const iModId, const sMap[], const Float:flChangeTime = 0.0);
/* ===========================================================================
* [ MULTIMOD MANAGER FORWARDS ]
* ============================================================================ */
/**
* Called when a votemod gets started
*
* @param bSecondVote True if this is the second votemod for tiebreaker
*/
forward multimod_start_votemod(const bool:bSecondVote);
/**
* Called when a votemod gets ended
*
* @param bSecondVote True if this is the second votemod for tiebreaker
*/
forward multimod_end_votemod(const bool:bSecondVote);
/**
* Called when a votemap gets started
*
* @param bSecondVote True if this is the second votemap for tiebreaker
*/
forward multimod_start_votemap(const bool:bSecondVote);
/**
* Called when a votemap gets ended
*
* @param bSecondVote True if this is the second votemap for tiebreaker
*/
forward multimod_end_votemap(const bool:bSecondVote);
/**
* Called when a admin forces a votemod
*
* @param iAdminId Admin index
*
* @return PLUGIN_CONTINUE to let the admin force a votemod
* PLUGIN_HANDLED or higher to stop the admin from forcing a votemod
*/
forward multimod_admin_force_votemod(const iAdminId);
/**
* This is the callback from the plugin core that gives major/minor versions for verifying compatibility for Multimod Manager versions.
* If an AMXX plugin gets a failure, then you do need to upgrade to the latest version of the Multimod Manager or update the files included for AMXX plugins.
* Do not modify this!
*
* Ported function from ReAPI include.
*/
forward __multimod_version_check(const majorVersion, const minorVersion);
public __multimod_version_check(const majorVersion, const minorVersion)
{
if(majorVersion != MM_VERSION_MAJOR)
{
new szTemp[512];
formatex(szTemp, charsmax(szTemp), "[MULTIMOD]: Api major version mismatch; expected %d, real %d", MM_VERSION_MAJOR, majorVersion);
set_fail_state(szTemp);
return;
}
if(minorVersion < MM_VERSION_MINOR)
{
new szTemp[512];
formatex(szTemp, charsmax(szTemp), "[MULTIMOD]: Api minor version mismatch; expected at least %d, real %d", MM_VERSION_MINOR, minorVersion);
set_fail_state(szTemp);
return;
}
}