2 * ===============================================================
3 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
4 * ===============================================================
6 * This file is part of the SourceMod/SourcePawn SDK. This file may only be used
7 * or modified under the Terms and Conditions of its License Agreement, which is found
8 * in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
9 * may change at any time. To view the latest information, see:
10 * http://www.sourcemod.net/license.php
15 #if defined _sourcemod_included
18 #define _sourcemod_included
22 const String:name[], /* Plugin Name */
23 const String:description[], /* Plugin Description */
24 const String:author[], /* Plugin Author */
25 const String:version[], /* Plugin Version */
26 const String:url[], /* Plugin URL */
37 * Declare this as a struct in your plugin to expose its information.
40 * public Plugin:myinfo =
49 * Called when the plugin is fully initialized and all known external references are resolved.
50 * This is called even if the plugin type is "private."
51 * NOTE: Errors in this function will cause the plugin to stop running.
55 forward OnPluginStart(Handle:myself);
58 * Called before OnPluginInit, in case the plugin wants to check for load failure.
59 * This is called even if the plugin type is "private." Any natives from modules are
60 * not available at this point. Thus, this forward should only be used for explicit
61 * pre-emptive things, such as adding dynamic natives, or setting certain types of load filters.
63 * NOTE: It is not safe to call externally resolved natives until OnPluginInit().
64 * NOTE: Any sort of RTE in this function will cause the plugin to fail loading.
66 * @param myself Handle to the plugin.
67 * @param late Whether or not the plugin was loaded "late" (after map load).
68 * @param error Error message buffer in case load failed.
69 * @param err_max Maximum number of characters for error message buffer.
70 * @return True if load success, false otherwise.
72 forward bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max);
75 * Called when the plugin is about to be unloaded.
79 forward OnPluginEnd();
82 * Called when the plugin's pause status is changing.
84 * @param pause True if the plugin is being paused, false otherwise.
87 forward OnPluginPauseChange(bool:pause);
90 * Called on client connection.
92 * @param client Player index.
93 * @param rejectmsg Buffer to store the rejection message when the connection is refused.
94 * @param maxlen Maximum number of characters for rejection buffer.
95 * @return True to validate client's connection, false to refuse it.
97 forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
100 * Called when a client is entering to the game.
102 * @param client Player index.
105 forward OnClientPutInServer(client);
108 * Called when a client is disconnecting from the server.
110 * @param client Player index.
113 forward OnClientDisconnect(client);
116 * Called when a client is disconnected from the server.
118 * @param client Player index.
121 forward OnClientDisconnect_Post(client);
124 * Called when a client is sending a command.
126 * @param client Player index.
129 forward OnClientCommand(client);
132 * Called whenever the client's settings are changed.
134 * @param client Player index.
137 forward OnClientSettingsChanged(client);
140 * Returns the maximum number of clients allowed on the server.
142 * @return Maximum number of clients allowed.
144 native GetMaxClients();
147 * Returns the client count put in the server.
149 * @param inGameOnly If false connecting players are also counted.
150 * @return Client count in the server.
152 native GetClientCount(bool:inGameOnly=true);
155 * Returns the client's name.
157 * @param client Player index.
158 * @param name Buffer to store the client's name.
159 * @param maxlen Maximum length of string buffer (includes NULL terminator).
160 * @return True on success, false otherwise.
161 * @error If the client is not connected an error will be thrown.
163 native bool:GetClientName(client, String:name[], maxlen);
166 * Retrieves a client's IP address.
168 * @param client Player index.
169 * @param name Buffer to store the client's ip address.
170 * @param maxlen Maximum length of string buffer (includes NULL terminator).
171 * @param remport Remove client's port from the ip string (true by default).
172 * @return True on success, false otherwise.
173 * @error If the client is not connected an error will be thrown.
175 native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
178 * Retrieves a client's authentication string (SteamID).
180 * @param client Player index.
181 * @param auth Buffer to store the client's auth string.
182 * @param maxlen Maximum length of string buffer (includes NULL terminator).
183 * @return True on success, false otherwise.
184 * @error If the client is not connected an error will be thrown.
186 native bool:GetClientAuthString(client, String:auth[], maxlen);
189 * Returns if a certain player is connected.
191 * @param client Player index.
192 * @return True if player is connected to the server, false otherwise.
194 native bool:IsPlayerConnected(client);
197 * Returns if a certain player has entered the game.
199 * @param client Player index.
200 * @return True if player has entered the game, false otherwise.
202 native bool:IsPlayerInGame(client);
205 * Returns if a certain player has been authenticated.
207 * @param client Player index.
208 * @return True if player has been authenticated, false otherwise.
210 native bool:IsPlayerAuthorized(client);
213 * Returns if a certain player is a fake client.
215 * @param client Player index.
216 * @return True if player is a fake client, false otherwise.
218 native bool:IsPlayerFakeClient(client);
221 * Sends a message to the server console.
223 * @param format Formatting rules.
224 * @param ... Variable number of format parameters.
227 native PrintToServer(const String:format[], {Handle,Float,String,_}:...);
230 * Sends a message to a client's console.
232 * @param client Player index.
233 * @param format Formatting rules.
234 * @param ... Variable number of format parameters.
236 * @error If the client is not connected an error will be thrown.
238 native PrintToConsole(client, const String:format[], {Handle,Float,String,_}:...);
241 * Logs a generic message to the HL2 logs.
243 * @param format String format.
244 * @param ... Format arguments.
247 native LogToGame(const String:format[], {Handle,Float,String,_}:...);
250 * Logs a plugin message to the SourceMod logs.
252 * @param format String format.
253 * @param ... Format arguments.
256 native LogMessage(const String:format[], {Handle,Float,String,_}:...);
259 * Logs a plugin error message to the SourceMod logs.
261 * @param format String format.
262 * @param ... Format arguments.
265 native LogError(const String:format[], {Handle,Float,String,_}:...);