5 #if defined _sourcemod_included
8 #define _sourcemod_included
12 const String:name[], /* Plugin Name */
13 const String:description[], /* Plugin Description */
14 const String:author[], /* Plugin Author */
15 const String:version[], /* Plugin Version */
16 const String:url[], /* Plugin URL */
25 * Declare this as a struct in your plugin to expose its information.
28 * public Plugin:myinfo =
37 * Called when the plugin is fully initialized and all known external references are resolved.
38 * This is called even if the plugin type is "private."
39 * NOTE: Errors in this function will cause the plugin to stop running.
43 forward OnPluginInit(Handle:myself);
46 * Called before OnPluginInit, in case the plugin wants to check for load failure.
47 * This is called even if the plugin type is "private." Any natives from modules are
48 * not available at this point. Thus, this forward should only be used for explicit
49 * pre-emptive things, such as adding dynamic natives, or setting certain types of load filters.
51 * NOTE: It is not safe to call externally resolved natives until OnPluginInit().
52 * NOTE: Any sort of RTE in this function will cause the plugin to fail loading.
54 * @param myself Handle to the plugin.
55 * @param late Whether or not the plugin was loaded "late" (after map load).
56 * @param error Error message buffer in case load failed.
57 * @param err_max Maximum number of characters for error message buffer.
58 * @return True if load success, false otherwise.
60 forward bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max);
63 * Called when the plugin is about to be unloaded.
67 forward OnPluginUnload();
70 * Called when the plugin's pause status is changing.
72 * @param pause True if the plugin is being paused, false otherwise.
75 forward OnPluginPauseChange(bool:pause);
78 * Called on client connection.
80 * @param client Player index.
81 * @param rejectmsg Buffer to store the rejection message when the connection is refused.
82 * @param maxlen Maximum number of characters for rejection buffer.
83 * @return True to validate client's connection, false to refuse it.
85 forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
88 * Called when a client is entering to the game.
90 * @param client Player index.
93 forward OnClientPutInServer(client);
96 * Called when a client is disconnecting from the server.
98 * @param client Player index.
101 forward OnClientDisconnect(client);
104 * Called when a client is disconnected from the server.
106 * @param client Player index.
109 forward OnClientDisconnect_Post(client);
112 * Called when a client is sending a command.
114 * @param client Player index.
117 forward OnClientCommand(client);
120 * Called whenever the client's settings are changed.
122 * @param client Player index.
125 forward OnClientSettingsChanged(client);
128 * Returns the maximum number of clients allowed on the server.
130 * @return Maximum number of clients allowed.
132 native GetMaxClients();
135 * Returns the client count put in the server.
137 * @param inGameOnly If false connecting players are also counted.
138 * @return Client count in the server.
140 native GetClientCount(bool:inGameOnly=true);
143 * Returns the client's name.
145 * @param client Player index.
146 * @param name Buffer to store the client's name.
147 * @param maxlen Maximum length of string buffer (includes NULL terminator).
148 * @return True on success, false otherwise.
149 * @error If the client is not connected an error will be thrown.
151 native bool:GetClientName(client, String:name[], maxlen);
154 * Retrieves a client's IP address.
156 * @param client Player index.
157 * @param name Buffer to store the client's ip address.
158 * @param maxlen Maximum length of string buffer (includes NULL terminator).
159 * @param remport Remove client's port from the ip string (true by default).
160 * @return True on success, false otherwise.
161 * @error If the client is not connected an error will be thrown.
163 native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
166 * Retrieves a client's authentication string (SteamID).
168 * @param client Player index.
169 * @param auth Buffer to store the client's auth string.
170 * @param maxlen Maximum length of string buffer (includes NULL terminator).
171 * @return True on success, false otherwise.
172 * @error If the client is not connected an error will be thrown.
174 native bool:GetClientAuthString(client, String:auth[], maxlen);
177 * Returns if a certain player is connected.
179 * @param client Player index.
180 * @return True if player is connected to the server, false otherwise.
182 native bool:IsPlayerConnected(client);
185 * Returns if a certain player has entered the game.
187 * @param client Player index.
188 * @return True if player has entered the game, false otherwise.
190 native bool:IsPlayerInGame(client);
193 * Returns if a certain player has been authenticated.
195 * @param client Player index.
196 * @return True if player has been authenticated, false otherwise.
198 native bool:IsPlayerAuthorized(client);
201 * Returns if a certain player is a fake client.
203 * @param client Player index.
204 * @return True if player is a fake client, false otherwise.
206 native bool:IsPlayerFakeClient(client);
209 * Sends a message to the server console.
211 * @param format Formatting rules.
212 * @param ... Variable number of format parameters.
215 native PrintToServer(const String:format[], {Handle,Float,String,_}:...);
218 * Sends a message to a client's console.
220 * @param client Player index.
221 * @param format Formatting rules.
222 * @param ... Variable number of format parameters.
224 * @error If the client is not connected an error will be thrown.
226 native PrintToConsole(client, const String:format[], {Handle,Float,String,_}:...);