Dear me, I should have committed this long ago...
1) Added natives to create and manipulate global and private forward
2) Added natives to call forwards and functions
3) Added an IChanageableForward::RemoveFunction overload for convenience or something
4) Added test suite plugins for functions and forwards
5) Some random touch-ups to some include files
3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is part of the SourceMod/SourcePawn SDK. This file may only be used
8 * or modified under the Terms and Conditions of its License Agreement, which is found
9 * in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
10 * may change at any time. To view the latest information, see:
11 * http://www.sourcemod.net/license.php
16 #if defined _clients_included
19 #define _clients_included
22 * Called on client connection.
24 * @param client Player index.
25 * @param rejectmsg Buffer to store the rejection message when the connection is refused.
26 * @param maxlen Maximum number of characters for rejection buffer.
27 * @return True to validate client's connection, false to refuse it.
29 forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
32 * Called when a client is entering to the game.
34 * @param client Player index.
37 forward OnClientPutInServer(client);
40 * Called when a client is disconnecting from the server.
42 * @param client Player index.
45 forward OnClientDisconnect(client);
48 * Called when a client is disconnected from the server.
50 * @param client Player index.
53 forward OnClientDisconnect_Post(client);
56 * Called when a client is sending a command.
58 * @param client Player index.
59 * @param args Number of arguments.
62 forward Action:OnClientCommand(client, args);
65 * Called whenever the client's settings are changed.
67 * @param client Player index.
70 forward OnClientSettingsChanged(client);
73 * Called when a client receives a Steam ID.
74 * @note This is called by bots, but the ID will be "BOT"
76 * @param client Player index.
77 * @param auth Player auth string.
79 forward OnClientAuthorized(client, const String:auth[]);
82 * Returns the maximum number of clients allowed on the server.
84 * @return Maximum number of clients allowed.
86 native GetMaxClients();
89 * Returns the client count put in the server.
91 * @param inGameOnly If false connecting players are also counted.
92 * @return Client count in the server.
94 native GetClientCount(bool:inGameOnly=true);
97 * Returns the client's name.
99 * @param client Player index.
100 * @param name Buffer to store the client's name.
101 * @param maxlen Maximum length of string buffer (includes NULL terminator).
102 * @return True on success, false otherwise.
103 * @error If the client is not connected an error will be thrown.
105 native bool:GetClientName(client, String:name[], maxlen);
108 * Retrieves a client's IP address.
110 * @param client Player index.
111 * @param name Buffer to store the client's ip address.
112 * @param maxlen Maximum length of string buffer (includes NULL terminator).
113 * @param remport Remove client's port from the ip string (true by default).
114 * @return True on success, false otherwise.
115 * @error If the client is not connected or the index is invalid.
117 native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
120 * Retrieves a client's authentication string (SteamID).
122 * @param client Player index.
123 * @param auth Buffer to store the client's auth string.
124 * @param maxlen Maximum length of string buffer (includes NULL terminator).
125 * @return True on success, false otherwise.
126 * @error If the client is not connected or the index is invalid.
128 native bool:GetClientAuthString(client, String:auth[], maxlen);
131 * Retrieves a client's user id, which is an index incremented for every client
132 * that joins the server.
134 * @param client Player index.
135 * @return User id of the client.
136 * @error If the client is not connected or the index is invalid.
138 native GetClientUserId(client);
141 * Returns if a certain player is connected.
143 * @param client Player index.
144 * @return True if player is connected to the server, false otherwise.
146 native bool:IsClientConnected(client);
149 * Returns if a certain player has entered the game.
151 * @param client Player index.
152 * @return True if player has entered the game, false otherwise.
154 native bool:IsPlayerInGame(client);
157 * Returns if a certain player has been authenticated.
159 * @param client Player index.
160 * @return True if player has been authenticated, false otherwise.
162 native bool:IsClientAuthorized(client);
165 * Returns if a certain player is a fake client.
167 * @param client Player index.
168 * @return True if player is a fake client, false otherwise.
170 native bool:IsFakeClient(client);
173 * Retrieves values from client replicated keys.
175 * @param client Player's index.
176 * @param key Key string.
177 * @param value Buffer to store value.
178 * @param maxlen Maximum length of valve (UTF-8 safe).
179 * @return True on success, false otherwise.
180 * @error Invalid client index, or client not connected.
182 native bool:GetClientInfo(client, const String:key[], String:value[], maxlen);
185 * Sets a client's AdminId.
187 * @param client Player's index.
188 * @param id AdminId to set. INVALID_ADMIN_ID removes admin permissions.
189 * @param temp True if the id should be freed on disconnect.
191 * @error Invalid client index, client not connected, or bogus AdminId.
193 native SetUserAdmin(client, AdminId:id, bool:temp=false);
196 * Retrieves a client's AdminId.
198 * @param client Player's index.
199 * @return AdminId of the client, or INVALID_ADMIN_ID if none.
200 * @error Invalid client index, or client not connected.
202 native AdminId:GetUserAdmin(client);
205 * Sets access flags on a client. If the client is not an admin,
206 * a temporary, anonymous AdminId is given.
208 * @param client Player's index.
209 * @param ... Flags to set on the client.
211 * @error Invalid client index, or client not connected.
213 native AddUserFlags(client, {AdminFlag}:...);
216 * Removes flags from a client. If the client is not an admin,
217 * this has no effect.
219 * @param client Player's index.
220 * @param ... Flags to remove from the client.
222 * @error Invalid client index, or client not connected.
224 native RemoveUserFlags(client, {AdminFlag}:...);
227 * Sets access flags on a client using bits instead of flags. If the
228 * client is not an admin, and flags not 0, a temporary, anonymous AdminId is given.
230 * @param client Player's index.
231 * @param flags Bitstring of flags to set on client.
234 native SetUserFlagBits(client, flags);
237 * Returns client access flags. If the client is not an admin,
238 * the result is always 0.
240 * @param client Player's index.
242 * @error Invalid client index, or client not connected.
244 native GetUserFlagBits(client);
247 * Returns whether a user can target another user.
248 * This is a helper function for CanAdminTarget.
250 * @param client Player's index.
251 * @param target Target player's index.
252 * @return True if target is targettable by the player, false otherwise.
253 * @error Invalid or unconnected player indexers.
255 native bool:CanUserTarget(client, target);
258 * Creates a fake client.
260 * @param name Name to use.
261 * @return Client index on success, 0 otherwise.
263 native CreateFakeClient(const String:name[]);
266 * Sets a convar value on a fake client.
268 * @param client Client index.
269 * @param cvar ConVar name.
270 * @param value ConVar value.
272 * @error Invalid client index, client not connected,
273 * or client not a fake client.
275 native SetFakeClientConVar(client, const String:cvar[], const String:value[]);