2006-11-08 10:28:32 +01:00
|
|
|
/**
|
|
|
|
* :TODO: license info
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined _sourcemod_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _sourcemod_included
|
|
|
|
|
2006-11-10 01:16:33 +01:00
|
|
|
struct Plugin
|
|
|
|
{
|
|
|
|
const String:name[], /* Plugin Name */
|
|
|
|
const String:description[], /* Plugin Description */
|
|
|
|
const String:author[], /* Plugin Author */
|
|
|
|
const String:version[], /* Plugin Version */
|
|
|
|
const String:url[], /* Plugin URL */
|
2007-01-01 04:33:14 +01:00
|
|
|
};
|
2006-11-10 01:16:33 +01:00
|
|
|
|
2007-01-01 20:50:16 +01:00
|
|
|
#include <float>
|
|
|
|
#include <handles>
|
|
|
|
#include <string>
|
2007-01-01 22:46:33 +01:00
|
|
|
#include <files>
|
2007-01-01 20:50:16 +01:00
|
|
|
|
2006-11-08 10:28:32 +01:00
|
|
|
/**
|
2006-11-10 01:16:33 +01:00
|
|
|
* Declare this as a struct in your plugin to expose its information.
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* public Plugin:myinfo =
|
|
|
|
* {
|
|
|
|
* name = "My Plugin",
|
|
|
|
* //etc
|
|
|
|
* };
|
2006-11-08 10:28:32 +01:00
|
|
|
*/
|
2006-11-10 01:16:33 +01:00
|
|
|
public Plugin:myinfo;
|
2006-11-08 10:28:32 +01:00
|
|
|
|
|
|
|
/**
|
2006-12-15 14:45:21 +01:00
|
|
|
* Called when the plugin is fully initialized and all known external references are resolved.
|
|
|
|
* This is called even if the plugin type is "private."
|
|
|
|
* NOTE: Errors in this function will cause the plugin to stop running.
|
2006-11-08 10:28:32 +01:00
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
2006-12-15 14:45:21 +01:00
|
|
|
forward OnPluginInit(Handle:myself);
|
2006-11-08 10:28:32 +01:00
|
|
|
|
|
|
|
/**
|
2006-12-15 14:45:21 +01:00
|
|
|
* Called before OnPluginInit, in case the plugin wants to check for load failure.
|
|
|
|
* This is called even if the plugin type is "private." Any natives from modules are
|
|
|
|
* not available at this point. Thus, this forward should only be used for explicit
|
|
|
|
* pre-emptive things, such as adding dynamic natives, or setting certain types of load filters.
|
|
|
|
*
|
|
|
|
* NOTE: It is not safe to call externally resolved natives until OnPluginInit().
|
|
|
|
* NOTE: Any sort of RTE in this function will cause the plugin to fail loading.
|
2006-11-08 10:28:32 +01:00
|
|
|
*
|
|
|
|
* @param myself Handle to the plugin.
|
|
|
|
* @param late Whether or not the plugin was loaded "late" (after map load).
|
|
|
|
* @param error Error message buffer in case load failed.
|
|
|
|
* @param err_max Maximum number of characters for error message buffer.
|
2007-01-01 04:33:14 +01:00
|
|
|
* @return True if load success, false otherwise.
|
2006-11-08 10:28:32 +01:00
|
|
|
*/
|
2006-12-15 14:45:21 +01:00
|
|
|
forward bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max);
|
2006-11-08 10:28:32 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the plugin is about to be unloaded.
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
forward OnPluginUnload();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the plugin's pause status is changing.
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
forward OnPluginPauseChange(bool:pause);
|
2007-01-01 04:33:14 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called on client connection.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @param rejectmsg Buffer to store the rejection message when the connection is refused.
|
|
|
|
* @param maxlen Maximum number of characters for rejection buffer.
|
|
|
|
* @return True to validate client's connection, false to refuse it.
|
|
|
|
*/
|
|
|
|
forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is entering to the game.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
forward OnClientPutInServer(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is disconnecting from the server.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
forward OnClientDisconnect(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is disconnected from the server.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
forward OnClientDisconnect_Post(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is sending a command.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
forward OnClientCommand(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called whenever the client's settings are changed.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
forward OnClientSettingsChanged(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the maximum number of clients allowed on the server.
|
|
|
|
*
|
|
|
|
* @return Maximum number of clients allowed.
|
|
|
|
*/
|
|
|
|
native GetMaxClients();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client count put in the server.
|
|
|
|
*
|
|
|
|
* @param inGameOnly If false connecting players are also counted.
|
|
|
|
* @return Client count in the server.
|
|
|
|
*/
|
|
|
|
native GetClientCount(bool:inGameOnly=true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's name.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @param name Buffer to store the client's name.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
2007-01-01 22:46:33 +01:00
|
|
|
* @return True on success, false otherwise.
|
2007-01-02 00:14:20 +01:00
|
|
|
* @error If the client is not connected an error will be thrown.
|
2007-01-01 04:33:14 +01:00
|
|
|
*/
|
2007-01-01 22:46:33 +01:00
|
|
|
native bool:GetClientName(client, String:name[], maxlen);
|
2007-01-01 04:33:14 +01:00
|
|
|
|
|
|
|
/**
|
2007-01-01 19:03:43 +01:00
|
|
|
* Retrieves a client's IP address.
|
2007-01-01 04:33:14 +01:00
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @param name Buffer to store the client's ip address.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
2007-01-01 22:46:33 +01:00
|
|
|
* @return True on success, false otherwise.
|
2007-01-02 00:14:20 +01:00
|
|
|
* @error If the client is not connected an error will be thrown.
|
2007-01-01 04:33:14 +01:00
|
|
|
*/
|
2007-01-01 22:46:33 +01:00
|
|
|
native bool:GetClientIP(client, String:ip[], maxlen);
|
2007-01-01 04:33:14 +01:00
|
|
|
|
|
|
|
/**
|
2007-01-01 19:03:43 +01:00
|
|
|
* Retrieves a client's authentication string (SteamID).
|
2007-01-01 04:33:14 +01:00
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @param auth Buffer to store the client's auth string.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
2007-01-01 22:46:33 +01:00
|
|
|
* @return True on success, false otherwise.
|
2007-01-02 00:14:20 +01:00
|
|
|
* @error If the client is not connected an error will be thrown.
|
2007-01-01 04:33:14 +01:00
|
|
|
*/
|
2007-01-01 22:46:33 +01:00
|
|
|
native bool:GetClientAuthString(client, String:auth[], maxlen);
|
2007-01-01 04:33:14 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player is connected.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player is connected to the server, false otherwise.
|
|
|
|
*/
|
|
|
|
native bool:IsPlayerConnected(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player has entered the game.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player has entered the game, false otherwise.
|
|
|
|
*/
|
|
|
|
native bool:IsPlayerInGame(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player has been authenticated.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player has been authenticated, false otherwise.
|
|
|
|
*/
|
|
|
|
native bool:IsPlayerAuthorized(client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player is a fake client.
|
|
|
|
*
|
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player is a fake client, false otherwise.
|
|
|
|
*/
|
|
|
|
native bool:IsPlayerFakeClient(client);
|