-
Notifications
You must be signed in to change notification settings - Fork 2
/
multimod_manager_natives.inc
163 lines (146 loc) · 4.71 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
#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 1
#define MM_VERSION_MINOR 2
#define MM_VERSION_PATCH 0
/* ===========================================================================
* [ MULTIMOD MANAGER NATIVES ]
* ============================================================================ */
/**
* Return the current mod index based on JSON position.
*
* @return (int) Index of the current mod.
*/
native mm_get_mod_id();
/**
* 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 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();
/**
* Retrieves next mod name.
*
* @note If the destination buffer is too small to hold the source string, the
* destination will be truncated.
*
* @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_nextmod_name(szOutput[], const iLen);
/**
* 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;
}
}