Correct Plugin API Documentation Formatting (#1019)

This commit is contained in:
JoinedSenses 2019-05-28 21:38:58 -04:00 committed by Headline
parent 28036966a6
commit 81dc80fbd1
66 changed files with 6434 additions and 6331 deletions

View File

@ -60,8 +60,7 @@ enum AdminFlag
Admin_Custom3, /**< Third custom flag type */
Admin_Custom4, /**< Fourth custom flag type */
Admin_Custom5, /**< Fifth custom flag type */
Admin_Custom6, /**< Sixth custom flag type */
/* --- */
Admin_Custom6 /**< Sixth custom flag type */
};
#define AdminFlags_TOTAL 21 /**< Total number of admin flags */
@ -112,7 +111,7 @@ enum AdminFlag
enum OverrideType
{
Override_Command = 1, /**< Command */
Override_CommandGroup, /**< Command group */
Override_CommandGroup /**< Command group */
};
/**
@ -121,7 +120,7 @@ enum OverrideType
enum OverrideRule
{
Command_Deny = 0,
Command_Allow = 1,
Command_Allow = 1
};
/**
@ -130,7 +129,7 @@ enum OverrideRule
enum ImmunityType
{
Immunity_Default = 1, /**< Deprecated. */
Immunity_Global, /**< Deprecated. */
Immunity_Global /**< Deprecated. */
};
/**
@ -138,7 +137,7 @@ enum ImmunityType
*/
enum GroupId
{
INVALID_GROUP_ID = -1, /**< An invalid/non-existent group */
INVALID_GROUP_ID = -1 /**< An invalid/non-existent group */
};
/**
@ -146,7 +145,7 @@ enum GroupId
*/
enum AdminId
{
INVALID_ADMIN_ID = -1, /**< An invalid/non-existent admin */
INVALID_ADMIN_ID = -1 /**< An invalid/non-existent admin */
};
/**
@ -155,7 +154,7 @@ enum AdminId
enum AdmAccessMode
{
Access_Real, /**< Access the user has inherently */
Access_Effective, /**< Access the user has from their groups */
Access_Effective /**< Access the user has from their groups */
};
/**
@ -165,7 +164,7 @@ enum AdminCachePart
{
AdminCache_Overrides = 0, /**< Global overrides */
AdminCache_Groups = 1, /**< All groups (automatically invalidates admins too) */
AdminCache_Admins = 2, /**< All admins */
AdminCache_Admins = 2 /**< All admins */
};
methodmap AdminId {
@ -477,10 +476,11 @@ native bool GetAdmGroupCmdOverride(GroupId id, const char[] name, OverrideType t
native void RegisterAuthIdentType(const char[] name);
/**
* Creates a new admin entry in the permissions cache.
* Creates a new admin entry in the permissions cache and returns the generated AdminId index.
*
* @param name Name for this entry (does not have to be unique).
* Specify an empty string for an anonymous admin.
* @return New AdminId index or INVALID_ADMIN_ID if name is empty
*/
native AdminId CreateAdmin(const char[] name="");

View File

@ -45,7 +45,10 @@
stock int ByteCountToCells(int size)
{
if (!size)
{
return 1;
}
return (size + 3) / 4;
}
@ -92,7 +95,6 @@ methodmap ArrayList < Handle {
// @param value Value to push.
// @return Index of the new entry.
// @error Invalid Handle or out of memory.
//
public native int Push(any value);
// Pushes a string onto the end of an array, truncating it if it is too big.
@ -208,20 +210,16 @@ methodmap ArrayList < Handle {
// @error Invalid block index
public native int FindValue(any item, int block=0);
/**
* Sort an ADT Array. Specify the type as Integer, Float, or String.
*
* @param order Sort order to use, same as other sorts.
* @param type Data type stored in the ADT Array
*/
// Sort an ADT Array. Specify the type as Integer, Float, or String.
//
// @param order Sort order to use, same as other sorts.
// @param type Data type stored in the ADT Array
public native void Sort(SortOrder order, SortType type);
/**
* Custom sorts an ADT Array. You must pass in a comparison function.
*
* @param sortfunc Sort comparison function to use
* @param hndl Optional Handle to pass through the comparison calls.
*/
// Custom sorts an ADT Array. You must pass in a comparison function.
//
// @param sortfunc Sort comparison function to use
// @param hndl Optional Handle to pass through the comparison calls.
public native void SortCustom(SortFuncADTArray sortfunc, Handle hndl=INVALID_HANDLE);
// Retrieve the size of the array.

View File

@ -124,9 +124,11 @@ methodmap StringMap < Handle
}
};
// A StringMapSnapshot is created via StringMap.Snapshot(). It captures the
// keys on a map so they can be read. Snapshots must be freed with delete or
// CloseHandle().
/**
* A StringMapSnapshot is created via StringMap.Snapshot(). It captures the
* keys on a map so they can be read. Snapshots must be freed with delete or
* CloseHandle().
*/
methodmap StringMapSnapshot < Handle
{
// Returns the number of keys in the map snapshot.

View File

@ -42,7 +42,7 @@ enum CookieAccess
{
CookieAccess_Public, /**< Visible and Changeable by users */
CookieAccess_Protected, /**< Read only to users */
CookieAccess_Private, /**< Completely hidden cookie */
CookieAccess_Private /**< Completely hidden cookie */
};
/**
@ -53,7 +53,7 @@ enum CookieMenu
CookieMenu_YesNo, /**< Yes/No menu with "yes"/"no" results saved into the cookie */
CookieMenu_YesNo_Int, /**< Yes/No menu with 1/0 saved into the cookie */
CookieMenu_OnOff, /**< On/Off menu with "on"/"off" results saved into the cookie */
CookieMenu_OnOff_Int, /**< On/Off menu with 1/0 saved into the cookie */
CookieMenu_OnOff_Int /**< On/Off menu with 1/0 saved into the cookie */
};
enum CookieMenuAction
@ -71,7 +71,7 @@ enum CookieMenuAction
*
* INPUT : Client index and any data if available.
*/
CookieMenuAction_SelectOption = 1,
CookieMenuAction_SelectOption = 1
};
/**

View File

@ -42,7 +42,7 @@ enum NetFlow
{
NetFlow_Outgoing = 0, /**< Outgoing traffic */
NetFlow_Incoming, /**< Incoming traffic */
NetFlow_Both, /**< Both values added together */
NetFlow_Both /**< Both values added together */
};
/**
@ -61,7 +61,7 @@ enum AuthIdType
// The following are only available on games that support Steam authentication.
AuthId_Steam2, /**< Steam2 rendered format, ex "STEAM_1:1:4153990" */
AuthId_Steam3, /**< Steam3 rendered format, ex "[U:1:8307981]" */
AuthId_SteamID64, /**< A SteamID64 (uint64) as a String, ex "76561197968573709" */
AuthId_SteamID64 /**< A SteamID64 (uint64) as a String, ex "76561197968573709" */
};
/**
@ -237,6 +237,7 @@ forward void OnClientPostAdminCheck(int client);
* top of this file.
*
* @return Maximum number of clients allowed.
* @deprecated Use MaxClients variable instead.
*/
#pragma deprecated Use MaxClients variable instead.
native int GetMaxClients();
@ -298,6 +299,7 @@ native bool GetClientIP(int client, char[] ip, int maxlen, bool remport=true);
* You WILL KNOW if you need to use this, MOST WILL NOT.
* @return True on success, false otherwise.
* @error If the client is not connected or the index is invalid.
* @deprecated Use GetClientAuthId
*/
#pragma deprecated Use GetClientAuthId
native bool GetClientAuthString(int client, char[] auth, int maxlen, bool validate=true);

View File

@ -42,7 +42,7 @@
*/
enum QueryCookie
{
QUERYCOOKIE_FAILED = 0,
QUERYCOOKIE_FAILED = 0
};
/**
@ -51,7 +51,7 @@ enum QueryCookie
enum ReplySource
{
SM_REPLY_TO_CONSOLE = 0,
SM_REPLY_TO_CHAT = 1,
SM_REPLY_TO_CHAT = 1
};
/**
@ -580,12 +580,12 @@ native bool SetCommandFlags(const char[] name, int flags);
* @param description Buffer to store the description, empty if no description present.
* @param descrmax_size Maximum size of the description buffer.
* @return On success, a ConCmdIter Handle is returned, which
* can be read via FindNextConCommand(), and must be
* closed via CloseHandle(). Additionally, the output
* parameters will be filled with information of the
* first ConCommandBase entry.
* On failure, INVALID_HANDLE is returned, and the
* contents of outputs is undefined.
can be read via FindNextConCommand(), and must be
closed via CloseHandle(). Additionally, the output
parameters will be filled with information of the
first ConCommandBase entry.
On failure, INVALID_HANDLE is returned, and the
contents of outputs is undefined.
*/
native Handle FindFirstConCommand(char[] buffer, int max_size, bool &isCommand, int &flags=0, char[] description="", int descrmax_size=0);
@ -596,14 +596,14 @@ native Handle FindFirstConCommand(char[] buffer, int max_size, bool &isCommand,
* @param buffer Buffer to store entry name.
* @param max_size Maximum size of the buffer.
* @param isCommand Variable to store whether the entry is a command.
* If it is not a command, it is a ConVar.
If it is not a command, it is a ConVar.
* @param flags Variable to store entry flags.
* @param description Buffer to store the description, empty if no description present.
* @param descrmax_size Maximum size of the description buffer.
* @return On success, the outputs are filled, the iterator is
* advanced to the next entry, and true is returned.
* If no more entries exist, false is returned, and the
* contents of outputs is undefined.
advanced to the next entry, and true is returned.
If no more entries exist, false is returned, and the
contents of outputs is undefined.
*/
native bool FindNextConCommand(Handle search, char[] buffer, int max_size, bool &isCommand, int &flags=0, char[] description="", int descrmax_size=0);
@ -700,7 +700,7 @@ stock bool CommandExists(const char[] command)
* @param sArgs Chat argument string.
*
* @return An Action value. Returning Plugin_Handled bypasses the game function call.
Returning Plugin_Stop bypasses the post hook as well as the game function.
* Returning Plugin_Stop bypasses the post hook as well as the game function.
*/
forward Action OnClientSayCommand(int client, const char[] command, const char[] sArgs);

View File

@ -55,25 +55,29 @@ enum ConVarQueryResult
ConVarQuery_Protected //< Client convar was found, but it is protected. The server cannot retrieve its value. */
};
// Called when a console variable's value is changed.
//
// @param convar Handle to the convar that was changed.
// @param oldValue String containing the value of the convar before it was changed.
// @param newValue String containing the new value of the convar.
/**
* Called when a console variable's value is changed.
*
* @param convar Handle to the convar that was changed.
* @param oldValue String containing the value of the convar before it was changed.
* @param newValue String containing the new value of the convar.
*/
typedef ConVarChanged = function void (ConVar convar, const char[] oldValue, const char[] newValue);
// Creates a new console variable.
//
// @param name Name of new convar.
// @param defaultValue String containing the default value of new convar.
// @param description Optional description of the convar.
// @param flags Optional bitstring of flags determining how the convar should be handled. See FCVAR_* constants for more details.
// @param hasMin Optional boolean that determines if the convar has a minimum value.
// @param min Minimum floating point value that the convar can have if hasMin is true.
// @param hasMax Optional boolean that determines if the convar has a maximum value.
// @param max Maximum floating point value that the convar can have if hasMax is true.
// @return A handle to the newly created convar. If the convar already exists, a handle to it will still be returned.
// @error Convar name is blank or is the same as an existing console command.
/**
* Creates a new console variable.
*
* @param name Name of new convar.
* @param defaultValue String containing the default value of new convar.
* @param description Optional description of the convar.
* @param flags Optional bitstring of flags determining how the convar should be handled. See FCVAR_* constants for more details.
* @param hasMin Optional boolean that determines if the convar has a minimum value.
* @param min Minimum floating point value that the convar can have if hasMin is true.
* @param hasMax Optional boolean that determines if the convar has a maximum value.
* @param max Maximum floating point value that the convar can have if hasMax is true.
* @return A handle to the newly created convar. If the convar already exists, a handle to it will still be returned.
* @error Convar name is blank or is the same as an existing console command.
*/
native ConVar CreateConVar(
const char[] name,
const char[] defaultValue,
@ -82,10 +86,12 @@ native ConVar CreateConVar(
bool hasMin=false, float min=0.0,
bool hasMax=false, float max=0.0);
// Searches for a console variable.
//
// @param name Name of convar to find.
// @return A ConVar object if found; null otherwise.
/**
* Searches for a console variable.
*
* @param name Name of convar to find.
* @return A ConVar object if found; null otherwise.
*/
native ConVar FindConVar(const char[] name);
// A ConVar is a configurable, named setting in the srcds console.

View File

@ -56,7 +56,7 @@ enum Action
Plugin_Continue = 0, /**< Continue with the original action */
Plugin_Changed = 1, /**< Inputs or outputs have been overridden with new values */
Plugin_Handled = 3, /**< Handle the action at the end (don't call it) */
Plugin_Stop = 4, /**< Immediately stop the hook chain and handle the original */
Plugin_Stop = 4 /**< Immediately stop the hook chain and handle the original */
};
/**
@ -116,7 +116,7 @@ enum PluginInfo
PlInfo_Author, /**< Plugin author */
PlInfo_Description, /**< Plugin description */
PlInfo_Version, /**< Plugin version */
PlInfo_URL, /**< Plugin URL */
PlInfo_URL /**< Plugin URL */
};
/**

View File

@ -71,7 +71,7 @@ enum CSRoundEndReason
CSRoundEnd_TerroristsSurrender, /**< Terrorists Surrender */
CSRoundEnd_CTSurrender, /**< CTs Surrender */
CSRoundEnd_TerroristsPlanted, /**< Terrorists Planted the bomb */
CSRoundEnd_CTsReachedHostage, /**< CTs Reached the hostage */
CSRoundEnd_CTsReachedHostage /**< CTs Reached the hostage */
};
enum CSWeaponID
@ -242,7 +242,6 @@ native void CS_SwitchTeam(int client, int team);
* @param weaponIndex Index of weapon to drop.
* @param toss True to toss weapon (with velocity) or false to just drop weapon
* @param blockhook Set to true to stop the corresponding CS_OnCSWeaponDrop
*
* @error Invalid client index, client not in game, or invalid weapon index.
*/
native void CS_DropWeapon(int client, int weaponIndex, bool toss, bool blockhook = false);
@ -275,107 +274,110 @@ native void CS_GetTranslatedWeaponAlias(const char[] alias, char[] weapon, int s
* @param id Weapon id for the weapon to check
* @param defaultprice Set to true to get defaultprice.
* @return Returns price of the weapon (even if modified)
*
* @error Invalid client, failing to get weapon info, or failing to get price offset.
*
* @note c4, knife and shield will always return 0. vest, vest helmet and night vision will always return default price.
*/
native int CS_GetWeaponPrice(int client, CSWeaponID id, bool defaultprice = false);
/**
* Gets a clients clan tag
*
* @param client Client index to get clan tag for.
* @param buffer Buffer to store clients clan tag in.
* @param size Size of the buffer.
* @return Number of non-null bytes written.
*
* @error Invalid client.
*/
native int CS_GetClientClanTag(int client, char[] buffer, int size);
/**
* Sets a clients clan tag
*
* @param client Client index to set clan tag for.
* @param tag Tag to set clients clan tag as.
*
* @error Invalid client.
*/
native void CS_SetClientClanTag(int client, const char[] tag);
/**
* Gets a team's score
*
* @param team Team index to get score for.
* @return Returns the internal team score.
*
* @error Invalid team index.
*/
native int CS_GetTeamScore(int team);
/**
* Sets a team's score
*
* @param team Team index to set score for.
* @param value Value to set teams score as.
*
* @error Invalid team index.
* @note This will update the scoreboard only after the scoreboard update function is called. Use SetTeamScore plus this to update the scoreboard instantly and save values correctly.
*
* @note This will update the scoreboard only after the scoreboard update function is called.
* Use SetTeamScore plus this to update the scoreboard instantly and save values correctly.
*/
native void CS_SetTeamScore(int team, int value);
/**
* Gets a client's mvp count
*
* @param client Client index to get mvp count of.
* @return Returns the client's internal MVP count.
*
* @error Invalid client.
*/
native int CS_GetMVPCount(int client);
/**
* Sets a client's mvp count
*
* @param client Client index to set mvp count for.
* @param value Value to set client's mvp count as.
*
* @error Invalid client.
*/
native void CS_SetMVPCount(int client, int value);
/**
* Gets a client's contribution score (CS:GO only)
*
* @param client Client index to get score of.
* @return Returns the client's score.
*
* @error Invalid client.
*/
native int CS_GetClientContributionScore(int client);
/**
* Sets a client's contribution score (CS:GO only)
*
* @param client Client index to set score for.
* @param value Value to set client's score as.
*
* @error Invalid client.
*/
native void CS_SetClientContributionScore(int client, int value);
/**
* Gets a client's assists (CS:GO only)
*
* @param client Client index to get assists of.
* @return Returns the client's assists.
*
* @error Invalid client.
*/
native int CS_GetClientAssists(int client);
/**
* Sets a client's assists (CS:GO only)
*
* @param client Client index to set assists for.
* @param value Value to set client's assists as.
*
* @error Invalid client.
*/
native void CS_SetClientAssists(int client, int value);
/**
* Gets a weaponID from a alias
*
* @param alias Weapon alias to attempt to get an id for.
* @return Returns a weapon id or 0 if failed to find a match.
*
@ -385,6 +387,7 @@ native CSWeaponID CS_AliasToWeaponID(const char[] alias);
/**
* Gets a alias from a weaponID
*
* @param weaponID WeaponID to get alias for.
* @param destination Destination string to hold the weapon alias.
* @param len Length of the destination array.
@ -394,6 +397,7 @@ native int CS_WeaponIDToAlias(CSWeaponID weaponID, char[] destination, int len);
/**
* Returns weather a WeaponID is valid on the current mod (css or csgo)
*
* @param weaponID WeaponID to check
* @return Returns true if its a valid WeaponID false otherwise.
*
@ -414,8 +418,8 @@ native void CS_UpdateClientModel(int client);
*
* @param iDefIndex Definition index to get the CSWeaponID value for.
* @return Returns CSWeaponID value for the definition index.
*
* @error Invalid definition index.
*
* @note In most cases the id will be the item definition index. Works for CS:GO ONLY.
*/
native CSWeaponID CS_ItemDefIndexToID(int iDefIndex);
@ -425,8 +429,8 @@ native CSWeaponID CS_ItemDefIndexToID(int iDefIndex);
*
* @param id CSWeaponID to get the item definition for.
* @return Returns item definition index value for the weapon id.
*
* @error Invalid weapon id.
*
* @note In most cases the item deinition index will be the id. Works for CS:GO ONLY.
*/
native int CS_WeaponIDToItemDefIndex(CSWeaponID id);

View File

@ -43,7 +43,7 @@ enum DBResult
DBVal_Error = 0, /**< Column number/field is invalid. */
DBVal_TypeMismatch = 1, /**< You cannot retrieve this data with this type. */
DBVal_Null = 2, /**< Field has no data (NULL) */
DBVal_Data = 3, /**< Field has data */
DBVal_Data = 3 /**< Field has data */
};
/**
@ -53,7 +53,7 @@ enum DBBindType
{
DBBind_Int = 0, /**< Bind an integer. */
DBBind_Float = 1, /**< Bind a float. */
DBBind_String = 2, /**< Bind a string. */
DBBind_String = 2 /**< Bind a string. */
};
/**
@ -63,7 +63,7 @@ enum DBPriority
{
DBPrio_High = 0, /**< High priority. */
DBPrio_Normal = 1, /**< Normal priority. */
DBPrio_Low = 2, /**< Low priority. */
DBPrio_Low = 2 /**< Low priority. */
};
// A Driver represents a database backend, currently MySQL or SQLite.
@ -192,8 +192,7 @@ methodmap DBResultSet < Handle
// @return Number of bytes written.
// @error Invalid field index, invalid type conversion requested
// from the database, or no current result set.
public native int FetchString(int field, char[] buffer, int maxlength,
DBResult &result=DBVal_Error);
public native int FetchString(int field, char[] buffer, int maxlength, DBResult &result=DBVal_Error);
// Fetches a float from a field in the current row of a result set.
// If the result is NULL, a value of 0.0 will be returned. A NULL
@ -257,14 +256,16 @@ typeset SQLTxnSuccess
function void (Database db, any data, int numQueries, DBResultSet[] results, any[] queryData);
}
// Callback for a failed transaction.
//
// @param db Database handle.
// @param data Data value passed to SQL_ExecuteTransaction().
// @param numQueries Number of queries executed in the transaction.
// @param error Error message.
// @param failIndex Index of the query that failed, or -1 if something else.
// @param queryData An array of each data value passed to SQL_AddQuery().
/**
* Callback for a failed transaction.
*
* @param db Database handle.
* @param data Data value passed to SQL_ExecuteTransaction().
* @param numQueries Number of queries executed in the transaction.
* @param error Error message.
* @param failIndex Index of the query that failed, or -1 if something else.
* @param queryData An array of each data value passed to SQL_AddQuery().
*/
typedef SQLTxnFailure = function void (Database db, any data, int numQueries, const char[] error, int failIndex, any[] queryData);
// A Transaction is a collection of SQL statements that must all execute
@ -315,23 +316,27 @@ methodmap DBStatement < Handle
public native void BindString(int param, const char[] value, bool copy);
};
// Callback for receiving asynchronous database connections.
//
// @param db Handle to the database connection.
// @param error Error string if there was an error. The error could be
// empty even if an error condition exists, so it is important
// to check the actual Handle value instead.
// @param data Data passed in via the original threaded invocation.
/**
* Callback for receiving asynchronous database connections.
*
* @param db Handle to the database connection.
* @param error Error string if there was an error. The error could be
* empty even if an error condition exists, so it is important
* to check the actual Handle value instead.
* @param data Data passed in via the original threaded invocation.
*/
typedef SQLConnectCallback = function void (Database db, const char[] error, any data);
// Callback for receiving asynchronous database query results.
//
// @param db Cloned handle to the database connection.
// @param results Result object, or null on failure.
// @param error Error string if there was an error. The error could be
// empty even if an error condition exists, so it is important
// to check the actual results value instead.
// @param data Data passed in via the original threaded invocation.
/**
* Callback for receiving asynchronous database query results.
*
* @param db Cloned handle to the database connection.
* @param results Result object, or null on failure.
* @param error Error string if there was an error. The error could be
* empty even if an error condition exists, so it is important
* to check the actual results value instead.
* @param data Data passed in via the original threaded invocation.
*/
typedef SQLQueryCallback = function void (Database db, DBResultSet results, const char[] error, any data);
// A Database represents a live connection to a database, either over the
@ -495,9 +500,7 @@ native Database SQL_ConnectCustom(Handle keyvalues,
* @return A database connection Handle, or INVALID_HANDLE on failure.
* On failure the error buffer will be filled with a message.
*/
stock Database SQLite_UseDatabase(const char[] database,
char[] error,
int maxlength)
stock Database SQLite_UseDatabase(const char[] database, char[] error, int maxlength)
{
KeyValues kv = new KeyValues("");
kv.SetString("driver", "sqlite");
@ -512,6 +515,7 @@ stock Database SQLite_UseDatabase(const char[] database,
/**
* This function is deprecated. Use SQL_ConnectCustom or SQLite_UseDatabase instead.
* @deprecated
*/
#pragma deprecated Use SQL_ConnectCustom instead.
native Handle SQL_ConnectEx(Handle driver,
@ -664,6 +668,7 @@ native int SQL_FormatQuery(Handle database, const char[] buffer, int maxlength,
/**
* This function is deprecated. Use SQL_EscapeString instead.
* @deprecated
*/
#pragma deprecated Use SQL_EscapeString instead.
stock bool SQL_QuoteString(Handle database,
@ -967,14 +972,16 @@ native void SQL_LockDatabase(Handle database);
*/
native void SQL_UnlockDatabase(Handle database);
// General callback for threaded SQL stuff.
//
// @param owner Parent object of the Handle (or INVALID_HANDLE if none).
// @param hndl Handle to the child object (or INVALID_HANDLE if none).
// @param error Error string if there was an error. The error could be
// empty even if an error condition exists, so it is important
// to check the actual Handle value instead.
// @param data Data passed in via the original threaded invocation.
/**
* General callback for threaded SQL stuff.
*
* @param owner Parent object of the Handle (or INVALID_HANDLE if none).
* @param hndl Handle to the child object (or INVALID_HANDLE if none).
* @param error Error string if there was an error. The error could be
* empty even if an error condition exists, so it is important
* to check the actual Handle value instead.
* @param data Data passed in via the original threaded invocation.
*/
typedef SQLTCallback = function void (Handle owner, Handle hndl, const char[] error, any data);
/**

View File

@ -41,7 +41,7 @@
enum PropType
{
Prop_Send = 0, /**< This property is networked. */
Prop_Data = 1, /**< This property is for save game data fields. */
Prop_Data = 1 /**< This property is for save game data fields. */
};
/**
@ -70,9 +70,8 @@ enum PropFieldType
PropField_String_T, /**< Valid for Data fields. Read only.
Note that the size of a string_t is dynamic, and
thus FindDataMapOffs() will return the constant size
of the string_t container (which is 32 bits right now).
*/
PropField_Variant, /**< Valid for Data fields only Type is not known at the field level,
of the string_t container (which is 32 bits right now). */
PropField_Variant /**< Valid for Data fields only Type is not known at the field level,
(for this call), but dependent on current field value. */
};
@ -285,6 +284,7 @@ native void SetEntDataFloat(int entity, int offset, float value, bool changeStat
* @param offset Offset to use.
* @return Entity index at the given location, or 0 if none.
* @error Invalid entity or offset out of reasonable bounds.
* @deprecated Use GetEntDataEnt2() instead.
*/
#pragma deprecated Use GetEntDataEnt2() instead.
native int GetEntDataEnt(int entity, int offset);
@ -302,6 +302,7 @@ native int GetEntDataEnt(int entity, int offset);
* @param other Entity index to set, or 0 to clear.
* @param changeState If true, change will be sent over the network.
* @error Invalid entity or offset out of reasonable bounds.
* @deprecated Use SetEntDataEnt2() instead.
*/
#pragma deprecated Use SetEntDataEnt2() instead.
native void SetEntDataEnt(int entity, int offset, int other, bool changeState=false);
@ -409,6 +410,7 @@ native int SetEntDataString(int entity, int offset, const char[] buffer, int max
* @param cls Classname.
* @param prop Property name.
* @return An offset, or -1 on failure.
* @deprecated Use FindSendPropInfo instead, or HasEntProp if you just want to check for existence.
*/
#pragma deprecated Use FindSendPropInfo instead, or HasEntProp if you just want to check for existence.
native int FindSendPropOffs(const char[] cls, const char[] prop);
@ -447,6 +449,7 @@ native int FindSendPropInfo(const char[] cls,
* uses. The bit count will either be 1 (for boolean) or
* divisible by 8 (including 0 if unknown).
* @return An offset, or -1 on failure.
* @deprecated Use FindDataMapInfo instead, or HasEntProp if you just want to check for existence.
*/
#pragma deprecated Use FindDataMapInfo instead, or HasEntProp if you just want to check for existence.
native int FindDataMapOffs(int entity,
@ -499,9 +502,9 @@ stock int GetEntSendPropOffs(int ent, const char[] prop, bool actual=false)
if (actual)
{
return offset;
} else {
return local;
}
return local;
}
/**
@ -515,16 +518,19 @@ stock int GetEntSendPropOffs(int ent, const char[] prop, bool actual=false)
*/
stock bool HasEntProp(int entity, PropType type, const char[] prop)
{
if (type == Prop_Data) {
if (type == Prop_Data)
{
return (FindDataMapInfo(entity, prop) != -1);
}
if (type != Prop_Send) {
if (type != Prop_Send)
{
return false;
}
char cls[64];
if (!GetEntityNetClass(entity, cls, sizeof(cls))) {
if (!GetEntityNetClass(entity, cls, sizeof(cls)))
{
return false;
}
@ -712,8 +718,10 @@ native int GetEntPropArraySize(int entity, PropType type, const char[] prop);
stock void GetEntDataArray(int entity, int offset, int[] array, int arraySize, int dataSize=4)
{
for (int i = 0; i < arraySize; i++)
{
array[i] = GetEntData(entity, offset + i*dataSize, dataSize);
}
}
/**
* Copies an array of cells to an entity at a given offset.

View File

@ -48,7 +48,7 @@ enum MoveType
MOVETYPE_NOCLIP, /**< No gravity, no collisions, still do velocity/avelocity */
MOVETYPE_LADDER, /**< Used by players only when going onto a ladder */
MOVETYPE_OBSERVER, /**< Observer movement, depends on player's observer mode */
MOVETYPE_CUSTOM, /**< Allows the entity to describe its own physics */
MOVETYPE_CUSTOM /**< Allows the entity to describe its own physics */
};
enum RenderMode
@ -63,7 +63,7 @@ enum RenderMode
RENDER_TRANSADDFRAMEBLEND, /**< use a fractional frame value to blend between animation frames */
RENDER_TRANSALPHAADD, /**< src + dest*(1-a) */
RENDER_WORLDGLOW, /**< Same as kRenderGlow but not fixed size in screen space */
RENDER_NONE, /**< Don't render. */
RENDER_NONE /**< Don't render. */
};
enum RenderFx

View File

@ -60,6 +60,7 @@ typeset EventHook
// @return Ignored for post hooks. Plugin_Handled will block event if hooked as pre.
///
function Action (Event event, const char[] name, bool dontBroadcast);
//
// Called when a game event is fired.
//
@ -206,7 +207,7 @@ native void UnhookEvent(const char[] name, EventHook callback, EventHookMode mod
* @param force If set to true, this forces the event to be created even if it's not being hooked.
* Note that this will not force it if the event doesn't exist at all.
* @return Handle to event. INVALID_HANDLE is returned if the event doesn't exist or isn't
being hooked (unless force is true).
* being hooked (unless force is true).
*/
native Event CreateEvent(const char[] name, bool force=false);

View File

@ -59,7 +59,7 @@ enum FileType
{
FileType_Unknown = 0, /* Unknown file type (device/socket) */
FileType_Directory = 1, /* File is a directory */
FileType_File = 2, /* File is a file */
FileType_File = 2 /* File is a file */
};
/**
@ -69,7 +69,7 @@ enum FileTimeMode
{
FileTime_LastAccess = 0, /* Last access (does not work on FAT) */
FileTime_Created = 1, /* Creation (does not work on FAT) */
FileTime_LastChange = 2, /* Last modification */
FileTime_LastChange = 2 /* Last modification */
};
#define PLATFORM_MAX_PATH 256 /**< Maximum path length. */
@ -427,7 +427,9 @@ stock int ReadFileCell(Handle hndl, int &data, int size)
int array[1];
if ((ret = ReadFile(hndl, array, 1, size)) == 1)
{
data = array[0];
}
return ret;
}
@ -448,8 +450,8 @@ stock int ReadFileCell(Handle hndl, int &data, int size)
stock bool WriteFileCell(Handle hndl, int data, int size)
{
int array[1];
array[0] = data;
return WriteFile(hndl, array, 1, size);
}

View File

@ -53,6 +53,7 @@ native float float(int value);
* @param oper1 First value.
* @param oper2 Second value.
* @return oper1*oper2.
* @deprecated This native is internal implementation. For multiplication use the '*' operator.
*/
#pragma deprecated This native is internal implementation. For multiplication use the '*' operator.
native float FloatMul(float oper1, float oper2);
@ -65,6 +66,7 @@ native float FloatMul(float oper1, float oper2);
* @param dividend First value.
* @param divisor Second value.
* @return dividend/divisor.
* @deprecated This native is internal implementation. For division use the '/' operator.
*/
#pragma deprecated This native is internal implementation. For division use the '/' operator.
native float FloatDiv(float dividend, float divisor);
@ -77,6 +79,7 @@ native float FloatDiv(float dividend, float divisor);
* @param oper1 First value.
* @param oper2 Second value.
* @return oper1+oper2.
* @deprecated This native is internal implementation. For addition use the '+' operator.
*/
#pragma deprecated This native is internal implementation. For addition use the '+' operator.
native float FloatAdd(float oper1, float oper2);
@ -89,6 +92,7 @@ native float FloatAdd(float oper1, float oper2);
* @param oper1 First value.
* @param oper2 Second value.
* @return oper1-oper2.
* @deprecated This native is internal implementation. For subtraction use the '-' operator.
*/
#pragma deprecated This native is internal implementation. For subtraction use the '-' operator.
native float FloatSub(float oper1, float oper2);

View File

@ -115,7 +115,7 @@ enum ExecType
* Gets a function id from a function name.
*
* @param plugin Handle of the plugin that contains the function.
Pass INVALID_HANDLE to search in the calling plugin.
* Pass INVALID_HANDLE to search in the calling plugin.
* @param name Name of the function.
* @return Function id or INVALID_FUNCTION if not found.
* @error Invalid or corrupt plugin handle.
@ -402,8 +402,9 @@ native void CreateNative(const char[] name, NativeCall func);
native int ThrowNativeError(int error, const char[] fmt, any ...);
/**
* Retrieves the string length from a native parameter string. This is useful
* Retrieves the string length from a native parameter string. This is useful for
* fetching the entire string using dynamic arrays.
*
* @note If this function succeeds, Get/SetNativeString will also succeed.
*
* @param param Parameter number, starting from 1.
@ -415,6 +416,7 @@ native int GetNativeStringLength(int param, int &length);
/**
* Retrieves a string from a native parameter.
*
* @note Output conditions are undefined on failure.
*
* @param param Parameter number, starting from 1.
@ -428,6 +430,7 @@ native int GetNativeString(int param, char[] buffer, int maxlength, int &bytes=0
/**
* Sets a string in a native parameter.
*
* @note Output conditions are undefined on failure.
*
* @param param Parameter number, starting from 1.

View File

@ -89,7 +89,7 @@ enum EngineVersion
Engine_Insurgency, /**< Insurgency (2013 Retail version)*/
Engine_Contagion, /**< Contagion */
Engine_BlackMesa, /**< Black Mesa Multiplayer */
Engine_DOI, /**< Day of Infamy */
Engine_DOI /**< Day of Infamy */
};
enum FindMapResult
@ -343,6 +343,7 @@ native void CreateDialog(int client, Handle kv, DialogType type);
* a later release will have a higher value).
*
* @return SOURCE_SDK version code.
* @deprecated See GetEngineVersion()
*/
#pragma deprecated See GetEngineVersion()
native int GuessSDKVersion();
@ -666,11 +667,10 @@ native int EntRefToEntIndex(int ref);
*/
native int MakeCompatEntRef(int ref);
enum ClientRangeType
{
RangeType_Visibility = 0,
RangeType_Audibility,
RangeType_Audibility
}
/**

View File

@ -40,7 +40,7 @@
*/
enum Handle // Tag disables introducing "Handle" as a symbol.
{
INVALID_HANDLE = 0,
INVALID_HANDLE = 0
};
@ -62,10 +62,10 @@ native void CloseHandle(Handle hndl);
* is unloaded from memory. To prevent this, the Handle may be "cloned" with a new owner.
*
* @note Usually, you will be cloning Handles for other plugins. This means that if you clone
* the Handle without specifying the new owner, it will assume the identity of your original calling
* plugin, which is not very useful. You should either specify that the receiving plugin should
* clone the handle on its own, or you should explicitly clone the Handle using the receiving plugin's
* identity Handle.
* the Handle without specifying the new owner, it will assume the identity of your original
* calling plugin, which is not very useful. You should either specify that the receiving
* plugin should clone the handle on its own, or you should explicitly clone the Handle
* using the receiving plugin's identity Handle.
*
* @param hndl Handle to clone/duplicate.
* @param plugin Optional Handle to another plugin to mark as the new owner.
@ -92,6 +92,7 @@ using __intrinsics__.Handle;
*
* @param hndl Handle to test for validity.
* @return True if handle is valid, false otherwise.
* @deprecated Do not use this function.
*/
#pragma deprecated Do not use this function.
native bool IsValidHandle(Handle hndl);

View File

@ -43,6 +43,7 @@
* @param client Client index.
* @param buffer Buffer for text.
* @param maxlength Maximum length of text.
* @deprecated Use the %L format specifier instead.
*/
#pragma deprecated Use the %L format specifier instead.
stock void FormatUserLogText(int client, char[] buffer, int maxlength)
@ -89,24 +90,34 @@ stock int SearchForClients(const char[] pattern, int[] clients, int maxClients)
int total = 0;
if (maxClients == 0)
{
return 0;
}
if (pattern[0] == '#') {
if (pattern[0] == '#')
{
int input = StringToInt(pattern[1]);
if (!input) {
char name[MAX_NAME_LENGTH];
for (int i=1; i<=MaxClients; i++) {
for (int i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i))
{
continue;
}
GetClientName(i, name, sizeof(name));
if (strcmp(name, pattern, false) == 0) {
if (strcmp(name, pattern, false) == 0)
{
clients[0] = i;
return 1;
}
}
} else {
}
else
{
int client = GetClientOfUserId(input);
if (client) {
if (client)
{
clients[0] = client;
return 1;
}
@ -117,14 +128,20 @@ stock int SearchForClients(const char[] pattern, int[] clients, int maxClients)
for (int i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i))
{
continue;
}
GetClientName(i, name, sizeof(name));
if (StrContains(name, pattern, false) != -1) {
if (StrContains(name, pattern, false) != -1)
{
clients[total++] = i;
if (total >= maxClients)
{
break;
}
}
}
return total;
}
@ -150,6 +167,7 @@ stock int FindTarget(int client, const char[] target, bool nobots = false, bool
{
flags |= COMMAND_FILTER_NO_BOTS;
}
if (!immunity)
{
flags |= COMMAND_FILTER_NO_IMMUNITY;
@ -167,12 +185,10 @@ stock int FindTarget(int client, const char[] target, bool nobots = false, bool
{
return target_list[0];
}
else
{
ReplyToTargetError(client, target_count);
return -1;
}
}
/**
* This function is no longer supported. It has been replaced with ReadMapList(),
@ -188,6 +204,7 @@ stock int FindTarget(int client, const char[] target, bool nobots = false, bool
* @param fileTime Variable containing the "last changed" time of the file. Used to avoid needless reloading.
* @param fileCvar CVAR set to the file to be loaded. Optional.
* @return Number of maps loaded or 0 if in error.
* @deprecated Use ReadMapList() instead.
*/
#pragma deprecated Use ReadMapList() instead.
stock int LoadMaps(Handle array, int &fileTime = 0, Handle fileCvar = INVALID_HANDLE)

View File

@ -49,7 +49,7 @@ enum KvDataTypes
KvData_Color, /**< Color value */
KvData_UInt64, /**< Large integer value */
/* --- */
KvData_NUMTYPES,
KvData_NUMTYPES
};
methodmap KeyValues < Handle

View File

@ -40,14 +40,14 @@ enum NominateResult
Nominate_Replaced, /** A clients existing nomination was replaced */
Nominate_AlreadyInVote, /** Specified map was already in the vote */
Nominate_InvalidMap, /** Mapname specified wasn't a valid map */
Nominate_VoteFull, /** This will only occur if force was set to false */
Nominate_VoteFull /** This will only occur if force was set to false */
};
enum MapChange
{
MapChange_Instant, /** Change map as soon as the voting results have come in */
MapChange_RoundEnd, /** Change map at the end of the round */
MapChange_MapEnd, /** Change the sm_nextmap cvar */
MapChange_MapEnd /** Change the sm_nextmap cvar */
};
/**
@ -55,7 +55,8 @@ enum MapChange
*
* @param map Map to add.
* @param force Should we force the map in even if it requires overwriting an existing nomination?
* @param owner Client index of the nominator. If the client disconnects the nomination will be removed. Use 0 for constant nominations
* @param owner Client index of the nominator. If the client disconnects the nomination will be removed.
* Use 0 for constant nominations
* @return Nominate Result of the outcome
*/
native NominateResult NominateMap(const char[] map, bool force, int owner);

View File

@ -42,7 +42,7 @@ enum MenuStyle
{
MenuStyle_Default = 0, /**< The "default" menu style for the mod */
MenuStyle_Valve = 1, /**< The Valve provided menu style (Used on HL2DM) */
MenuStyle_Radio = 2, /**< The simpler menu style commonly used on CS:S */
MenuStyle_Radio = 2 /**< The simpler menu style commonly used on CS:S */
};
/**
@ -56,17 +56,15 @@ enum MenuAction
MenuAction_Cancel = (1<<3), /**< The menu was cancelled (param1=client, param2=reason) */
MenuAction_End = (1<<4), /**< A menu display has fully ended.
param1 is the MenuEnd reason, and if it's MenuEnd_Cancelled, then
param2 is the MenuCancel reason from MenuAction_Cancel.
*/
param2 is the MenuCancel reason from MenuAction_Cancel. */
MenuAction_VoteEnd = (1<<5), /**< (VOTE ONLY): A vote sequence has succeeded (param1=chosen item)
This is not called if SetVoteResultCallback has been used on the menu. */
MenuAction_VoteStart = (1<<6), /**< (VOTE ONLY): A vote sequence has started (nothing passed) */
MenuAction_VoteCancel = (1<<7), /**< (VOTE ONLY): A vote sequence has been cancelled (param1=reason) */
MenuAction_DrawItem = (1<<8), /**< An item is being drawn; return the new style (param1=client, param2=item) */
MenuAction_DisplayItem = (1<<9),/**< Item text is being drawn to the display (param1=client, param2=item)
MenuAction_DisplayItem = (1<<9) /**< Item text is being drawn to the display (param1=client, param2=item)
To change the text, use RedrawMenuItem().
If you do so, return its return value. Otherwise, return 0.
*/
If you do so, return its return value. Otherwise, return 0. */
};
/** Default menu actions */
@ -107,7 +105,7 @@ enum
MenuCancel_Exit = -3, /**< Client exited via "exit" */
MenuCancel_NoDisplay = -4, /**< Menu could not be displayed to the client */
MenuCancel_Timeout = -5, /**< Menu timed out */
MenuCancel_ExitBack = -6, /**< Client selected "exit back" on a paginated menu */
MenuCancel_ExitBack = -6 /**< Client selected "exit back" on a paginated menu */
};
/**
@ -116,7 +114,7 @@ enum
enum
{
VoteCancel_Generic = -1, /**< Vote was generically cancelled. */
VoteCancel_NoVotes = -2, /**< Vote did not receive any votes. */
VoteCancel_NoVotes = -2 /**< Vote did not receive any votes. */
};
/**
@ -129,7 +127,7 @@ enum
MenuEnd_VotingCancelled = -2, /**< Voting was cancelled */
MenuEnd_Cancelled = -3, /**< Menu was cancelled (reason in param2) */
MenuEnd_Exit = -4, /**< Menu was cleanly exited via "exit" */
MenuEnd_ExitBack = -5, /**< Menu was cleanly exited via "back" */
MenuEnd_ExitBack = -5 /**< Menu was cleanly exited via "back" */
};
/**
@ -140,7 +138,7 @@ enum MenuSource
MenuSource_None = 0, /**< No menu is being displayed */
MenuSource_External = 1, /**< External menu */
MenuSource_Normal = 2, /**< A basic menu is being displayed */
MenuSource_RawPanel = 3, /**< A display is active, but it is not tied to a menu */
MenuSource_RawPanel = 3 /**< A display is active, but it is not tied to a menu */
};
/**
@ -369,7 +367,9 @@ methodmap Menu < Handle
int[] players = new int[MaxClients];
for (int i = 1; i <= MaxClients; i++) {
if (!IsClientInGame(i) || IsFakeClient(i))
{
continue;
}
players[total++] = i;
}
return this.DisplayVote(players, total, time, flags);

View File

@ -107,7 +107,7 @@ enum RegexError
REGEX_ERROR_BADENDIANNESS = -29,
REGEX_ERROR_DFA_BADRESTART = -30,
REGEX_ERROR_JIT_BADOPTION = -31,
REGEX_ERROR_BADLENGTH = -32,
REGEX_ERROR_BADLENGTH = -32
};
// Regular expression objects are used to match or decompose strings based on
@ -243,7 +243,9 @@ stock int SimpleRegexMatch(const char[] str, const char[] pattern, int flags = 0
{
Regex regex = new Regex(pattern, flags, error, maxLen);
if (!regex)
{
return -1;
}
int substrings = regex.Match(str);
delete regex;

View File

@ -37,8 +37,10 @@
#if !defined DMG_GENERIC
#define DMG_GENERIC 0 /**< generic damage was done */
#define DMG_CRUSH (1 << 0) /**< crushed by falling or moving object.
NOTE: It's assumed crush damage is occurring as a result of physics collision, so no extra physics force is generated by crush damage.
DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics collision. You probably want DMG_CLUB instead. */
NOTE: It's assumed crush damage is occurring as a result of physics collision,
so no extra physics force is generated by crush damage.
DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics
collision. You probably want DMG_CLUB instead. */
#define DMG_BULLET (1 << 1) /**< shot */
#define DMG_SLASH (1 << 2) /**< cut, clawed, stabbed */
#define DMG_BURN (1 << 3) /**< heat burned */
@ -144,7 +146,7 @@ enum SDKHookType
SDKHook_BlockedPost,
SDKHook_OnTakeDamageAlive,
SDKHook_OnTakeDamageAlivePost,
SDKHook_CanBeAutobalanced,
SDKHook_CanBeAutobalanced
};
/*
@ -324,7 +326,7 @@ typeset SDKHookCB
/**
* @brief When an entity is created
* When an entity is created
*
* @param entity Entity index
* @param classname Class name
@ -332,14 +334,14 @@ typeset SDKHookCB
forward void OnEntityCreated(int entity, const char[] classname);
/**
* @brief When an entity is destroyed
* When an entity is destroyed
*
* @param entity Entity index
*/
forward void OnEntityDestroyed(int entity);
/**
* @brief When the game description is retrieved
* When the game description is retrieved
*
* @note Not supported on ep2v.
*
@ -349,7 +351,7 @@ forward void OnEntityDestroyed(int entity);
forward Action OnGetGameDescription(char gameDesc[64]);
/**
* @brief When the level is initialized
* When the level is initialized
*
* @param mapName Name of the map
* @param mapEntities Entities of the map
@ -358,7 +360,7 @@ forward Action OnGetGameDescription(char gameDesc[64]);
forward Action OnLevelInit(const char[] mapName, char mapEntities[2097152]);
/**
* @brief Hooks an entity
* Hooks an entity
*
* @param entity Entity index
* @param type Type of function to hook
@ -367,17 +369,17 @@ forward Action OnLevelInit(const char[] mapName, char mapEntities[2097152]);
native void SDKHook(int entity, SDKHookType type, SDKHookCB callback);
/**
* @brief Hooks an entity
* Hooks an entity
*
* @param entity Entity index
* @param type Type of function to hook
* @param callback Function to call when hook is called
* @return bool Hook Successful
* @return Hook Successful
*/
native bool SDKHookEx(int entity, SDKHookType type, SDKHookCB callback);
/**
* @brief Unhooks an entity
* Unhooks an entity
*
* @param entity Entity index
* @param type Type of function to unhook
@ -386,7 +388,7 @@ native bool SDKHookEx(int entity, SDKHookType type, SDKHookCB callback);
native void SDKUnhook(int entity, SDKHookType type, SDKHookCB callback);
/**
* @brief Applies damage to an entity
* Applies damage to an entity
*
* @note Force application is dependent on game and damage type(s)
*
@ -404,7 +406,7 @@ native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR);
/**
* @brief Forces a client to drop the specified weapon
* Forces a client to drop the specified weapon
*
* @param client Client index.
* @param weapon Weapon entity index.

View File

@ -60,20 +60,20 @@ enum SDKCallType
SDKCall_Player, /**< CBasePlayer call */
SDKCall_GameRules, /**< CGameRules call */
SDKCall_EntityList, /**< CGlobalEntityList call */
SDKCall_Raw, /**< |this| pointer with an arbitrary address */
SDKCall_Raw /**< |this| pointer with an arbitrary address */
};
enum SDKLibrary
{
SDKLibrary_Server, /**< server.dll/server_i486.so */
SDKLibrary_Engine, /**< engine.dll/engine_*.so */
SDKLibrary_Engine /**< engine.dll/engine_*.so */
};
enum SDKFuncConfSource
{
SDKConf_Virtual = 0, /**< Read a virtual index from the Offsets section */
SDKConf_Signature = 1, /**< Read a signature from the Signatures section */
SDKConf_Address = 2, /**< Read an address from the Addresses section */
SDKConf_Address = 2 /**< Read an address from the Addresses section */
};
enum SDKType
@ -86,7 +86,7 @@ enum SDKType
SDKType_Float, /**< Float (any) */
SDKType_Edict, /**< edict_t (always as pointer) */
SDKType_String, /**< NULL-terminated string (always as pointer) */
SDKType_Bool, /**< Boolean (any) */
SDKType_Bool /**< Boolean (any) */
};
enum SDKPassMethod
@ -94,7 +94,7 @@ enum SDKPassMethod
SDKPass_Pointer, /**< Pass as a pointer */
SDKPass_Plain, /**< Pass as plain data */
SDKPass_ByValue, /**< Pass an object by value */
SDKPass_ByRef, /**< Pass an object by reference */
SDKPass_ByRef /**< Pass an object by reference */
};
#define VDECODE_FLAG_ALLOWNULL (1<<0) /**< Allow NULL for pointers */

View File

@ -346,7 +346,6 @@ native void SetClientName(int client, const char[] name);
* @param amount Amount of ammo to give. Is capped at ammotype's limit.
* @param ammotype Type of ammo to give to player.
* @param suppressSound If true, don't play the ammo pickup sound.
*
* @return Amount of ammo actually given.
*/
native int GivePlayerAmmo(int client, int amount, int ammotype, bool suppressSound=false);

View File

@ -68,7 +68,7 @@ enum RoundState {
RoundState_Bonus,
//Between rounds
RoundState_BetweenRounds,
RoundState_BetweenRounds
};
/**

View File

@ -53,8 +53,7 @@
* @param mouse Mouse direction (x, y).
* @return Plugin_Handled to block the commands from being processed, Plugin_Continue otherwise.
*
* @note To see if all 11 params are available, use FeatureType_Capability and
* FEATURECAP_PLAYERRUNCMD_11PARAMS.
* @note To see if all 11 params are available, use FeatureType_Capability and FEATURECAP_PLAYERRUNCMD_11PARAMS.
*/
forward Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2]);

View File

@ -80,7 +80,7 @@ enum
SND_DELAY = 5, /**< Sound has an initial delay */
SND_STOPLOOPING = 6, /**< Stop looping all sounds on the entity */
SND_SPEAKER = 7, /**< Being played by a mic through a speaker */
SND_SHOULDPAUSE = 8, /**< Pause if game is paused */
SND_SHOULDPAUSE = 8 /**< Pause if game is paused */
};
/**
@ -108,7 +108,7 @@ enum
SNDLEVEL_AIRCRAFT = 120, /**< Auto horn, aircraft */
SNDLEVEL_RAIDSIREN = 130, /**< Air raid siren */
SNDLEVEL_GUNFIRE = 140, /**< Gunshot, jet engine (0.27 attn) */
SNDLEVEL_ROCKET = 180, /**< Rocket launching (0.2 attn) */
SNDLEVEL_ROCKET = 180 /**< Rocket launching (0.2 attn) */
};
#define SNDVOL_NORMAL 1.0 /**< Normal volume */
@ -134,6 +134,7 @@ native void PrefetchSound(const char[] name);
*
* @param name Sound file name relative to the "sound" folder.
* @return Duration in seconds.
* @deprecated Does not work, may crash.
*/
#pragma deprecated Does not work, may crash.
native float GetSoundDuration(const char[] name);
@ -475,15 +476,13 @@ stock void EmitSoundToAll(const char[] sample,
}
}
if (!total)
if (total)
{
return;
}
EmitSound(clients, total, sample, entity, channel,
level, flags, volume, pitch, speakerentity,
origin, dir, updatePos, soundtime);
}
}
/**
* Converts an attenuation value to a sound level.
@ -574,11 +573,9 @@ stock bool EmitGameSound(const int[] clients,
EmitSound(clients, numClients, sample, entity, channel, level, flags, volume, pitch, speakerentity, origin, dir, updatePos, soundtime);
return true;
}
else
{
return false;
}
}
/**
* Emits an ambient game sound.
@ -612,11 +609,9 @@ stock bool EmitAmbientGameSound(const char[] gameSound,
EmitAmbientSound(sample, pos, entity, level, flags, volume, pitch, delay);
return true;
}
else
{
return false;
}
}
/**
* Wrapper to emit a game sound to one client.
@ -718,7 +713,6 @@ stock bool EmitGameSoundToAll(const char[] gameSound,
* Note: It precaches all files for a game sound.
*
* @param soundname Game sound to precache
*
* @return True if the game sound was found, false if sound did not exist
* or had no files
*/

View File

@ -566,7 +566,6 @@ native int TR_GetDisplacementFlags(Handle hndl=INVALID_HANDLE);
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
* @param buffer Buffer to store surface name in
* @param maxlen Maximum length of output buffer
* @noreturn
* @error Invalid Handle.
*/
native void TR_GetSurfaceName(Handle hndl, char[] buffer, int maxlen);

View File

@ -53,7 +53,7 @@ enum ListenOverride
{
Listen_Default = 0, /**< Leave it up to the game */
Listen_No, /**< Can't hear */
Listen_Yes, /**< Can hear */
Listen_Yes /**< Can hear */
};
/**
@ -79,6 +79,7 @@ native int GetClientListeningFlags(int client);
* @param iSender The sender index.
* @param bListen True if the receiver can listen to the sender, false otherwise.
* @return True if successful otherwise false.
* @deprecated Use SetListenOverride() instead.
*/
#pragma deprecated Use SetListenOverride() instead
native bool SetClientListening(int iReceiver, int iSender, bool bListen);
@ -89,6 +90,7 @@ native bool SetClientListening(int iReceiver, int iSender, bool bListen);
* @param iReceiver The listener index.
* @param iSender The sender index.
* @return True if successful otherwise false.
* @deprecated GetListenOverride() instead.
*/
#pragma deprecated GetListenOverride() instead
native bool GetClientListening(int iReceiver, int iSender);

View File

@ -53,7 +53,7 @@ enum SortType
{
Sort_Integer = 0,
Sort_Float,
Sort_String,
Sort_String
};
/**

View File

@ -145,7 +145,6 @@ forward bool AskPluginLoad(Handle myself, bool late, char[] error, int err_max);
* @note If you do not return anything, it is treated like returning success.
* @note If a plugin has an AskPluginLoad2(), AskPluginLoad() will not be called.
*
*
* @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.
@ -534,8 +533,8 @@ forward void OnLibraryRemoved(const char[] name);
* INVALID_HANDLE is returned, the serial is set to -1, and the input
* array (if any) is left unchanged.
* On no change:
INVALID_HANDLE is returned, the serial is unchanged, and the input
array (if any) is left unchanged.
* INVALID_HANDLE is returned, the serial is unchanged, and the input
* array (if any) is left unchanged.
* On success:
* A valid array Handle is returned, containing at least one map string.
* If an array was passed, the return value is equal to the passed Array
@ -669,7 +668,7 @@ enum NumberType
enum Address
{
Address_Null = 0, // a typical invalid result when an address lookup fails
Address_Null = 0 // a typical invalid result when an address lookup fails
};
/**

View File

@ -404,6 +404,7 @@ stock int CharToUpper(int chr)
{
return (chr & ~(1<<5));
}
return chr;
}
@ -420,6 +421,7 @@ stock int CharToLower(int chr)
{
return (chr | (1<<5));
}
return chr;
}
@ -437,17 +439,26 @@ stock int FindCharInString(const char[] str, char c, bool reverse = false)
{
int len = strlen(str);
if (!reverse) {
for (int i = 0; i < len; i++) {
if (!reverse)
{
for (int i = 0; i < len; i++)
{
if (str[i] == c)
{
return i;
}
} else {
for (int i = len - 1; i >= 0; i--) {
}
}
else
{
for (int i = len - 1; i >= 0; i--)
{
if (str[i] == c)
{
return i;
}
}
}
return -1;
}

View File

@ -41,9 +41,12 @@ stock void SetTestContext(const char[] context)
stock void AssertEq(const char[] text, int cell1, int cell2)
{
TestNumber++;
if (cell1 == cell2) {
if (cell1 == cell2)
{
PrintToServer("[%d] %s: %s == %d OK", TestNumber, TestContext, text, cell2);
} else {
}
else
{
PrintToServer("[%d] %s FAIL: %s should be %d, got %d", TestNumber, TestContext, text, cell2, cell1);
ThrowError("test %d (%s in %s) failed", TestNumber, text, TestContext);
}
@ -52,9 +55,12 @@ stock void AssertEq(const char[] text, int cell1, int cell2)
stock void AssertFalse(const char[] text, bool value)
{
TestNumber++;
if (!value) {
if (!value)
{
PrintToServer("[%d] %s: %s == false OK", TestNumber, TestContext, text, value);
} else {
}
else
{
PrintToServer("[%d] %s FAIL: %s should be false, got true", TestNumber, TestContext, text);
ThrowError("test %d (%s in %s) failed", TestNumber, text, TestContext);
}
@ -63,9 +69,12 @@ stock void AssertFalse(const char[] text, bool value)
stock void AssertTrue(const char[] text, bool value)
{
TestNumber++;
if (value) {
if (value)
{
PrintToServer("[%d] %s: %s == true OK", TestNumber, TestContext, text, value);
} else {
}
else
{
PrintToServer("[%d] %s FAIL: %s should be true, got false", TestNumber, TestContext, text);
ThrowError("test %d (%s in %s) failed", TestNumber, text, TestContext);
}

View File

@ -68,55 +68,66 @@ enum SMCError
SMCError_InvalidSection5, /**< A section beginning has no matching ending */
SMCError_InvalidTokens, /**< There were too many unidentifiable strings on one line */
SMCError_TokenOverflow, /**< The token buffer overflowed */
SMCError_InvalidProperty1, /**< A property was declared outside of any section */
SMCError_InvalidProperty1 /**< A property was declared outside of any section */
};
// Called when parsing is started.
//
// @param smc The SMC Parse Handle.
/**
* Called when parsing is started.
*
* @param smc The SMC Parse Handle.
*/
typedef SMC_ParseStart = function void (SMCParser smc);
// Called when the parser is entering a new section or sub-section.
//
// Note: Enclosing quotes are always stripped.
//
// @param smc The SMC Parser.
// @param name String containing section name.
// @param opt_quotes True if the section name was quote-enclosed in the file.
// @return An SMCResult action to take.
/**
* Called when the parser is entering a new section or sub-section.
*
* Note: Enclosing quotes are always stripped.
*
* @param smc The SMC Parser.
* @param name String containing section name.
* @param opt_quotes True if the section name was quote-enclosed in the file.
* @return An SMCResult action to take.
*/
typedef SMC_NewSection = function SMCResult (SMCParser smc, const char[] name, bool opt_quotes);
// Called when the parser finds a new key/value pair.
//
// Note: Enclosing quotes are always stripped.
//
// @param smc The SMCParser.
// @param key String containing key name.
// @param value String containing value name.
// @param key_quotes Whether or not the key was enclosed in quotes.
// @param value_quotes Whether or not the value was enclosed in quotes.
// @return An SMCResult action to take.
/**
* Called when the parser finds a new key/value pair.
*
* Note: Enclosing quotes are always stripped.
*
* @param smc The SMCParser.
* @param key String containing key name.
* @param value String containing value name.
* @param key_quotes Whether or not the key was enclosed in quotes.
* @param value_quotes Whether or not the value was enclosed in quotes.
* @return An SMCResult action to take.
*/
typedef SMC_KeyValue = function SMCResult (SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes);
// Called when the parser finds the end of the current section.
//
// @param smc The SMCParser.
// @return An SMCResult action to take.
/** Called when the parser finds the end of the current section.
*
* @param smc The SMCParser.
* @return An SMCResult action to take.
*/
typedef SMC_EndSection = function SMCResult (SMCParser smc);
// Called when parsing is halted.
//
// @param smc The SMCParser.
// @param halted True if abnormally halted, false otherwise.
// @param failed True if parsing failed, false otherwise.
/**
* Called when parsing is halted.
*
* @param smc The SMCParser.
* @param halted True if abnormally halted, false otherwise.
* @param failed True if parsing failed, false otherwise.
*/
typedef SMC_ParseEnd = function void (SMCParser smc, bool halted, bool failed);
// Callback for whenever a new line of text is about to be parsed.
//
// @param smc The SMCParser.
// @param line A string containing the raw line from the file.
// @param lineno The line number it occurs on.
// @return An SMCResult action to take.
/**
* Callback for whenever a new line of text is about to be parsed.
*
* @param smc The SMCParser.
* @param line A string containing the raw line from the file.
* @param lineno The line number it occurs on.
* @return An SMCResult action to take.
*/
typedef SMC_RawLine = function SMCResult (SMCParser smc, const char[] line, int lineno);
// An SMCParser is a callback-driven parser for SourceMod configuration files.
@ -196,6 +207,7 @@ native SMCError SMC_ParseFile(Handle smc, const char[] file, int &line=0, int &c
/**
* Gets an error string for an SMCError code.
*
* @note SMCError_Okay returns false.
* @note SMCError_Custom (which is thrown on SMCParse_HaltFail) returns false.
*

View File

@ -206,7 +206,7 @@ enum TFCond
TFCond_BurningPyro,
TFCond_RocketPack,
TFCond_LostFooting,
TFCond_AirCurrent,
TFCond_AirCurrent
};
const float TFCondDuration_Infinite = -1.0;
@ -345,6 +345,7 @@ native void TF2_MakeBleed(int client, int attacker, float duration);
* Retrieves the entity index of the CPlayerResource entity
*
* @return The current resource entity index.
* @deprecated Use GetPlayerResourceEntity instead
*/
#pragma deprecated Use GetPlayerResourceEntity instead
native int TF2_GetResourceEntity();

View File

@ -166,7 +166,7 @@ enum {
TF_CUSTOM_SLAP_KILL,
TF_CUSTOM_CROC,
TF_CUSTOM_TAUNTATK_GASBLAST,
TF_CUSTOM_AXTINGUISHER_BOOSTED,
TF_CUSTOM_AXTINGUISHER_BOOSTED
};
// Weapon codes as used in some events, such as player_death
@ -281,7 +281,7 @@ enum {
TF_WEAPON_SLAP,
TF_WEAPON_JAR_GAS,
TF_WEAPON_GRENADE_JAR_GAS,
TF_WEAPON_FLAME_BALL,
TF_WEAPON_FLAME_BALL
};
// TF2 Weapon Loadout Slots
@ -414,6 +414,7 @@ stock void TF2_SetPlayerClass(int client, TFClassType classType, bool weapons=tr
* @param type ResourceType constant
* @return Value or -1 on failure.
* @error Invalid client index, client not in game or failed to find resource entity.
* @deprecated Use GetPlayerResourceEntity and GetEntProp instead.
*/
#pragma deprecated Use GetPlayerResourceEntity and GetEntProp instead
stock int TF2_GetPlayerResourceData(int client, TFResourceType type)
@ -450,6 +451,7 @@ stock int TF2_GetPlayerResourceData(int client, TFResourceType type)
* @param value Value to set.
* @return Value or -1 on failure.
* @error Invalid client index, client not in game or failed to find resource entity.
* @deprecated Use GetPlayerResourceEntity and SetEntProp instead.
*/
#pragma deprecated Use GetPlayerResourceEntity and SetEntProp instead
stock bool TF2_SetPlayerResourceData(int client, TFResourceType type, any value)
@ -527,6 +529,7 @@ stock void TF2_RemoveAllWeapons(int client)
*
* @param client Player's index.
* @return Player's condition bits
* @deprecated Use TF2_IsPlayerInCondition instead.
*/
#pragma deprecated Use TF2_IsPlayerInCondition instead.
stock int TF2_GetPlayerConditionFlags(int client)
@ -593,8 +596,10 @@ stock bool TF2_IsPlayerInCondition(int client, TFCond cond)
}
}
default:
{
ThrowError("Invalid TFCond value %d", iCond);
}
}
return false;
}

View File

@ -86,7 +86,7 @@ enum TopMenuAction
*
* INPUT : TopMenu Handle, topobj ID.
*/
TopMenuAction_RemoveObject = 4,
TopMenuAction_RemoveObject = 4
};
/**
@ -105,7 +105,7 @@ enum TopMenuPosition
{
TopMenuPosition_Start = 0, /**< Start/root of the menu */
TopMenuPosition_LastRoot = 1, /**< Last position in the root menu */
TopMenuPosition_LastCategory = 3, /**< Last position in their last category */
TopMenuPosition_LastCategory = 3 /**< Last position in their last category */
};
/**
@ -113,7 +113,7 @@ enum TopMenuPosition
*/
enum TopMenuObject
{
INVALID_TOPMENUOBJECT = 0,
INVALID_TOPMENUOBJECT = 0
};
/**

View File

@ -40,7 +40,7 @@
*/
enum UserMsg
{
INVALID_MESSAGE_ID = -1,
INVALID_MESSAGE_ID = -1
};
/**
@ -49,7 +49,7 @@ enum UserMsg
enum UserMessageType
{
UM_BitBuf = 0,
UM_Protobuf,
UM_Protobuf
};
/**
@ -73,7 +73,10 @@ native UserMessageType GetUserMessageType();
stock Protobuf UserMessageToProtobuf(Handle msg)
{
if (GetUserMessageType() != UM_Protobuf)
{
return null;
}
return view_as<Protobuf>(msg);
}
@ -81,7 +84,10 @@ stock Protobuf UserMessageToProtobuf(Handle msg)
stock BfWrite UserMessageToBfWrite(Handle msg)
{
if (GetUserMessageType() == UM_Protobuf)
{
return null;
}
return view_as<BfWrite>(msg);
}
@ -89,7 +95,10 @@ stock BfWrite UserMessageToBfWrite(Handle msg)
stock BfRead UserMessageToBfRead(Handle msg)
{
if (GetUserMessageType() == UM_Protobuf)
{
return null;
}
return view_as<BfRead>(msg);
}
@ -113,6 +122,7 @@ native bool GetUserMessageName(UserMsg msg_id, char[] msg, int maxlength);
/**
* Starts a usermessage (network message).
*
* @note Only one message can be active at a time.
* @note It is illegal to send any message while a non-intercept hook is in progress.
*
@ -129,6 +139,7 @@ native Handle StartMessage(const char[] msgname, const int[] clients, int numCli
/**
* Starts a usermessage (network message).
*
* @note Only one message can be active at a time.
* @note It is illegal to send any message while a non-intercept hook is in progress.
*
@ -216,6 +227,7 @@ native void UnhookUserMessage(UserMsg msg_id, MsgHook hook, bool intercept=false
/**
* Starts a usermessage (network message) that broadcasts to all clients.
*
* @note See StartMessage or StartMessageEx().
*
* @param msgname Message name to start.
@ -234,11 +246,13 @@ stock Handle StartMessageAll(const char[] msgname, int flags=0)
clients[total++] = i;
}
}
return StartMessage(msgname, clients, total, flags);
}
/**
* Starts a simpler usermessage (network message) for one client.
*
* @note See StartMessage or StartMessageEx().
*
* @param msgname Message name to start.
@ -250,7 +264,6 @@ stock Handle StartMessageAll(const char[] msgname, int flags=0)
stock Handle StartMessageOne(const char[] msgname, int client, int flags=0)
{
int players[1];
players[0] = client;
return StartMessage(msgname, players, 1, flags);