Update spcomp and includes to latest 1.10-fork
disable warning 241: Array-based enum structs will be removed in 1.11
This commit is contained in:
2
Makefile
2
Makefile
@ -43,7 +43,7 @@ prepare_builddir:
|
||||
|
||||
%.smx: %.sp
|
||||
$(VERSIONDUMP)
|
||||
$(SPCOMP) -i$(SOURCEDIR) -i$(SMINCLUDES) -i$(ZRINCLUDES) -o$(BUILDDIR)/$@ $<
|
||||
$(SPCOMP) -w241 -i$(SOURCEDIR) -i$(SMINCLUDES) -i$(ZRINCLUDES) -o$(BUILDDIR)/$@ $<
|
||||
|
||||
clean:
|
||||
@rm -fr $(BUILDDIR)
|
||||
|
@ -17,7 +17,7 @@ if not exist "%BUILDDIR%" (
|
||||
|
||||
:: Compile.
|
||||
echo Starting compiler:
|
||||
%SPCOMP% -i%SOURCEDIR% -i%SOURCEDIR%/include -i%SMINCLUDES% -o%BUILDDIR%/zombiereloaded.smx %SOURCEDIR%\zombiereloaded.sp
|
||||
%SPCOMP% -w241 -i%SOURCEDIR% -i%SOURCEDIR%/include -i%SMINCLUDES% -o%BUILDDIR%/zombiereloaded.smx %SOURCEDIR%\zombiereloaded.sp
|
||||
|
||||
echo Compiling done. This script is looped, close if you're done.
|
||||
pause
|
||||
|
BIN
env/darwin/bin/spcomp
vendored
BIN
env/darwin/bin/spcomp
vendored
Binary file not shown.
24
env/include/admin.inc
vendored
24
env/include/admin.inc
vendored
@ -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 {
|
||||
@ -221,7 +220,7 @@ methodmap AdminId {
|
||||
// @param maxlength Maximum size of the output name buffer.
|
||||
// @return A GroupId index and a name pointer, or
|
||||
// INVALID_GROUP_ID and NULL if an error occurred.
|
||||
public native GroupId GetGroup(int index, const char[] name, int maxlength);
|
||||
public native GroupId GetGroup(int index, char[] name, int maxlength);
|
||||
|
||||
// Sets a password on an admin.
|
||||
//
|
||||
@ -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="");
|
||||
|
||||
@ -565,7 +565,7 @@ native int GetAdminGroupCount(AdminId id);
|
||||
* @return A GroupId index and a name pointer, or
|
||||
* INVALID_GROUP_ID and NULL if an error occurred.
|
||||
*/
|
||||
native GroupId GetAdminGroup(AdminId id, int index, const char[] name, int maxlength);
|
||||
native GroupId GetAdminGroup(AdminId id, int index, char[] name, int maxlength);
|
||||
|
||||
/**
|
||||
* Sets a password on an admin.
|
||||
|
36
env/include/adt_array.inc
vendored
36
env/include/adt_array.inc
vendored
@ -45,7 +45,10 @@
|
||||
stock int ByteCountToCells(int size)
|
||||
{
|
||||
if (!size)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (size + 3) / 4;
|
||||
}
|
||||
|
||||
@ -78,7 +81,8 @@ methodmap ArrayList < Handle {
|
||||
public native ArrayList Clone();
|
||||
|
||||
// Resizes an array. If the size is smaller than the current size, the
|
||||
// array is truncated.
|
||||
// array is truncated. If the size is larger than the current size,
|
||||
// the data at the additional indexes will not be initialized.
|
||||
//
|
||||
// @param newsize New size.
|
||||
public native void Resize(int newsize);
|
||||
@ -91,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.
|
||||
@ -207,10 +210,27 @@ 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
|
||||
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.
|
||||
public native void SortCustom(SortFuncADTArray sortfunc, Handle hndl=INVALID_HANDLE);
|
||||
|
||||
// Retrieve the size of the array.
|
||||
property int Length {
|
||||
public native get();
|
||||
}
|
||||
|
||||
// Retrieve the blocksize the array was created with.
|
||||
property int BlockSize {
|
||||
public native get();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -252,7 +272,8 @@ native Handle CloneArray(Handle array);
|
||||
|
||||
/**
|
||||
* Resizes an array. If the size is smaller than the current size,
|
||||
* the array is truncated.
|
||||
* the array is truncated. If the size is larger than the current size,
|
||||
* the data at the additional indexes will not be initialized.
|
||||
*
|
||||
* @param array Array Handle.
|
||||
* @param newsize New size.
|
||||
@ -437,3 +458,12 @@ native int FindStringInArray(Handle array, const char[] item);
|
||||
* @error Invalid Handle or invalid block
|
||||
*/
|
||||
native int FindValueInArray(Handle array, any item, int block=0);
|
||||
|
||||
/**
|
||||
* Returns the blocksize the array was created with.
|
||||
*
|
||||
* @param array Array Handle.
|
||||
* @return The blocksize of the array.
|
||||
* @error Invalid Handle
|
||||
*/
|
||||
native int GetArrayBlockSize(Handle array);
|
||||
|
14
env/include/adt_stack.inc
vendored
14
env/include/adt_stack.inc
vendored
@ -109,6 +109,11 @@ methodmap ArrayStack < Handle
|
||||
property bool Empty {
|
||||
public native get();
|
||||
}
|
||||
|
||||
// Retrieve the blocksize the stack was created with.
|
||||
property int BlockSize {
|
||||
public native get();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -224,3 +229,12 @@ stock bool PopStack(Handle stack)
|
||||
int value;
|
||||
return PopStackCell(stack, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blocksize the stack was created with.
|
||||
*
|
||||
* @param stack Stack Handle.
|
||||
* @return The blocksize of the stack.
|
||||
* @error Invalid Handle
|
||||
*/
|
||||
native int GetStackBlockSize(Handle stack);
|
||||
|
8
env/include/adt_trie.inc
vendored
8
env/include/adt_trie.inc
vendored
@ -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.
|
||||
|
2
env/include/banning.inc
vendored
2
env/include/banning.inc
vendored
@ -87,7 +87,7 @@ forward Action OnBanIdentity(const char[] identity,
|
||||
* @param flags Ban flags (only IP or AUTHID are valid here).
|
||||
* @param command Command string to identify the ban source.
|
||||
* @param source Source value passed via BanIdentity().
|
||||
* @return Plugin_Handled to block the actual server banning.
|
||||
* @return Plugin_Handled to block the actual unbanning.
|
||||
*/
|
||||
forward Action OnRemoveBan(const char[] identity,
|
||||
int flags,
|
||||
|
4
env/include/basecomm.inc
vendored
4
env/include/basecomm.inc
vendored
@ -41,7 +41,7 @@
|
||||
* @param client Client index
|
||||
* @param muteState True if client was muted, false otherwise
|
||||
*/
|
||||
forward void BaseComm_OnClientMute(int client, bool muteState);
|
||||
forward void BaseComm_OnClientMute(int client, bool muteState);
|
||||
|
||||
/**
|
||||
* Called when a client is gagged or ungagged
|
||||
@ -49,7 +49,7 @@
|
||||
* @param client Client index
|
||||
* @param gagState True if client was gaged, false otherwise
|
||||
*/
|
||||
forward void BaseComm_OnClientGag(int client, bool gagState);
|
||||
forward void BaseComm_OnClientGag(int client, bool gagState);
|
||||
|
||||
/**
|
||||
* Returns whether or not a client is gagged
|
||||
|
121
env/include/clientprefs.inc
vendored
121
env/include/clientprefs.inc
vendored
@ -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,9 +71,26 @@ enum CookieMenuAction
|
||||
*
|
||||
* INPUT : Client index and any data if available.
|
||||
*/
|
||||
CookieMenuAction_SelectOption = 1,
|
||||
CookieMenuAction_SelectOption = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Cookie Menu Callback prototype
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param action CookieMenuAction being performed.
|
||||
* @param info Info data passed.
|
||||
* @param buffer Outbut buffer.
|
||||
* @param maxlen Max length of the output buffer.
|
||||
*/
|
||||
typedef CookieMenuHandler = function void (
|
||||
int client,
|
||||
CookieMenuAction action,
|
||||
any info,
|
||||
char[] buffer,
|
||||
int maxlen
|
||||
);
|
||||
|
||||
/**
|
||||
* Note:
|
||||
*
|
||||
@ -82,6 +99,77 @@ enum CookieMenuAction
|
||||
* errors by the clientprefs extension.
|
||||
*/
|
||||
|
||||
methodmap Cookie < Handle {
|
||||
// Creates a new Client preference cookie.
|
||||
//
|
||||
// Handles returned can be closed via CloseHandle() when
|
||||
// no longer needed.
|
||||
//
|
||||
// @param name Name of the new preference cookie.
|
||||
// @param description Optional description of the preference cookie.
|
||||
// @param access What CookieAccess level to assign to this cookie.
|
||||
// @return A handle to the newly created cookie. If the cookie already
|
||||
// exists, a handle to it will still be returned.
|
||||
// @error Cookie name is blank.
|
||||
public native Cookie(const char[] name, const char[] description, CookieAccess access);
|
||||
|
||||
// Searches for a Client preference cookie.
|
||||
//
|
||||
// Handles returned by Cookie.Find can be closed via CloseHandle() when
|
||||
// no longer needed.
|
||||
//
|
||||
// @param name Name of cookie to find.
|
||||
// @return A handle to the cookie if it is found. INVALID_HANDLE otherwise.
|
||||
public static native Cookie Find(const char[] name);
|
||||
|
||||
// Set the value of a Client preference cookie.
|
||||
//
|
||||
// @param client Client index.
|
||||
// @param value String value to set.
|
||||
// @error Invalid cookie handle or invalid client index.
|
||||
public native void Set(int client, const char[] value);
|
||||
|
||||
// Retrieve the value of a Client preference cookie.
|
||||
//
|
||||
// @param client Client index.
|
||||
// @param buffer Copyback buffer for value.
|
||||
// @param maxlen Maximum length of the buffer.
|
||||
// @error Invalid cookie handle or invalid client index.
|
||||
public native void Get(int client, char[] buffer, int maxlen);
|
||||
|
||||
// Sets the value of a Client preference cookie based on an authID string.
|
||||
//
|
||||
// @param authID String Auth/STEAM ID of player to set.
|
||||
// @param value String value to set.
|
||||
// @error Invalid cookie handle.
|
||||
public native void SetByAuthId(const char[] authID, const char[] value);
|
||||
|
||||
// Add a new prefab item to the client cookie settings menu.
|
||||
//
|
||||
// Note: This handles everything automatically and does not require a callback
|
||||
//
|
||||
// @param type A CookieMenu prefab menu type.
|
||||
// @param display Text to show on the menu.
|
||||
// @param handler Optional handler callback for translations and output on selection
|
||||
// @param info Info data to pass to the callback.
|
||||
// @error Invalid cookie handle.
|
||||
public native void SetPrefabMenu(CookieMenu type, const char[] display, CookieMenuHandler handler=INVALID_FUNCTION, any info=0);
|
||||
|
||||
// Returns the last updated timestamp for a client cookie
|
||||
//
|
||||
// @param client Client index.
|
||||
// @return Last updated timestamp.
|
||||
public native int GetClientTime(int client);
|
||||
|
||||
// Returns the access level of a cookie
|
||||
//
|
||||
// @return CookieAccess access level.
|
||||
// @error Invalid cookie handle.
|
||||
property CookieAccess AccessLevel {
|
||||
public native get();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new Client preference cookie.
|
||||
*
|
||||
@ -155,23 +243,6 @@ native bool AreClientCookiesCached(int client);
|
||||
*/
|
||||
forward void OnClientCookiesCached(int client);
|
||||
|
||||
/**
|
||||
* Cookie Menu Callback prototype
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param action CookieMenuAction being performed.
|
||||
* @param info Info data passed.
|
||||
* @param buffer Outbut buffer.
|
||||
* @param maxlen Max length of the output buffer.
|
||||
*/
|
||||
typedef CookieMenuHandler = function void (
|
||||
int client,
|
||||
CookieMenuAction action,
|
||||
any info,
|
||||
char[] buffer,
|
||||
int maxlen
|
||||
);
|
||||
|
||||
/**
|
||||
* Add a new prefab item to the client cookie settings menu.
|
||||
*
|
||||
@ -270,6 +341,7 @@ public void __ext_cprefs_SetNTVOptional()
|
||||
MarkNativeAsOptional("FindClientCookie");
|
||||
MarkNativeAsOptional("SetClientCookie");
|
||||
MarkNativeAsOptional("GetClientCookie");
|
||||
MarkNativeAsOptional("SetAuthIdCookie");
|
||||
MarkNativeAsOptional("AreClientCookiesCached");
|
||||
MarkNativeAsOptional("SetCookiePrefabMenu");
|
||||
MarkNativeAsOptional("SetCookieMenuItem");
|
||||
@ -278,5 +350,14 @@ public void __ext_cprefs_SetNTVOptional()
|
||||
MarkNativeAsOptional("ReadCookieIterator");
|
||||
MarkNativeAsOptional("GetCookieAccess");
|
||||
MarkNativeAsOptional("GetClientCookieTime");
|
||||
|
||||
MarkNativeAsOptional("Cookie.Cookie");
|
||||
MarkNativeAsOptional("Cookie.Find");
|
||||
MarkNativeAsOptional("Cookie.Set");
|
||||
MarkNativeAsOptional("Cookie.Get");
|
||||
MarkNativeAsOptional("Cookie.SetByAuthId");
|
||||
MarkNativeAsOptional("Cookie.SetPrefabMenu");
|
||||
MarkNativeAsOptional("Cookie.GetClientTime");
|
||||
MarkNativeAsOptional("Cookie.AccessLevel.get");
|
||||
}
|
||||
#endif
|
||||
|
23
env/include/clients.inc
vendored
23
env/include/clients.inc
vendored
@ -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" */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ enum AuthIdType
|
||||
*/
|
||||
|
||||
#define MAXPLAYERS 65 /**< Maximum number of players SourceMod supports */
|
||||
#define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */
|
||||
#define MAX_NAME_LENGTH 128 /**< Maximum buffer required to store a client name */
|
||||
|
||||
public const int MaxClients; /**< Maximum number of players the server supports (dynamic) */
|
||||
|
||||
@ -226,7 +226,7 @@ forward void OnClientPostAdminFilter(int client);
|
||||
forward void OnClientPostAdminCheck(int client);
|
||||
|
||||
/**
|
||||
* This function will be deprecated in a future release. Use the MaxClients variable instead.
|
||||
* This function is deprecated. Use the MaxClients variable instead.
|
||||
*
|
||||
* Returns the maximum number of clients allowed on the server. This may
|
||||
* return 0 if called before OnMapStart(), and thus should not be called
|
||||
@ -237,7 +237,9 @@ 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();
|
||||
|
||||
/**
|
||||
@ -297,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);
|
||||
@ -317,7 +320,8 @@ native bool GetClientAuthString(int client, char[] auth, int maxlen, bool valida
|
||||
native bool GetClientAuthId(int client, AuthIdType authType, char[] auth, int maxlen, bool validate=true);
|
||||
|
||||
/**
|
||||
* Returns the client's Steam account ID.
|
||||
* Returns the client's Steam account ID, a number uniquely identifying a given Steam account.
|
||||
* This number is the basis for the various display SteamID forms, see the AuthIdType enum for examples.
|
||||
*
|
||||
* @param client Client Index.
|
||||
* @param validate Check backend validation status.
|
||||
@ -737,6 +741,15 @@ native float GetClientAvgData(int client, NetFlow flow);
|
||||
*/
|
||||
native float GetClientAvgPackets(int client, NetFlow flow);
|
||||
|
||||
/**
|
||||
* Returns the client's baseserver IClient pointer.
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @return IClient address.
|
||||
* @error Invalid client index, client not connected, or fake client.
|
||||
*/
|
||||
native Address GetClientIClient(int client);
|
||||
|
||||
/**
|
||||
* Translates an userid index to the real player index.
|
||||
*
|
||||
|
11
env/include/commandfilters.inc
vendored
11
env/include/commandfilters.inc
vendored
@ -179,6 +179,8 @@ stock void ReplyToTargetError(int client, int reason, bool dynamic=true)
|
||||
}
|
||||
}
|
||||
|
||||
#define FEATURECAP_MULTITARGETFILTER_CLIENTPARAM "SourceMod MultiTargetFilter ClientParam"
|
||||
|
||||
/**
|
||||
* Adds clients to a multi-target filter.
|
||||
*
|
||||
@ -186,8 +188,15 @@ stock void ReplyToTargetError(int client, int reason, bool dynamic=true)
|
||||
* @param clients Array to fill with unique, valid client indexes.
|
||||
* @param client Client that triggered this filter.
|
||||
* @return True if pattern was recognized, false otherwise.
|
||||
*
|
||||
* @note To see if the client param is available, use FeatureType_Capability and FEATURECAP_MULTITARGETFILTER_CLIENTPARAM.
|
||||
*/
|
||||
typedef MultiTargetFilter = function bool (const char[] pattern, Handle clients, int client);
|
||||
typeset MultiTargetFilter {
|
||||
function bool (const char[] pattern, Handle clients);
|
||||
function bool (const char[] pattern, ArrayList clients);
|
||||
function bool (const char[] pattern, Handle clients, int client);
|
||||
function bool (const char[] pattern, ArrayList clients, int client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a multi-target filter function for ProcessTargetString().
|
||||
|
96
env/include/console.inc
vendored
96
env/include/console.inc
vendored
@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
@ -210,8 +210,30 @@ native void PrintToServer(const char[] format, any ...);
|
||||
*/
|
||||
native void PrintToConsole(int client, const char[] format, any ...);
|
||||
|
||||
|
||||
/**
|
||||
* Reples to a message in a command.
|
||||
* Sends a message to every client's console.
|
||||
*
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
*/
|
||||
stock void PrintToConsoleAll(const char[] format, any ...)
|
||||
{
|
||||
char buffer[254];
|
||||
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
SetGlobalTransTarget(i);
|
||||
VFormat(buffer, sizeof(buffer), format, 2);
|
||||
PrintToConsole(i, "%s", buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replies to a message in a command.
|
||||
*
|
||||
* A client index of 0 will use PrintToServer().
|
||||
* If the command was from the console, PrintToConsole() is used.
|
||||
@ -418,6 +440,52 @@ native int GetCmdArg(int argnum, char[] buffer, int maxlength);
|
||||
*/
|
||||
native int GetCmdArgString(char[] buffer, int maxlength);
|
||||
|
||||
methodmap CommandIterator < Handle {
|
||||
// Creates a new CommandIterator. Must be freed with delete or
|
||||
// CloseHandle().
|
||||
//
|
||||
// The CommandIterator can be used to iterate commands created by
|
||||
// SourceMod plugins and allows inspection of properties associated
|
||||
// with the command.
|
||||
//
|
||||
// @return New CommandIterator Handle.
|
||||
public native CommandIterator();
|
||||
|
||||
// Determines if there is a next command. If one is found, the
|
||||
// iterator is advanced to it.
|
||||
//
|
||||
// @return true if found and iterator is advanced.
|
||||
public native bool Next();
|
||||
|
||||
// Retrieves the command's description.
|
||||
//
|
||||
// @param buffer Buffer to copy to.
|
||||
// @param maxlen Maximum size of the buffer.
|
||||
// @error Invalid iterator position.
|
||||
public native void GetDescription(char[] buffer, int maxlen);
|
||||
|
||||
// Retrieves the command's name.
|
||||
//
|
||||
// @param buffer Buffer to copy to.
|
||||
// @param maxlen Maximum size of the buffer.
|
||||
// @error Invalid iterator position.
|
||||
public native void GetName(char[] buffer, int maxlen);
|
||||
|
||||
// Retrieves the plugin handle of the command's creator
|
||||
//
|
||||
// @error Invalid iterator position.
|
||||
property Handle Plugin {
|
||||
public native get();
|
||||
}
|
||||
|
||||
// Retrieves the command's default flags
|
||||
//
|
||||
// @error Invalid iterator position.
|
||||
property int Flags {
|
||||
public native get();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a command iterator. Must be freed with CloseHandle().
|
||||
*
|
||||
@ -519,12 +587,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);
|
||||
|
||||
@ -535,14 +603,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);
|
||||
|
||||
@ -639,7 +707,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);
|
||||
|
||||
|
48
env/include/convars.inc
vendored
48
env/include/convars.inc
vendored
@ -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.
|
||||
|
25
env/include/core.inc
vendored
25
env/include/core.inc
vendored
@ -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 */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -143,6 +143,22 @@ struct SharedPlugin
|
||||
public float NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
|
||||
public const char NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
|
||||
|
||||
/**
|
||||
* Check if the given vector is the NULL_VECTOR.
|
||||
*
|
||||
* @param vec The vector to test.
|
||||
* @return True if NULL_VECTOR, false otherwise.
|
||||
*/
|
||||
native bool IsNullVector(const float vec[3]);
|
||||
|
||||
/**
|
||||
* Check if the given string is the NULL_STRING.
|
||||
*
|
||||
* @param str The string to test.
|
||||
* @return True if NULL_STRING, false otherwise.
|
||||
*/
|
||||
native bool IsNullString(const char[] str);
|
||||
|
||||
/**
|
||||
* Horrible compatibility shim.
|
||||
*/
|
||||
@ -230,7 +246,7 @@ public void __ext_core_SetNTVOptional()
|
||||
MarkNativeAsOptional("BfRead.ReadVecCoord");
|
||||
MarkNativeAsOptional("BfRead.ReadVecNormal");
|
||||
MarkNativeAsOptional("BfRead.ReadAngles");
|
||||
MarkNativeAsOptional("BfRead.GetNumBytesLeft");
|
||||
MarkNativeAsOptional("BfRead.BytesLeft.get");
|
||||
|
||||
MarkNativeAsOptional("PbReadInt");
|
||||
MarkNativeAsOptional("PbReadFloat");
|
||||
@ -263,6 +279,7 @@ public void __ext_core_SetNTVOptional()
|
||||
MarkNativeAsOptional("PbAddMessage");
|
||||
|
||||
MarkNativeAsOptional("Protobuf.ReadInt");
|
||||
MarkNativeAsOptional("Protobuf.ReadInt64");
|
||||
MarkNativeAsOptional("Protobuf.ReadFloat");
|
||||
MarkNativeAsOptional("Protobuf.ReadBool");
|
||||
MarkNativeAsOptional("Protobuf.ReadString");
|
||||
@ -272,6 +289,7 @@ public void __ext_core_SetNTVOptional()
|
||||
MarkNativeAsOptional("Protobuf.ReadVector2D");
|
||||
MarkNativeAsOptional("Protobuf.GetRepeatedFieldCount");
|
||||
MarkNativeAsOptional("Protobuf.SetInt");
|
||||
MarkNativeAsOptional("Protobuf.SetInt64");
|
||||
MarkNativeAsOptional("Protobuf.SetFloat");
|
||||
MarkNativeAsOptional("Protobuf.SetBool");
|
||||
MarkNativeAsOptional("Protobuf.SetString");
|
||||
@ -280,6 +298,7 @@ public void __ext_core_SetNTVOptional()
|
||||
MarkNativeAsOptional("Protobuf.SetVector");
|
||||
MarkNativeAsOptional("Protobuf.SetVector2D");
|
||||
MarkNativeAsOptional("Protobuf.AddInt");
|
||||
MarkNativeAsOptional("Protobuf.AddInt64");
|
||||
MarkNativeAsOptional("Protobuf.AddFloat");
|
||||
MarkNativeAsOptional("Protobuf.AddBool");
|
||||
MarkNativeAsOptional("Protobuf.AddString");
|
||||
|
101
env/include/cstrike.inc
vendored
101
env/include/cstrike.inc
vendored
@ -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
|
||||
@ -109,7 +109,7 @@ enum CSWeaponID
|
||||
CSWeapon_SHIELD,
|
||||
CSWeapon_KEVLAR,
|
||||
CSWeapon_ASSAULTSUIT,
|
||||
CSWeapon_NIGHTVISION,
|
||||
CSWeapon_NIGHTVISION, //Anything below is CS:GO ONLY
|
||||
CSWeapon_GALILAR,
|
||||
CSWeapon_BIZON,
|
||||
CSWeapon_MAG7,
|
||||
@ -130,7 +130,46 @@ enum CSWeaponID
|
||||
CSWeapon_MOLOTOV,
|
||||
CSWeapon_DECOY,
|
||||
CSWeapon_INCGRENADE,
|
||||
CSWeapon_DEFUSER
|
||||
CSWeapon_DEFUSER,
|
||||
CSWeapon_HEAVYASSAULTSUIT,
|
||||
//The rest are actual item definition indexes for CS:GO
|
||||
CSWeapon_CUTTERS = 56,
|
||||
CSWeapon_HEALTHSHOT = 57,
|
||||
CSWeapon_KNIFE_T = 59,
|
||||
CSWeapon_M4A1_SILENCER = 60,
|
||||
CSWeapon_USP_SILENCER = 61,
|
||||
CSWeapon_CZ75A = 63,
|
||||
CSWeapon_REVOLVER = 64,
|
||||
CSWeapon_TAGGRENADE = 68,
|
||||
CSWeapon_FISTS = 69,
|
||||
CSWeapon_BREACHCHARGE = 70,
|
||||
CSWeapon_TABLET = 72,
|
||||
CSWeapon_MELEE = 74,
|
||||
CSWeapon_AXE = 75,
|
||||
CSWeapon_HAMMER = 76,
|
||||
CSWeapon_SPANNER = 78,
|
||||
CSWeapon_KNIFE_GHOST = 80,
|
||||
CSWeapon_FIREBOMB = 81,
|
||||
CSWeapon_DIVERSION = 82,
|
||||
CSWeapon_FRAGGRENADE = 83,
|
||||
CSWeapon_SNOWBALL = 84,
|
||||
CSWeapon_BUMPMINE = 85,
|
||||
CSWeapon_MAX_WEAPONS_NO_KNIFES, // Max without the knife item defs, useful when treating all knives as a regular knife.
|
||||
CSWeapon_BAYONET = 500,
|
||||
CSWeapon_KNIFE_FLIP = 505,
|
||||
CSWeapon_KNIFE_GUT = 506,
|
||||
CSWeapon_KNIFE_KARAMBIT = 507,
|
||||
CSWeapon_KNIFE_M9_BAYONET = 508,
|
||||
CSWeapon_KNIFE_TATICAL = 509,
|
||||
CSWeapon_KNIFE_FALCHION = 512,
|
||||
CSWeapon_KNIFE_SURVIVAL_BOWIE = 514,
|
||||
CSWeapon_KNIFE_BUTTERFLY = 515,
|
||||
CSWeapon_KNIFE_PUSH = 516,
|
||||
CSWeapon_KNIFE_URSUS = 519,
|
||||
CSWeapon_KNIFE_GYPSY_JACKKNIFE = 520,
|
||||
CSWeapon_KNIFE_STILETTO = 522,
|
||||
CSWeapon_KNIFE_WIDOWMAKER = 523,
|
||||
CSWeapon_MAX_WEAPONS //THIS MUST BE LAST, EASY WAY TO CREATE LOOPS. When looping, do CS_IsValidWeaponID(i), to check.
|
||||
};
|
||||
|
||||
/**
|
||||
@ -203,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);
|
||||
@ -236,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.
|
||||
*
|
||||
@ -346,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.
|
||||
@ -355,10 +397,11 @@ 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.
|
||||
*
|
||||
* @note This will return false always for CSWeapon_NONE
|
||||
* @note This will return false always for CSWeapon_NONE. Should only be called after OnMapStart since weapon info isnt intialized before.
|
||||
*/
|
||||
native bool CS_IsValidWeaponID(CSWeaponID id);
|
||||
|
||||
@ -370,6 +413,28 @@ native bool CS_IsValidWeaponID(CSWeaponID id);
|
||||
*/
|
||||
native void CS_UpdateClientModel(int client);
|
||||
|
||||
/**
|
||||
* Returns a CSWeaponID equivalent based on the item definition index.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Returns a item definition index equivalent based on the CSWeaponID.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Do not edit below this line!
|
||||
*/
|
||||
@ -408,5 +473,7 @@ public void __ext_cstrike_SetNTVOptional()
|
||||
MarkNativeAsOptional("CS_WeaponIDToAlias");
|
||||
MarkNativeAsOptional("CS_IsValidWeaponID");
|
||||
MarkNativeAsOptional("CS_UpdateClientModel");
|
||||
MarkNativeAsOptional("CS_ItemDefIndexToID");
|
||||
MarkNativeAsOptional("CS_WeaponIDToItemDefIndex");
|
||||
}
|
||||
#endif
|
||||
|
18
env/include/datapack.inc
vendored
18
env/include/datapack.inc
vendored
@ -39,7 +39,7 @@
|
||||
/**
|
||||
* Opaque handle to a datapack position.
|
||||
*/
|
||||
enum DataPackPos: {};
|
||||
enum DataPackPos: {};
|
||||
|
||||
// A DataPack allows serializing multiple variables into a single stream.
|
||||
methodmap DataPack < Handle
|
||||
@ -50,22 +50,26 @@ methodmap DataPack < Handle
|
||||
// Packs a normal cell into a data pack.
|
||||
//
|
||||
// @param cell Cell to add.
|
||||
public native void WriteCell(any cell);
|
||||
// @param insert Determines whether mid-pack writes will insert instead of overwrite.
|
||||
public native void WriteCell(any cell, bool insert = false);
|
||||
|
||||
// Packs a float into a data pack.
|
||||
//
|
||||
// @param val Float to add.
|
||||
public native void WriteFloat(float val);
|
||||
// @param insert Determines whether mid-pack writes will insert instead of overwrite.
|
||||
public native void WriteFloat(float val, bool insert = false);
|
||||
|
||||
// Packs a string into a data pack.
|
||||
//
|
||||
// @param str String to add.
|
||||
public native void WriteString(const char[] str);
|
||||
// @param insert Determines whether mid-pack writes will insert instead of overwrite.
|
||||
public native void WriteString(const char[] str, bool insert = false);
|
||||
|
||||
// Packs a function pointer into a data pack.
|
||||
//
|
||||
// @param fktptr Function pointer to add.
|
||||
public native void WriteFunction(Function fktptr);
|
||||
// @param insert Determines whether mid-pack writes will insert instead of overwrite.
|
||||
public native void WriteFunction(Function fktptr, bool insert = false);
|
||||
|
||||
// Reads a cell from a data pack.
|
||||
//
|
||||
@ -96,8 +100,8 @@ methodmap DataPack < Handle
|
||||
// Returns whether or not a specified number of bytes from the data pack
|
||||
// position to the end can be read.
|
||||
//
|
||||
// @param bytes Number of bytes to simulate reading.
|
||||
public native bool IsReadable();
|
||||
// @param unused Unused variable. Exists for backwards compatability.
|
||||
public native bool IsReadable(int unused = 0);
|
||||
|
||||
// The read or write position in a data pack.
|
||||
property DataPackPos Position {
|
||||
|
112
env/include/dbi.inc
vendored
112
env/include/dbi.inc
vendored
@ -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
|
||||
@ -380,6 +385,16 @@ methodmap Database < Handle
|
||||
// The buffer must be at least 2*strlen(string)+1.
|
||||
public native bool Escape(const char[] string, char[] buffer, int maxlength, int &written=0);
|
||||
|
||||
// Formats a string according to the SourceMod format rules (see documentation).
|
||||
// All format specifiers are escaped (see SQL_EscapeString) unless the '!' flag is used.
|
||||
//
|
||||
// @param buffer Destination string buffer.
|
||||
// @param maxlength Maximum length of output string buffer.
|
||||
// @param format Formatting rules.
|
||||
// @param ... Variable number of format parameters.
|
||||
// @return Number of cells written.
|
||||
public native int Format(const char[] buffer, int maxlength, const char[] format, any ...);
|
||||
|
||||
// Returns whether a database is the same connection as another database.
|
||||
public native bool IsSameConnection(Database other);
|
||||
|
||||
@ -485,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");
|
||||
@ -502,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,
|
||||
@ -640,9 +654,23 @@ native bool SQL_EscapeString(Handle database,
|
||||
int &written=0);
|
||||
|
||||
/**
|
||||
* This is a backwards compatibility stock. You should use SQL_EscapeString()
|
||||
* instead, as this function will probably be deprecated in SourceMod 1.1.
|
||||
* Formats a string according to the SourceMod format rules (see documentation).
|
||||
* All format specifiers are escaped (see SQL_EscapeString) unless the '!' flag is used.
|
||||
*
|
||||
* @param database A database Handle.
|
||||
* @param buffer Destination string buffer.
|
||||
* @param maxlength Maximum length of output string buffer.
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
* @return Number of cells written.
|
||||
*/
|
||||
native int SQL_FormatQuery(Handle database, const char[] buffer, int maxlength, const char[] format, any ...);
|
||||
|
||||
/**
|
||||
* This function is deprecated. Use SQL_EscapeString instead.
|
||||
* @deprecated
|
||||
*/
|
||||
#pragma deprecated Use SQL_EscapeString instead.
|
||||
stock bool SQL_QuoteString(Handle database,
|
||||
const char[] string,
|
||||
char[] buffer,
|
||||
@ -944,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);
|
||||
|
||||
/**
|
||||
|
42
env/include/entity.inc
vendored
42
env/include/entity.inc
vendored
@ -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,8 +70,9 @@ 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).
|
||||
*/
|
||||
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. */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -120,10 +121,10 @@ native bool IsValidEdict(int edict);
|
||||
/**
|
||||
* Returns whether or not an entity has a valid networkable edict.
|
||||
*
|
||||
* @param edict Index of the entity.
|
||||
* @param entity Index of the entity.
|
||||
* @return True if networkable, false if invalid or not networkable.
|
||||
*/
|
||||
native bool IsEntNetworkable(int entiy);
|
||||
native bool IsEntNetworkable(int entity);
|
||||
|
||||
/**
|
||||
* Creates a new edict (the basis of a networkable entity)
|
||||
@ -140,6 +141,14 @@ native int CreateEdict();
|
||||
*/
|
||||
native void RemoveEdict(int edict);
|
||||
|
||||
/**
|
||||
* Marks an entity for deletion.
|
||||
*
|
||||
* @param entity Index of the entity.
|
||||
* @error Invalid entity index.
|
||||
*/
|
||||
native void RemoveEntity(int entity);
|
||||
|
||||
/**
|
||||
* Returns the flags on an edict. These are not the same as entity flags.
|
||||
*
|
||||
@ -275,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);
|
||||
@ -292,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);
|
||||
@ -399,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);
|
||||
@ -437,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,
|
||||
@ -489,9 +502,9 @@ stock int GetEntSendPropOffs(int ent, const char[] prop, bool actual=false)
|
||||
if (actual)
|
||||
{
|
||||
return offset;
|
||||
} else {
|
||||
return local;
|
||||
}
|
||||
|
||||
return local;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -505,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;
|
||||
}
|
||||
|
||||
@ -701,8 +717,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++)
|
||||
for (int i = 0; i < arraySize; i++)
|
||||
{
|
||||
array[i] = GetEntData(entity, offset + i*dataSize, dataSize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -718,7 +736,7 @@ stock void GetEntDataArray(int entity, int offset, int[] array, int arraySize, i
|
||||
*/
|
||||
stock void SetEntDataArray(int entity, int offset, const int[] array, int arraySize, int dataSize=4, bool changeState=false)
|
||||
{
|
||||
for (int i=0; i<arraySize; i++)
|
||||
for (int i = 0; i < arraySize; i++)
|
||||
{
|
||||
SetEntData(entity, offset + i*dataSize, array[i], dataSize, changeState);
|
||||
}
|
||||
|
76
env/include/entity_prop_stocks.inc
vendored
76
env/include/entity_prop_stocks.inc
vendored
@ -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
|
||||
@ -206,9 +206,9 @@ stock MoveType GetEntityMoveType(int entity)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_MoveType", datamap, sizeof(datamap));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -235,9 +235,9 @@ stock void SetEntityMoveType(int entity, MoveType mt)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_MoveType", datamap, sizeof(datamap));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -264,9 +264,9 @@ stock RenderMode GetEntityRenderMode(int entity)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_nRenderMode", prop, sizeof(prop));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -293,9 +293,9 @@ stock void SetEntityRenderMode(int entity, RenderMode mode)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_nRenderMode", prop, sizeof(prop));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -322,9 +322,9 @@ stock RenderFx GetEntityRenderFx(int entity)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_nRenderFX", prop, sizeof(prop));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -351,9 +351,9 @@ stock void SetEntityRenderFx(int entity, RenderFx fx)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_nRenderFX", prop, sizeof(prop));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -383,9 +383,9 @@ stock void GetEntityRenderColor(int entity, int &r, int &g, int &b, int &a)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_clrRender", prop, sizeof(prop));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -425,9 +425,9 @@ stock void SetEntityRenderColor(int entity, int r=255, int g=255, int b=255, int
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_clrRender", prop, sizeof(prop));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -464,9 +464,9 @@ stock float GetEntityGravity(int entity)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_flGravity", datamap, sizeof(datamap));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -493,9 +493,9 @@ stock void SetEntityGravity(int entity, float amount)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_flGravity", datamap, sizeof(datamap));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -522,9 +522,9 @@ stock void SetEntityHealth(int entity, int amount)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_iHealth", prop, sizeof(prop));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_iHealth", prop, sizeof(prop));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
@ -578,9 +578,9 @@ stock int GetClientButtons(int client)
|
||||
|
||||
if (!gotconfig)
|
||||
{
|
||||
Handle gc = LoadGameConfigFile("core.games");
|
||||
bool exists = GameConfGetKeyValue(gc, "m_nButtons", datamap, sizeof(datamap));
|
||||
CloseHandle(gc);
|
||||
GameData gc = new GameData("core.games");
|
||||
bool exists = gc.GetKeyValue("m_nButtons", datamap, sizeof(datamap));
|
||||
delete gc;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
|
5
env/include/events.inc
vendored
5
env/include/events.inc
vendored
@ -56,9 +56,11 @@ typeset EventHook
|
||||
// this event has set the hook mode EventHookMode_PostNoCopy.
|
||||
// @param name String containing the name of the event.
|
||||
// @param dontBroadcast True if event was not broadcast to clients, false otherwise.
|
||||
// May not correspond to the real value. Use the property BroadcastDisabled.
|
||||
// @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.
|
||||
//
|
||||
@ -160,6 +162,7 @@ methodmap Event < Handle
|
||||
// or HookEventEx callbacks.
|
||||
property bool BroadcastDisabled {
|
||||
public native set(bool dontBroadcast);
|
||||
public native get();
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,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);
|
||||
|
||||
|
20
env/include/files.inc
vendored
20
env/include/files.inc
vendored
@ -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. */
|
||||
@ -104,10 +104,10 @@ methodmap DirectoryListing < Handle
|
||||
|
||||
// A File object can be obtained by calling OpenFile(). File objects should be
|
||||
// closed with delete or Close(). Note that, "delete file" does not
|
||||
// actually a file, it just closes it.
|
||||
// actually delete the file, it just closes the handle.
|
||||
methodmap File < Handle
|
||||
{
|
||||
// Close the file handle. This is the same as using CloseHandle) or delete.
|
||||
// Close the file handle. This is the same as using CloseHandle() or delete.
|
||||
public void Close() {
|
||||
CloseHandle(this);
|
||||
}
|
||||
@ -233,6 +233,13 @@ methodmap File < Handle
|
||||
// @return True on success, false otherwise.
|
||||
public native bool Seek(int position, int where);
|
||||
|
||||
// Flushes a file's buffered output; any buffered output
|
||||
// is immediately written to the file.
|
||||
//
|
||||
// @return True on success or use_valve_fs specified with OpenFile,
|
||||
// otherwise false on failure.
|
||||
public native bool Flush();
|
||||
|
||||
// Get the current position in the file; returns -1 on failure.
|
||||
property int Position {
|
||||
public native get();
|
||||
@ -427,7 +434,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 +457,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);
|
||||
}
|
||||
|
||||
@ -574,6 +583,7 @@ native bool RemoveDir(const char[] path);
|
||||
* Valve search paths, rather than directly in the gamedir.
|
||||
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for default.
|
||||
* In this case, mode is ignored.
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
native bool CreateDirectory(const char[] path, int mode, bool use_valve_fs=false, const char[] valve_path_id="DEFAULT_WRITE_PATH");
|
||||
|
||||
|
38
env/include/float.inc
vendored
38
env/include/float.inc
vendored
@ -48,37 +48,53 @@ native float float(int value);
|
||||
/**
|
||||
* Multiplies two floats together.
|
||||
*
|
||||
* Note: This native is internal implementation. For multiplication use the '*' operator.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Divides the dividend by the divisor.
|
||||
*
|
||||
* Note: This native is internal implementation. For division use the '/' operator.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Adds two floats together.
|
||||
*
|
||||
* Note: This native is internal implementation. For addition use the '+' operator.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Subtracts oper2 from oper1.
|
||||
*
|
||||
* Note: This native is internal implementation. For subtraction use the '-' operator.
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
@ -248,6 +264,12 @@ stock int RoundFloat(float value)
|
||||
#if !defined __sourcepawn2__
|
||||
#pragma rational Float
|
||||
|
||||
// Internal aliases for backwards compatability.
|
||||
native float __FLOAT_MUL__(float a, float b) = FloatMul;
|
||||
native float __FLOAT_DIV__(float a, float b) = FloatDiv;
|
||||
native float __FLOAT_ADD__(float a, float b) = FloatAdd;
|
||||
native float __FLOAT_SUB__(float a, float b) = FloatSub;
|
||||
|
||||
native bool __FLOAT_GT__(float a, float b);
|
||||
native bool __FLOAT_GE__(float a, float b);
|
||||
native bool __FLOAT_LT__(float a, float b);
|
||||
@ -283,34 +305,36 @@ stock float operator-(float oper)
|
||||
return oper^view_as<float>(cellmin); /* IEEE values are sign/magnitude */
|
||||
}
|
||||
|
||||
// The stocks below are int->float converting versions of the above natives.
|
||||
|
||||
stock float operator*(float oper1, int oper2)
|
||||
{
|
||||
return FloatMul(oper1, float(oper2)); /* "*" is commutative */
|
||||
return __FLOAT_MUL__(oper1, float(oper2)); /* "*" is commutative */
|
||||
}
|
||||
|
||||
stock float operator/(float oper1, int oper2)
|
||||
{
|
||||
return FloatDiv(oper1, float(oper2));
|
||||
return __FLOAT_DIV__(oper1, float(oper2));
|
||||
}
|
||||
|
||||
stock float operator/(int oper1, float oper2)
|
||||
{
|
||||
return FloatDiv(float(oper1), oper2);
|
||||
return __FLOAT_DIV__(float(oper1), oper2);
|
||||
}
|
||||
|
||||
stock float operator+(float oper1, int oper2)
|
||||
{
|
||||
return FloatAdd(oper1, float(oper2)); /* "+" is commutative */
|
||||
return __FLOAT_ADD__(oper1, float(oper2)); /* "+" is commutative */
|
||||
}
|
||||
|
||||
stock float operator-(float oper1, int oper2)
|
||||
{
|
||||
return FloatSub(oper1, float(oper2));
|
||||
return __FLOAT_SUB__(oper1, float(oper2));
|
||||
}
|
||||
|
||||
stock float operator-(int oper1, float oper2)
|
||||
{
|
||||
return FloatSub(float(oper1), oper2);
|
||||
return __FLOAT_SUB__(float(oper1), oper2);
|
||||
}
|
||||
|
||||
stock bool operator==(float oper1, int oper2)
|
||||
@ -385,7 +409,7 @@ stock float DegToRad(float angle)
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts degrees to radians.
|
||||
* Converts radians to degrees.
|
||||
*
|
||||
* @param angle Radians.
|
||||
* @return Degrees.
|
||||
|
163
env/include/functions.inc
vendored
163
env/include/functions.inc
vendored
@ -111,11 +111,79 @@ enum ExecType
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
methodmap GlobalForward < Handle {
|
||||
// Creates a global forward.
|
||||
//
|
||||
// @note The name used to create the forward is used as its public function in all target plugins.
|
||||
// @note This is ideal for global, static forwards that are never changed.
|
||||
// @note Global forwards cannot be cloned.
|
||||
// @note Use CloseHandle() to destroy these.
|
||||
//
|
||||
// @param name Name of public function to use in forward.
|
||||
// @param type Execution type to be used.
|
||||
// @param ... Variable number of parameter types (up to 32).
|
||||
// @return Handle to new global forward.
|
||||
// @error More than 32 paramater types passed.
|
||||
public native GlobalForward(const char[] name, ExecType type, ParamType ...);
|
||||
|
||||
// Returns the number of functions in a global or private forward's call list.
|
||||
property int FunctionCount {
|
||||
public native get();
|
||||
}
|
||||
};
|
||||
|
||||
methodmap PrivateForward < GlobalForward {
|
||||
// Creates a private forward.
|
||||
//
|
||||
// @note No functions are automatically added. Use AddToForward() to do this.
|
||||
// @note Private forwards can be cloned.
|
||||
// @note Use CloseHandle() to destroy these.
|
||||
//
|
||||
// @param type Execution type to be used.
|
||||
// @param ... Variable number of parameter types (up to 32).
|
||||
// @return Handle to new private forward.
|
||||
// @error More than 32 paramater types passed.
|
||||
public native PrivateForward(ExecType type, ParamType ...);
|
||||
|
||||
// Adds a function to a private forward's call list.
|
||||
//
|
||||
// @note Cannot be used during an incomplete call.
|
||||
//
|
||||
// @param plugin Handle of the plugin that contains the function.
|
||||
// Pass INVALID_HANDLE to specify the calling plugin.
|
||||
// @param func Function to add to forward.
|
||||
// @return True on success, false otherwise.
|
||||
// @error Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function.
|
||||
public native bool AddFunction(Handle plugin, Function func);
|
||||
|
||||
// Removes a function from a private forward's call list.
|
||||
//
|
||||
// @note Only removes one instance.
|
||||
// @note Functions will be removed automatically if their parent plugin is unloaded.
|
||||
//
|
||||
// @param plugin Handle of the plugin that contains the function.
|
||||
// Pass INVALID_HANDLE to specify the calling plugin.
|
||||
// @param func Function to remove from forward.
|
||||
// @return True on success, false otherwise.
|
||||
// @error Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function.
|
||||
public native bool RemoveFunction(Handle plugin, Function func);
|
||||
|
||||
// Removes all instances of a plugin from a private forward's call list.
|
||||
//
|
||||
// @note Functions will be removed automatically if their parent plugin is unloaded.
|
||||
//
|
||||
// @param plugin Handle of the plugin to remove instances of.
|
||||
// Pass INVALID_HANDLE to specify the calling plugin.
|
||||
// @return Number of functions removed from forward.
|
||||
// @error Invalid or corrupt private forward handle or invalid or corrupt plugin handle.
|
||||
public native int RemoveAllFunctions(Handle plugin);
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@ -136,7 +204,7 @@ native Function GetFunctionByName(Handle plugin, const char[] name);
|
||||
* @return Handle to new global forward.
|
||||
* @error More than 32 paramater types passed.
|
||||
*/
|
||||
native Handle CreateGlobalForward(const char[] name, ExecType type, ParamType ...);
|
||||
native GlobalForward CreateGlobalForward(const char[] name, ExecType type, ParamType ...);
|
||||
|
||||
/**
|
||||
* Creates a private forward.
|
||||
@ -150,7 +218,7 @@ native Handle CreateGlobalForward(const char[] name, ExecType type, ParamType ..
|
||||
* @return Handle to new private forward.
|
||||
* @error More than 32 paramater types passed.
|
||||
*/
|
||||
native Handle CreateForward(ExecType type, ParamType ...);
|
||||
native PrivateForward CreateForward(ExecType type, ParamType ...);
|
||||
|
||||
/**
|
||||
* Returns the number of functions in a global or private forward's call list.
|
||||
@ -225,6 +293,17 @@ native void Call_StartForward(Handle fwd);
|
||||
*/
|
||||
native void Call_StartFunction(Handle plugin, Function func);
|
||||
|
||||
/**
|
||||
* Starts a call to a native.
|
||||
*
|
||||
* @note Cannot be used during an incomplete call.
|
||||
*
|
||||
* @param name Name of the native.
|
||||
* @return True on success, false otherwise.
|
||||
* @error Invalid function, or called before another call has completed.
|
||||
*/
|
||||
native bool Call_StartNative(const char[] name);
|
||||
|
||||
/**
|
||||
* Pushes a cell onto the current call.
|
||||
*
|
||||
@ -290,6 +369,16 @@ native void Call_PushArray(const any[] value, int size);
|
||||
*/
|
||||
native void Call_PushArrayEx(any[] value, int size, int cpflags);
|
||||
|
||||
/**
|
||||
* Pushes the NULL_VECTOR onto the current call.
|
||||
* @see IsNullVector
|
||||
*
|
||||
* @note Cannot be used before a call has been started.
|
||||
*
|
||||
* @error Called before a call has been started.
|
||||
*/
|
||||
native void Call_PushNullVector();
|
||||
|
||||
/**
|
||||
* Pushes a string onto the current call.
|
||||
*
|
||||
@ -317,6 +406,16 @@ native void Call_PushString(const char[] value);
|
||||
*/
|
||||
native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags);
|
||||
|
||||
/**
|
||||
* Pushes the NULL_STRING onto the current call.
|
||||
* @see IsNullString
|
||||
*
|
||||
* @note Cannot be used before a call has been started.
|
||||
*
|
||||
* @error Called before a call has been started.
|
||||
*/
|
||||
native void Call_PushNullString();
|
||||
|
||||
/**
|
||||
* Completes a call to a function or forward's call list.
|
||||
*
|
||||
@ -328,6 +427,20 @@ native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags
|
||||
*/
|
||||
native int Call_Finish(any &result=0);
|
||||
|
||||
/**
|
||||
* Completes a call to a function or forward's call list.
|
||||
* Catches exceptions thrown by the native.
|
||||
*
|
||||
* @note Cannot be used before a call has been started.
|
||||
*
|
||||
* @param result Return value of function or forward's call list.
|
||||
* @param exception Buffer to store the exception in.
|
||||
* @param maxlength Maximum length of the buffer.
|
||||
* @return SP_ERROR_NONE on success, any other integer on failure.
|
||||
* @error Called before a call has been started.
|
||||
*/
|
||||
native int Call_FinishEx(any &result=0, char[] exception, int maxlength);
|
||||
|
||||
/**
|
||||
* Cancels a call to a function or forward's call list.
|
||||
*
|
||||
@ -337,7 +450,9 @@ native int Call_Finish(any &result=0);
|
||||
*/
|
||||
native void Call_Cancel();
|
||||
|
||||
/**
|
||||
typeset NativeCall
|
||||
{
|
||||
/**
|
||||
* Defines a native function.
|
||||
*
|
||||
* It is not necessary to validate the parameter count
|
||||
@ -346,7 +461,19 @@ native void Call_Cancel();
|
||||
* @param numParams Number of parameters passed to the native.
|
||||
* @return Value for the native call to return.
|
||||
*/
|
||||
typedef NativeCall = function int (Handle plugin, int numParams);
|
||||
function int (Handle plugin, int numParams);
|
||||
|
||||
/**
|
||||
* Defines a native function.
|
||||
*
|
||||
* It is not necessary to validate the parameter count
|
||||
*
|
||||
* @param plugin Handle of the calling plugin.
|
||||
* @param numParams Number of parameters passed to the native.
|
||||
* @return Value for the native call to return.
|
||||
*/
|
||||
function any (Handle plugin, int numParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a dynamic native. This should only be called in AskPluginLoad(), or
|
||||
@ -368,8 +495,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.
|
||||
@ -381,6 +509,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.
|
||||
@ -394,6 +523,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.
|
||||
@ -465,6 +595,22 @@ native int GetNativeArray(int param, any[] local, int size);
|
||||
*/
|
||||
native int SetNativeArray(int param, const any[] local, int size);
|
||||
|
||||
/**
|
||||
* Check if the native parameter is the NULL_VECTOR.
|
||||
*
|
||||
* @param param Parameter number, starting from 1.
|
||||
* @return True if NULL_VECTOR, false otherwise.
|
||||
*/
|
||||
native bool IsNativeParamNullVector(int param);
|
||||
|
||||
/**
|
||||
* Check if the native parameter is the NULL_STRING.
|
||||
*
|
||||
* @param param Parameter number, starting from 1.
|
||||
* @return True if NULL_STRING, false otherwise.
|
||||
*/
|
||||
native bool IsNativeParamNullString(int param);
|
||||
|
||||
/**
|
||||
* Formats a string using parameters from a native.
|
||||
*
|
||||
@ -494,7 +640,10 @@ native int FormatNativeString(int out_param,
|
||||
*
|
||||
* @param data Data passed to the RequestFrame native.
|
||||
*/
|
||||
typedef RequestFrameCallback = function void (any data);
|
||||
typeset RequestFrameCallback {
|
||||
function void ();
|
||||
function void (any data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a single use Next Frame hook.
|
||||
|
12
env/include/halflife.inc
vendored
12
env/include/halflife.inc
vendored
@ -89,6 +89,7 @@ enum EngineVersion
|
||||
Engine_Insurgency, /**< Insurgency (2013 Retail version)*/
|
||||
Engine_Contagion, /**< Contagion */
|
||||
Engine_BlackMesa, /**< Black Mesa Multiplayer */
|
||||
Engine_DOI /**< Day of Infamy */
|
||||
};
|
||||
|
||||
enum FindMapResult
|
||||
@ -211,6 +212,13 @@ native float GetGameTime();
|
||||
*/
|
||||
native int GetGameTickCount();
|
||||
|
||||
/**
|
||||
* Returns the time the Game took processing the last frame.
|
||||
*
|
||||
* @return Game frame time.
|
||||
*/
|
||||
native float GetGameFrameTime();
|
||||
|
||||
/**
|
||||
* Returns the game description from the mod.
|
||||
*
|
||||
@ -335,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();
|
||||
@ -658,11 +667,10 @@ native int EntRefToEntIndex(int ref);
|
||||
*/
|
||||
native int MakeCompatEntRef(int ref);
|
||||
|
||||
|
||||
enum ClientRangeType
|
||||
{
|
||||
RangeType_Visibility = 0,
|
||||
RangeType_Audibility,
|
||||
RangeType_Audibility
|
||||
}
|
||||
|
||||
/**
|
||||
|
11
env/include/handles.inc
vendored
11
env/include/handles.inc
vendored
@ -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);
|
||||
|
62
env/include/helpers.inc
vendored
62
env/include/helpers.inc
vendored
@ -36,31 +36,19 @@
|
||||
#define _helpers_included
|
||||
|
||||
/**
|
||||
* Formats a user's info as log text. This is usually not needed because
|
||||
* %L can be used to auto-format client information into a string.
|
||||
* This function is deprecated. Use the %L format specifier instead.
|
||||
*
|
||||
* Formats a user's info as log text.
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
char auth[32];
|
||||
char name[MAX_NAME_LENGTH];
|
||||
|
||||
int userid = GetClientUserId(client);
|
||||
if (!GetClientAuthString(client, auth, sizeof(auth)))
|
||||
{
|
||||
strcopy(auth, sizeof(auth), "UNKNOWN");
|
||||
}
|
||||
if (!GetClientName(client, name, sizeof(name)))
|
||||
{
|
||||
strcopy(name, sizeof(name), "UNKNOWN");
|
||||
}
|
||||
|
||||
/** Currently, no team stuff ... */
|
||||
|
||||
Format(buffer, maxlength, "\"%s<%d><%s><>\"", name, userid, auth);
|
||||
FormatEx(buffer, maxlength, "\"%L\"", client);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,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;
|
||||
}
|
||||
@ -130,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;
|
||||
}
|
||||
@ -163,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;
|
||||
@ -180,11 +185,9 @@ stock int FindTarget(int client, const char[] target, bool nobots = false, bool
|
||||
{
|
||||
return target_list[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ReplyToTargetError(client, target_count);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,10 +204,11 @@ 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)
|
||||
{
|
||||
stock int LoadMaps(Handle array, int &fileTime = 0, Handle fileCvar = INVALID_HANDLE)
|
||||
{
|
||||
char mapPath[256], mapFile[64];
|
||||
bool fileFound = false;
|
||||
|
||||
|
14
env/include/keyvalues.inc
vendored
14
env/include/keyvalues.inc
vendored
@ -49,7 +49,7 @@ enum KvDataTypes
|
||||
KvData_Color, /**< Color value */
|
||||
KvData_UInt64, /**< Large integer value */
|
||||
/* --- */
|
||||
KvData_NUMTYPES,
|
||||
KvData_NUMTYPES
|
||||
};
|
||||
|
||||
methodmap KeyValues < Handle
|
||||
@ -68,6 +68,18 @@ methodmap KeyValues < Handle
|
||||
// @return True on success, false otherwise.
|
||||
public native bool ExportToFile(const char[] file);
|
||||
|
||||
// Exports a KeyValues tree to a string. The string is dumped from the current position.
|
||||
//
|
||||
// @param buffer Buffer to write to.
|
||||
// @param maxlength Max length of buffer.
|
||||
// @return Number of bytes that can be written to buffer.
|
||||
public native int ExportToString(char[] buffer, int maxlength);
|
||||
|
||||
// Amount of bytes written by ExportToFile & ExportToString.
|
||||
property int ExportLength {
|
||||
public native get();
|
||||
}
|
||||
|
||||
// Imports a file in KeyValues format. The file is read into the current
|
||||
// position of the tree.
|
||||
//
|
||||
|
18
env/include/lang.inc
vendored
18
env/include/lang.inc
vendored
@ -114,3 +114,21 @@ native int GetLanguageByCode(const char[] code);
|
||||
* @return Language number. -1 if not found.
|
||||
*/
|
||||
native int GetLanguageByName(const char[] name);
|
||||
|
||||
/**
|
||||
* Determines if the specified phrase exists within the plugin's
|
||||
* translation cache.
|
||||
*
|
||||
* @param phrase Phrase to look for.
|
||||
* @return True if phrase exists.
|
||||
*/
|
||||
native bool TranslationPhraseExists(const char[] phrase);
|
||||
|
||||
/**
|
||||
* Determines if there is a translation for the specified language.
|
||||
*
|
||||
* @param phrase Phrase to check.
|
||||
* @param language Language number.
|
||||
* @return True if translation exists.
|
||||
*/
|
||||
native bool IsTranslatedForLanguage(const char[] phrase, int language);
|
||||
|
7
env/include/mapchooser.inc
vendored
7
env/include/mapchooser.inc
vendored
@ -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);
|
||||
|
63
env/include/menus.inc
vendored
63
env/include/menus.inc
vendored
@ -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 */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -309,9 +307,23 @@ methodmap Menu < Handle
|
||||
// @param style By-reference variable to store drawing flags.
|
||||
// @param dispBuf Display buffer.
|
||||
// @param dispBufLen Maximum length of the display buffer.
|
||||
// @param client Client index. Must be specified if menu is per-client random shuffled, -1 to ignore.
|
||||
// @return True on success, false if position is invalid.
|
||||
public native bool GetItem(int position, char[] infoBuf, int infoBufLen,
|
||||
int &style=0, char[] dispBuf="", int dispBufLen=0);
|
||||
int &style=0, char[] dispBuf="", int dispBufLen=0, int client=0);
|
||||
|
||||
// Generates a per-client random mapping for the current vote options.
|
||||
//
|
||||
// @param start Menu item index to start randomizing from.
|
||||
// @param stop Menu item index to stop randomizing at. -1 = infinite
|
||||
public native void ShufflePerClient(int start=0, int stop=-1);
|
||||
|
||||
// Fills the client vote option mapping with user supplied values.
|
||||
//
|
||||
// @param client Client index.
|
||||
// @param array Integer array with mapping.
|
||||
// @param length Length of array.
|
||||
public native void SetClientMapping(int client, int[] array, int length);
|
||||
|
||||
// Sets the menu's default title/instruction message.
|
||||
//
|
||||
@ -321,7 +333,6 @@ methodmap Menu < Handle
|
||||
|
||||
// Returns the text of a menu's title.
|
||||
//
|
||||
// @param menu Menu Handle.
|
||||
// @param buffer Buffer to store title.
|
||||
// @param maxlength Maximum length of the buffer.
|
||||
// @return Number of bytes written.
|
||||
@ -330,7 +341,6 @@ methodmap Menu < Handle
|
||||
// Creates a raw MenuPanel based off the menu's style.
|
||||
// The Handle must be freed with CloseHandle().
|
||||
//
|
||||
// @param menu Menu Handle.
|
||||
// @return A new MenuPanel Handle.
|
||||
public native Panel ToPanel();
|
||||
|
||||
@ -371,7 +381,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);
|
||||
@ -539,6 +551,7 @@ native void RemoveAllMenuItems(Handle menu);
|
||||
* @param style By-reference variable to store drawing flags.
|
||||
* @param dispBuf Display buffer.
|
||||
* @param dispBufLen Maximum length of the display buffer.
|
||||
* @param client Client index. Must be specified if menu is per-client random shuffled, -1 to ignore.
|
||||
* @return True on success, false if position is invalid.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
@ -548,7 +561,27 @@ native bool GetMenuItem(Handle menu,
|
||||
int infoBufLen,
|
||||
int &style=0,
|
||||
char[] dispBuf="",
|
||||
int dispBufLen=0);
|
||||
int dispBufLen=0,
|
||||
int client=0);
|
||||
|
||||
/**
|
||||
* Generates a per-client random mapping for the current vote options.
|
||||
*
|
||||
* @param menu Menu Handle.
|
||||
* @param start Menu item index to start randomizing from.
|
||||
* @param stop Menu item index to stop randomizing at. -1 = infinite
|
||||
*/
|
||||
native void MenuShufflePerClient(Handle menu, int start=0, int stop=-1);
|
||||
|
||||
/*
|
||||
* Fills the client vote option mapping with user supplied values.
|
||||
*
|
||||
* @param menu Menu Handle.
|
||||
* @param client Client index.
|
||||
* @param array Integer array with mapping.
|
||||
* @param length Length of array.
|
||||
*/
|
||||
native void MenuSetClientMapping(Handle menu, int client, int[] array, int length);
|
||||
|
||||
/**
|
||||
* Returns the first item on the page of a currently selected menu.
|
||||
@ -922,10 +955,10 @@ native MenuSource GetClientMenu(int client, Handle hStyle=null);
|
||||
/**
|
||||
* Cancels a menu on a client. This will only affect non-external menus.
|
||||
*
|
||||
* @param hStyle MenuStyle Handle, or INVALID_HANDLE to use the default style.
|
||||
* @param client Client index.
|
||||
* @param autoIgnore If true, no menus can be re-drawn on the client during
|
||||
* the cancellation process.
|
||||
* @param hStyle MenuStyle Handle, or INVALID_HANDLE to use the default style.
|
||||
* @return True if a menu was cancelled, false otherwise.
|
||||
*/
|
||||
native bool CancelClientMenu(int client, bool autoIgnore=false, Handle hStyle=INVALID_HANDLE);
|
||||
|
32
env/include/profiler.inc
vendored
32
env/include/profiler.inc
vendored
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* SourceMod (C)2004-2018 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
@ -39,13 +39,39 @@
|
||||
* ONLY AVAILABLE ON WINDOWS RIGHT NOW K.
|
||||
*/
|
||||
|
||||
methodmap Profiler < Handle
|
||||
{
|
||||
// Creates a new profile object. The Handle must be freed
|
||||
// using delete or CloseHandle().
|
||||
//
|
||||
// @return A new Profiler Handle.
|
||||
public native Profiler();
|
||||
|
||||
// Starts a cycle for profiling.
|
||||
public native void Start();
|
||||
|
||||
// Stops a cycle for profiling.
|
||||
//
|
||||
// @error Profiler was never started.
|
||||
public native void Stop();
|
||||
|
||||
// Returns the amount of high-precision time in seconds
|
||||
// that passed during the profiler's last start/stop
|
||||
// cycle.
|
||||
//
|
||||
// @return Time elapsed in seconds.
|
||||
property float Time {
|
||||
public native get();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new profile object. The Handle must be freed
|
||||
* using CloseHandle().
|
||||
* using delete or CloseHandle().
|
||||
*
|
||||
* @return Handle to the profiler object.
|
||||
*/
|
||||
native Handle CreateProfiler();
|
||||
native Profiler CreateProfiler();
|
||||
|
||||
/**
|
||||
* Starts profiling.
|
||||
|
36
env/include/protobuf.inc
vendored
36
env/include/protobuf.inc
vendored
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#if defined _protobuf_included
|
||||
#endinput
|
||||
#endinput
|
||||
#endif
|
||||
#define _protobuf_included
|
||||
|
||||
@ -47,6 +47,14 @@ methodmap Protobuf < Handle
|
||||
// @error Non-existent field, or incorrect field type.
|
||||
public native int ReadInt(const char[] field, int index = PB_FIELD_NOT_REPEATED);
|
||||
|
||||
// Reads an int64, uint64, sint64, fixed64, sfixed64 from a protobuf message.
|
||||
//
|
||||
// @param field Field name.
|
||||
// @param value Array to represent the large integer (0=High bits, 1=Low bits).
|
||||
// @param index Index into repeated field.
|
||||
// @error Non-existent field, or incorrect field type.
|
||||
public native void ReadInt64(const char[] field, int value[2], int index = PB_FIELD_NOT_REPEATED);
|
||||
|
||||
// Reads a float or downcasted double from a protobuf message.
|
||||
//
|
||||
// @param field Field name.
|
||||
@ -109,16 +117,31 @@ methodmap Protobuf < Handle
|
||||
//
|
||||
// @param field Field name.
|
||||
// @return Number of elements in the field.
|
||||
// @error Non-existent field, or incorrect field type.
|
||||
// @error Non-existent field, or non-repeated field.
|
||||
public native int GetRepeatedFieldCount(const char[] field);
|
||||
|
||||
// Returns whether or not the named, non-repeated field has a value set.
|
||||
//
|
||||
// @param field Field name.
|
||||
// @return True if value has been set, else false.
|
||||
// @error Non-existent field, or repeated field.
|
||||
public native bool HasField(const char[] field);
|
||||
|
||||
// Sets an int32, uint32, sint32, fixed32, sfixed32, or enum value on a protobuf message.
|
||||
//
|
||||
// @param field Field name.
|
||||
// @param value Integer value to set.
|
||||
// @param index Index into repeated field.
|
||||
// @error Non-existent field, or incorrect field type.
|
||||
public native int SetInt(const char[] field, int value, int index = PB_FIELD_NOT_REPEATED);
|
||||
public native void SetInt(const char[] field, int value, int index = PB_FIELD_NOT_REPEATED);
|
||||
|
||||
// Sets an int64, uint64, sint64, fixed64, sfixed64 on a protobuf message.
|
||||
//
|
||||
// @param field Field name.
|
||||
// @param value Large integer value to set (0=High bits, 1=Low bits).
|
||||
// @param index Index into repeated field.
|
||||
// @error Non-existent field, or incorrect field type.
|
||||
public native void SetInt64(const char[] field, int value[2], int index = PB_FIELD_NOT_REPEATED);
|
||||
|
||||
// Sets a float or double on a protobuf message.
|
||||
//
|
||||
@ -183,6 +206,13 @@ methodmap Protobuf < Handle
|
||||
// @error Non-existent field, or incorrect field type.
|
||||
public native void AddInt(const char[] field, int value);
|
||||
|
||||
// Add an int64, uint64, sint64, fixed64, sfixed64 to a protobuf message repeated field.
|
||||
//
|
||||
// @param field Field name.
|
||||
// @param value Large integer value to add (0=High bits, 1=Low bits).
|
||||
// @error Non-existent field, or incorrect field type.
|
||||
public native void AddInt64(const char[] field, int value[2]);
|
||||
|
||||
// Add a float or double to a protobuf message repeated field.
|
||||
//
|
||||
// @param field Field name.
|
||||
|
101
env/include/regex.inc
vendored
101
env/include/regex.inc
vendored
@ -58,6 +58,24 @@
|
||||
enum RegexError
|
||||
{
|
||||
REGEX_ERROR_NONE = 0, /* No error */
|
||||
|
||||
REGEX_ERROR_ASSERT = 1, /* internal error ? */
|
||||
REGEX_ERROR_BADBR, /* invalid repeat counts in {} */
|
||||
REGEX_ERROR_BADPAT, /* pattern error */
|
||||
REGEX_ERROR_BADRPT, /* ? * + invalid */
|
||||
REGEX_ERROR_EBRACE, /* unbalanced {} */
|
||||
REGEX_ERROR_EBRACK, /* unbalanced [] */
|
||||
REGEX_ERROR_ECOLLATE, /* collation error - not relevant */
|
||||
REGEX_ERROR_ECTYPE, /* bad class */
|
||||
REGEX_ERROR_EESCAPE, /* bad escape sequence */
|
||||
REGEX_ERROR_EMPTY, /* empty expression */
|
||||
REGEX_ERROR_EPAREN, /* unbalanced () */
|
||||
REGEX_ERROR_ERANGE, /* bad range inside [] */
|
||||
REGEX_ERROR_ESIZE, /* expression too big */
|
||||
REGEX_ERROR_ESPACE, /* failed to get memory */
|
||||
REGEX_ERROR_ESUBREG, /* bad back reference */
|
||||
REGEX_ERROR_INVARG, /* bad argument */
|
||||
|
||||
REGEX_ERROR_NOMATCH = -1, /* No match was found */
|
||||
REGEX_ERROR_NULL = -2,
|
||||
REGEX_ERROR_BADOPTION = -3,
|
||||
@ -89,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
|
||||
@ -108,25 +126,57 @@ methodmap Regex < Handle
|
||||
// Matches a string against a pre-compiled regular expression pattern.
|
||||
//
|
||||
// @param str The string to check.
|
||||
// @param regex Regex Handle from CompileRegex()
|
||||
// @param ret Error code, if applicable.
|
||||
// @return Number of substrings found or -1 on failure.
|
||||
// @param offset Offset in the string to start searching from. MatchOffset returns the offset of the match.
|
||||
// @return Number of captures found or -1 on failure.
|
||||
//
|
||||
// @note Use the regex handle passed to this function to extract
|
||||
// matches with GetRegexSubString().
|
||||
public native int Match(const char[] str, RegexError &ret = REGEX_ERROR_NONE);
|
||||
// matches with GetSubString().
|
||||
public native int Match(const char[] str, RegexError &ret = REGEX_ERROR_NONE, int offset = 0);
|
||||
|
||||
// Gets all matches from a string against a pre-compiled regular expression pattern.
|
||||
//
|
||||
// @param str The string to check.
|
||||
// @param ret Error code, if applicable.
|
||||
// @return Number of matches found or -1 on failure.
|
||||
//
|
||||
// @note Use GetSubString() and loop from 0 -> totalmatches - 1.
|
||||
public native int MatchAll(const char[] str, RegexError &ret = REGEX_ERROR_NONE);
|
||||
|
||||
// Returns a matched substring from a regex handle.
|
||||
//
|
||||
// Substring ids start at 0 and end at substrings-1, where substrings is the
|
||||
// number returned by Regex.Match.
|
||||
// Substring ids start at 0 and end at captures-1, where captures is the
|
||||
// number returned by Regex.Match or Regex.CaptureCount.
|
||||
//
|
||||
// @param regex The regex handle to extract data from.
|
||||
// @param str_id The index of the expression to get - starts at 0, and ends at substrings - 1.
|
||||
// @param str_id The index of the expression to get - starts at 0, and ends at captures - 1.
|
||||
// @param buffer The buffer to set to the matching substring.
|
||||
// @param maxlen The maximum string length of the buffer.
|
||||
// @param match Match to get the captures for - starts at 0, and ends at MatchCount() -1
|
||||
// @return True if a substring was found, False on fail/error
|
||||
public native bool GetSubString(int str_id, char[] buffer, int maxlen);
|
||||
//
|
||||
// @note str_id = 0 is the full captured string, anything else is the capture group index.
|
||||
// if Regex.Match is used match can only be 0
|
||||
public native bool GetSubString(int str_id, char[] buffer, int maxlen, int match = 0);
|
||||
|
||||
// Returns number of matches
|
||||
//
|
||||
// When using Match this is always 1 or 0 (unless an error occured)
|
||||
// @return Total number of matches found.
|
||||
public native int MatchCount();
|
||||
|
||||
// Returns number of captures for a match
|
||||
//
|
||||
// @param match Match to get the number of captures for. Match starts at 0, and ends at MatchCount() -1
|
||||
// @return Number of captures in the match.
|
||||
//
|
||||
// @note Use GetSubString() and loop from 1 -> captures -1 for str_id to get all captures
|
||||
public native int CaptureCount(int match = 0);
|
||||
|
||||
// Returns the string offset of a match.
|
||||
//
|
||||
// @param match Match to get the offset of. Match starts at 0, and ends at MatchCount() -1
|
||||
// @return Offset of the match in the string.
|
||||
public native int MatchOffset(int match = 0);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -146,10 +196,10 @@ native Regex CompileRegex(const char[] pattern, int flags = 0, char[] error="",
|
||||
/**
|
||||
* Matches a string against a pre-compiled regular expression pattern.
|
||||
*
|
||||
* @param str The string to check.
|
||||
* @param regex Regex Handle from CompileRegex()
|
||||
* @param str The string to check.
|
||||
* @param ret Error code, if applicable.
|
||||
* @return Number of substrings found or -1 on failure.
|
||||
* @return Number of captures found or -1 on failure.
|
||||
*
|
||||
* @note Use the regex handle passed to this function to extract
|
||||
* matches with GetRegexSubString().
|
||||
@ -158,14 +208,17 @@ native int MatchRegex(Handle regex, const char[] str, RegexError &ret = REGEX_ER
|
||||
|
||||
/**
|
||||
* Returns a matched substring from a regex handle.
|
||||
* Substring ids start at 0 and end at substrings-1, where substrings is the number returned
|
||||
* by MatchRegex
|
||||
* Substring ids start at 0 and end at captures-1, where captures is the number returned
|
||||
* by MatchRegex.
|
||||
*
|
||||
* @param regex The regex handle to extract data from.
|
||||
* @param str_id The index of the expression to get - starts at 0, and ends at substrings - 1.
|
||||
* @param str_id The index of the expression to get - starts at 0, and ends at captures - 1.
|
||||
* @param buffer The buffer to set to the matching substring.
|
||||
* @param maxlen The maximum string length of the buffer.
|
||||
* @return True if a substring was found, False on fail/error
|
||||
*
|
||||
* @note str_id = 0 is the full captured string, anything else is the capture group index.
|
||||
*
|
||||
*/
|
||||
native bool GetRegexSubString(Handle regex, int str_id, char[] buffer, int maxlen);
|
||||
|
||||
@ -187,7 +240,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;
|
||||
@ -217,3 +272,19 @@ public Extension __ext_regex =
|
||||
required = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !defined REQUIRE_EXTENSIONS
|
||||
public void __ext_regex_SetNTVOptional()
|
||||
{
|
||||
MarkNativeAsOptional("CompileRegex");
|
||||
MarkNativeAsOptional("MatchRegex");
|
||||
MarkNativeAsOptional("GetRegexSubString");
|
||||
MarkNativeAsOptional("Regex.Regex");
|
||||
MarkNativeAsOptional("Regex.Match");
|
||||
MarkNativeAsOptional("Regex.MatchAll");
|
||||
MarkNativeAsOptional("Regex.GetSubString");
|
||||
MarkNativeAsOptional("Regex.MatchCount");
|
||||
MarkNativeAsOptional("Regex.CaptureCount");
|
||||
MarkNativeAsOptional("Regex.MatchOffset");
|
||||
}
|
||||
#endif
|
||||
|
63
env/include/sdkhooks.inc
vendored
63
env/include/sdkhooks.inc
vendored
@ -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 */
|
||||
@ -72,8 +74,31 @@
|
||||
#endif
|
||||
|
||||
#if !defined DMG_CRIT
|
||||
// TF2 crits and minicrits
|
||||
#define DMG_CRIT DMG_ACID
|
||||
#define DMG_CRIT DMG_ACID /**< TF2 crits and minicrits */
|
||||
#endif
|
||||
|
||||
#if !defined DMG_RADIUS_MAX
|
||||
#define DMG_RADIUS_MAX DMG_ENERGYBEAM /**< No damage falloff */
|
||||
#endif
|
||||
|
||||
#if !defined DMG_NOCLOSEDISTANCEMOD
|
||||
#define DMG_NOCLOSEDISTANCEMOD DMG_POISON /**< Don't do damage falloff too close */
|
||||
#endif
|
||||
|
||||
#if !defined DMG_HALF_FALLOFF
|
||||
#define DMG_HALF_FALLOFF DMG_RADIATION /**< 50% damage falloff */
|
||||
#endif
|
||||
|
||||
#if !defined DMG_USEDISTANCEMOD
|
||||
#define DMG_USEDISTANCEMOD DMG_SLOWBURN /**< Do damage falloff */
|
||||
#endif
|
||||
|
||||
#if !defined DMG_IGNITE
|
||||
#define DMG_IGNITE DMG_PLASMA /**< Ignite victim */
|
||||
#endif
|
||||
|
||||
#if !defined DMG_USE_HITLOCATIONS
|
||||
#define DMG_USE_HITLOCATIONS DMG_AIRBOAT /**< Do hit location damage (Like the sniperrifle and ambassador) */
|
||||
#endif
|
||||
|
||||
enum SDKHookType
|
||||
@ -121,7 +146,7 @@ enum SDKHookType
|
||||
SDKHook_BlockedPost,
|
||||
SDKHook_OnTakeDamageAlive,
|
||||
SDKHook_OnTakeDamageAlivePost,
|
||||
SDKHook_CanBeAutobalanced,
|
||||
SDKHook_CanBeAutobalanced
|
||||
};
|
||||
|
||||
/*
|
||||
@ -301,7 +326,7 @@ typeset SDKHookCB
|
||||
|
||||
|
||||
/**
|
||||
* @brief When an entity is created
|
||||
* When an entity is created
|
||||
*
|
||||
* @param entity Entity index
|
||||
* @param classname Class name
|
||||
@ -309,14 +334,22 @@ typeset SDKHookCB
|
||||
forward void OnEntityCreated(int entity, const char[] classname);
|
||||
|
||||
/**
|
||||
* @brief When an entity is destroyed
|
||||
* When an entity is spawned
|
||||
*
|
||||
* @param entity Entity index
|
||||
* @param classname Class name
|
||||
*/
|
||||
forward void OnEntitySpawned(int entity, const char[] classname);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -326,7 +359,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
|
||||
@ -335,7 +368,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
|
||||
@ -344,17 +377,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
|
||||
@ -363,7 +396,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)
|
||||
*
|
||||
@ -381,7 +414,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.
|
||||
|
13
env/include/sdktools.inc
vendored
13
env/include/sdktools.inc
vendored
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* SourceMod (C)2004-2017 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
@ -46,6 +46,7 @@
|
||||
#include <sdktools_tempents>
|
||||
#include <sdktools_tempents_stocks>
|
||||
#include <sdktools_voice>
|
||||
#include <sdktools_variant_t>
|
||||
#include <sdktools_entinput>
|
||||
#include <sdktools_entoutput>
|
||||
#include <sdktools_hooks>
|
||||
@ -59,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
|
||||
@ -85,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
|
||||
@ -93,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 */
|
||||
|
59
env/include/sdktools_entinput.inc
vendored
59
env/include/sdktools_entinput.inc
vendored
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* SourceMod (C)2004-2017 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
@ -49,60 +49,3 @@
|
||||
* @error Invalid entity index or no mod support.
|
||||
*/
|
||||
native bool AcceptEntityInput(int dest, const char[] input, int activator=-1, int caller=-1, int outputid=0);
|
||||
|
||||
/**
|
||||
* Sets a bool value in the global variant object.
|
||||
*
|
||||
* @param val Input value.
|
||||
*/
|
||||
native void SetVariantBool(bool val);
|
||||
|
||||
/**
|
||||
* Sets a string in the global variant object.
|
||||
*
|
||||
* @param str Input string.
|
||||
*/
|
||||
native void SetVariantString(const char[] str);
|
||||
|
||||
/**
|
||||
* Sets an integer value in the global variant object.
|
||||
*
|
||||
* @param val Input value.
|
||||
*/
|
||||
native void SetVariantInt(int val);
|
||||
|
||||
/**
|
||||
* Sets a floating point value in the global variant object.
|
||||
*
|
||||
* @param val Input value.
|
||||
*/
|
||||
native void SetVariantFloat(float val);
|
||||
|
||||
/**
|
||||
* Sets a 3D vector in the global variant object.
|
||||
*
|
||||
* @param vec Input vector.
|
||||
*/
|
||||
native void SetVariantVector3D(const float vec[3]);
|
||||
|
||||
/**
|
||||
* Sets a 3D position vector in the global variant object.
|
||||
*
|
||||
* @param vec Input position vector.
|
||||
*/
|
||||
native void SetVariantPosVector3D(const float vec[3]);
|
||||
|
||||
/**
|
||||
* Sets a color in the global variant object.
|
||||
*
|
||||
* @param color Input color.
|
||||
*/
|
||||
native void SetVariantColor(const int color[4]);
|
||||
|
||||
/**
|
||||
* Sets an entity in the global variant object.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @error Invalid entity index.
|
||||
*/
|
||||
native void SetVariantEntity(int entity);
|
||||
|
15
env/include/sdktools_entoutput.inc
vendored
15
env/include/sdktools_entoutput.inc
vendored
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
||||
* SourceMod (C)2004-2017 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
@ -93,3 +93,16 @@ native void HookSingleEntityOutput(int entity, const char[] output, EntityOutput
|
||||
* @error Entity Outputs disabled or Invalid Entity index.
|
||||
*/
|
||||
native bool UnhookSingleEntityOutput(int entity, const char[] output, EntityOutput callback);
|
||||
|
||||
/**
|
||||
* Fire a named output on an entity.
|
||||
*
|
||||
* After completion (successful or not), the current global variant is re-initialized.
|
||||
*
|
||||
* @param caller Entity index from where the output is fired.
|
||||
* @param output Output name.
|
||||
* @param activator Entity index which initiated the sequence of actions (-1 for a NULL entity).
|
||||
* @param delay Delay before firing the output.
|
||||
* @error Invalid entity index or no mod support.
|
||||
*/
|
||||
native void FireEntityOutput(int caller, const char[] output, int activator=-1, float delay=0.0);
|
||||
|
1
env/include/sdktools_functions.inc
vendored
1
env/include/sdktools_functions.inc
vendored
@ -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);
|
||||
|
2
env/include/sdktools_gamerules.inc
vendored
2
env/include/sdktools_gamerules.inc
vendored
@ -68,7 +68,7 @@ enum RoundState {
|
||||
RoundState_Bonus,
|
||||
|
||||
//Between rounds
|
||||
RoundState_BetweenRounds,
|
||||
RoundState_BetweenRounds
|
||||
};
|
||||
|
||||
/**
|
||||
|
26
env/include/sdktools_hooks.inc
vendored
26
env/include/sdktools_hooks.inc
vendored
@ -38,7 +38,7 @@
|
||||
#define FEATURECAP_PLAYERRUNCMD_11PARAMS "SDKTools PlayerRunCmd 11Params"
|
||||
|
||||
/**
|
||||
* @brief Called when a clients movement buttons are being processed
|
||||
* Called when a clients movement buttons are being processed
|
||||
*
|
||||
* @param client Index of the client.
|
||||
* @param buttons Copyback buffer containing the current commands (as bitflags - see entity_prop_stocks.inc).
|
||||
@ -53,13 +53,29 @@
|
||||
* @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]);
|
||||
|
||||
/**
|
||||
* @brief Called when a client requests a file from the server.
|
||||
* Called after a clients movement buttons were processed.
|
||||
*
|
||||
* @param client Index of the client.
|
||||
* @param buttons The current commands (as bitflags - see entity_prop_stocks.inc).
|
||||
* @param impulse The current impulse command.
|
||||
* @param vel Players desired velocity.
|
||||
* @param angles Players desired view angles.
|
||||
* @param weapon Entity index of the new weapon if player switches weapon, 0 otherwise.
|
||||
* @param subtype Weapon subtype when selected from a menu.
|
||||
* @param cmdnum Command number. Increments from the first command sent.
|
||||
* @param tickcount Tick count. A client's prediction based on the server's GetGameTickCount value.
|
||||
* @param seed Random seed. Used to determine weapon recoil, spread, and other predicted elements.
|
||||
* @param mouse Mouse direction (x, y).
|
||||
*/
|
||||
forward void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype, int cmdnum, int tickcount, int seed, const int mouse[2]);
|
||||
|
||||
/**
|
||||
* Called when a client requests a file from the server.
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param sFile Requested file path.
|
||||
@ -69,7 +85,7 @@ forward Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[
|
||||
forward Action OnFileSend(int client, const char[] sFile);
|
||||
|
||||
/**
|
||||
* @brief Called when a client sends a file to the server.
|
||||
* Called when a client sends a file to the server.
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param sFile Requested file path.
|
||||
|
42
env/include/sdktools_sound.inc
vendored
42
env/include/sdktools_sound.inc
vendored
@ -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 */
|
||||
@ -124,7 +124,7 @@ enum
|
||||
/**
|
||||
* Prefetches a sound.
|
||||
*
|
||||
* @param name Sound file name relative to the "sounds" folder.
|
||||
* @param name Sound file name relative to the "sound" folder.
|
||||
*/
|
||||
native void PrefetchSound(const char[] name);
|
||||
|
||||
@ -132,8 +132,9 @@ native void PrefetchSound(const char[] name);
|
||||
* This function is not known to work, and may crash. You should
|
||||
* not use it. It is provided for backwards compatibility only.
|
||||
*
|
||||
* @param name Sound file name relative to the "sounds" folder.
|
||||
* @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);
|
||||
@ -141,7 +142,7 @@ native float GetSoundDuration(const char[] name);
|
||||
/**
|
||||
* Emits an ambient sound.
|
||||
*
|
||||
* @param name Sound file name relative to the "sounds" folder.
|
||||
* @param name Sound file name relative to the "sound" folder.
|
||||
* @param pos Origin of sound.
|
||||
* @param entity Entity index to associate sound with.
|
||||
* @param level Sound level (from 0 to 255).
|
||||
@ -176,7 +177,7 @@ native void FadeClientVolume(int client, float percent, float outtime, float hol
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @param channel Channel number.
|
||||
* @param name Sound file name relative to the "sounds" folder.
|
||||
* @param name Sound file name relative to the "sound" folder.
|
||||
*/
|
||||
native void StopSound(int entity, int channel, const char[] name);
|
||||
|
||||
@ -185,7 +186,7 @@ native void StopSound(int entity, int channel, const char[] name);
|
||||
*
|
||||
* @param clients Array of client indexes.
|
||||
* @param numClients Number of clients in the array.
|
||||
* @param sample Sound file name relative to the "sounds" folder.
|
||||
* @param sample Sound file name relative to the "sound" folder.
|
||||
* @param entity Entity to emit from.
|
||||
* @param channel Channel to emit with.
|
||||
* @param level Sound level.
|
||||
@ -223,7 +224,7 @@ native void EmitSound(const int[] clients,
|
||||
* @param clients Array of client indexes.
|
||||
* @param numClients Number of clients in the array.
|
||||
* @param soundEntry Sound entry name.
|
||||
* @param sample Sound file name relative to the "sounds" folder.
|
||||
* @param sample Sound file name relative to the "sound" folder.
|
||||
* @param entity Entity to emit from.
|
||||
* @param channel Channel to emit with.
|
||||
* @param level Sound level.
|
||||
@ -307,7 +308,7 @@ native float GetDistGainFromSoundLevel(int soundlevel, float distance);
|
||||
*
|
||||
* NOTICE: all parameters can be overwritten to modify the default behavior.
|
||||
*
|
||||
* @param sample Sound file name relative to the "sounds" folder.
|
||||
* @param sample Sound file name relative to the "sound" folder.
|
||||
* @param entity Entity index associated to the sound.
|
||||
* @param volume Volume (from 0.0 to 1.0).
|
||||
* @param level Sound level (from 0 to 255).
|
||||
@ -336,7 +337,7 @@ typeset NormalSHook
|
||||
//
|
||||
// @param clients Array of client indexes.
|
||||
// @param numClients Number of clients in the array (modify this value if you add/remove elements from the client array).
|
||||
// @param sample Sound file name relative to the "sounds" folder.
|
||||
// @param sample Sound file name relative to the "sound" folder.
|
||||
// @param entity Entity emitting the sound.
|
||||
// @param channel Channel emitting the sound.
|
||||
// @param volume Sound volume.
|
||||
@ -397,7 +398,7 @@ native void RemoveNormalSoundHook(NormalSHook hook);
|
||||
* Wrapper to emit sound to one client.
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param sample Sound file name relative to the "sounds" folder.
|
||||
* @param sample Sound file name relative to the "sound" folder.
|
||||
* @param entity Entity to emit from.
|
||||
* @param channel Channel to emit with.
|
||||
* @param level Sound level.
|
||||
@ -437,7 +438,7 @@ stock void EmitSoundToClient(int client,
|
||||
/**
|
||||
* Wrapper to emit sound to all clients.
|
||||
*
|
||||
* @param sample Sound file name relative to the "sounds" folder.
|
||||
* @param sample Sound file name relative to the "sound" folder.
|
||||
* @param entity Entity to emit from.
|
||||
* @param channel Channel to emit with.
|
||||
* @param level Sound level.
|
||||
@ -475,14 +476,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -515,7 +514,7 @@ stock int ATTN_TO_SNDLEVEL(float attn)
|
||||
* @param level Sound level.
|
||||
* @param volume Sound volume.
|
||||
* @param pitch Sound pitch.
|
||||
* @param sample Sound file name relative to the "sounds" folder.
|
||||
* @param sample Sound file name relative to the "sound" folder.
|
||||
* @param maxlength Maximum length of sample string buffer.
|
||||
* @param entity Entity the sound is being emitted from.
|
||||
* @return True if the sound was successfully retrieved, false if it
|
||||
@ -574,10 +573,8 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -612,10 +609,8 @@ stock bool EmitAmbientGameSound(const char[] gameSound,
|
||||
EmitAmbientSound(sample, pos, entity, level, flags, volume, pitch, delay);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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
|
||||
*/
|
||||
|
299
env/include/sdktools_trace.inc
vendored
299
env/include/sdktools_trace.inc
vendored
@ -100,6 +100,60 @@
|
||||
#define MASK_NPCWORLDSTATIC (CONTENTS_SOLID|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE) /**< just the world, used for route rebuilding */
|
||||
#define MASK_SPLITAREAPORTAL (CONTENTS_WATER|CONTENTS_SLIME) /**< These are things that can split areaportals */
|
||||
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Surface flags.
|
||||
*/
|
||||
|
||||
#define SURF_LIGHT 0x0001 /**< value will hold the light strength */
|
||||
#define SURF_SKY2D 0x0002 /**< don't draw, indicates we should skylight + draw 2d sky but not draw the 3D skybox */
|
||||
#define SURF_SKY 0x0004 /**< don't draw, but add to skybox */
|
||||
#define SURF_WARP 0x0008 /**< turbulent water warp */
|
||||
#define SURF_TRANS 0x0010
|
||||
#define SURF_NOPORTAL 0x0020 /**< the surface can not have a portal placed on it */
|
||||
#define SURF_TRIGGER 0x0040 /**< This is an xbox hack to work around elimination of trigger surfaces, which breaks occluders */
|
||||
#define SURF_NODRAW 0x0080 /**< don't bother referencing the texture */
|
||||
|
||||
#define SURF_HINT 0x0100 /**< make a primary bsp splitter */
|
||||
|
||||
#define SURF_SKIP 0x0200 /**< completely ignore, allowing non-closed brushes */
|
||||
#define SURF_NOLIGHT 0x0400 /**< Don't calculate light */
|
||||
#define SURF_BUMPLIGHT 0x0800 /**< calculate three lightmaps for the surface for bumpmapping */
|
||||
#define SURF_NOSHADOWS 0x1000 /**< Don't receive shadows */
|
||||
#define SURF_NODECALS 0x2000 /**< Don't receive decals */
|
||||
#define SURF_NOCHOP 0x4000 /**< Don't subdivide patches on this surface */
|
||||
#define SURF_HITBOX 0x8000 /**< surface is part of a hitbox */
|
||||
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Partition masks.
|
||||
*/
|
||||
|
||||
#define PARTITION_SOLID_EDICTS (1 << 1) /**< every edict_t that isn't SOLID_TRIGGER or SOLID_NOT (and static props) */
|
||||
#define PARTITION_TRIGGER_EDICTS (1 << 2) /**< every edict_t that IS SOLID_TRIGGER */
|
||||
#define PARTITION_NON_STATIC_EDICTS (1 << 5) /**< everything in solid & trigger except the static props, includes SOLID_NOTs */
|
||||
#define PARTITION_STATIC_PROPS (1 << 7)
|
||||
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Displacement flags.
|
||||
*/
|
||||
|
||||
#define DISPSURF_FLAG_SURFACE (1<<0)
|
||||
#define DISPSURF_FLAG_WALKABLE (1<<1)
|
||||
#define DISPSURF_FLAG_BUILDABLE (1<<2)
|
||||
#define DISPSURF_FLAG_SURFPROP1 (1<<3)
|
||||
#define DISPSURF_FLAG_SURFPROP2 (1<<4)
|
||||
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
@ -132,6 +186,25 @@ typeset TraceEntityFilter
|
||||
function bool (int entity, int contentsMask, any data);
|
||||
};
|
||||
|
||||
typeset TraceEntityEnumerator
|
||||
{
|
||||
/**
|
||||
* Called for each entity enumerated with EnumerateEntities*.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @return True to continue enumerating, otherwise false.
|
||||
*/
|
||||
function bool (int entity);
|
||||
|
||||
/**
|
||||
* Called for each entity enumerated with EnumerateEntities*.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @param data Data value, if used.
|
||||
* @return True to continue enumerating, otherwise false. */
|
||||
function bool (int entity, any data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents mask and the entity index at the given position.
|
||||
*
|
||||
@ -179,6 +252,49 @@ native void TR_TraceHull(const float pos[3],
|
||||
const float maxs[3],
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* Enumerates over entities along a ray. This may find entities that are
|
||||
* close to the ray but do not actually intersect it. Use TR_Clip*RayToEntity
|
||||
* with TR_DidHit to check if the ray actually intersects the entity.
|
||||
*
|
||||
* @param pos Starting position of the ray.
|
||||
* @param vec Depending on RayType, it will be used as the ending
|
||||
* point, or the direction angle.
|
||||
* @param mask Mask to use for the trace. See PARTITION_* flags.
|
||||
* @param rtype Method to calculate the ray direction.
|
||||
* @param enumerator Function to use as enumerator. For each entity found
|
||||
* along the ray, this function is called.
|
||||
* @param data Arbitrary data value to pass through to the enumerator.
|
||||
*/
|
||||
native void TR_EnumerateEntities(const float pos[3],
|
||||
const float vec[3],
|
||||
int mask,
|
||||
RayType rtype,
|
||||
TraceEntityEnumerator enumerator,
|
||||
any data=0);
|
||||
|
||||
/**
|
||||
* Enumerates over entities along a ray hull. This may find entities that are
|
||||
* close to the ray but do not actually intersect it. Use TR_Clip*RayToEntity
|
||||
* with TR_DidHit to check if the ray actually intersects the entity.
|
||||
*
|
||||
* @param pos Starting position of the ray.
|
||||
* @param vec Ending position of the ray.
|
||||
* @param mins Hull minimum size.
|
||||
* @param maxs Hull maximum size.
|
||||
* @param mask Mask to use for the trace. See PARTITION_* flags.
|
||||
* @param enumerator Function to use as enumerator. For each entity found
|
||||
* along the ray, this function is called.
|
||||
* @param data Arbitrary data value to pass through to the enumerator.
|
||||
*/
|
||||
native void TR_EnumerateEntitiesHull(const float pos[3],
|
||||
const float vec[3],
|
||||
const float mins[3],
|
||||
const float maxs[3],
|
||||
int mask,
|
||||
TraceEntityEnumerator enumerator,
|
||||
any data=0);
|
||||
|
||||
/**
|
||||
* Starts up a new trace ray using a global trace result and a customized
|
||||
* trace ray filter.
|
||||
@ -210,8 +326,7 @@ native void TR_TraceRayFilter(const float pos[3],
|
||||
* function is currently not allowed and may not work.
|
||||
*
|
||||
* @param pos Starting position of the ray.
|
||||
* @param vec Depending on RayType, it will be used as the ending
|
||||
* point, or the direction angle.
|
||||
* @param vec Ending position of the ray.
|
||||
* @param mins Hull minimum size.
|
||||
* @param maxs Hull maximum size.
|
||||
* @param flags Trace flags.
|
||||
@ -227,6 +342,47 @@ native void TR_TraceHullFilter(const float pos[3],
|
||||
TraceEntityFilter filter,
|
||||
any data=0);
|
||||
|
||||
/**
|
||||
* Clips a ray to a particular entity.
|
||||
*
|
||||
* @param pos Starting position of the ray.
|
||||
* @param vec Depending on RayType, it will be used as the ending
|
||||
* point, or the direction angle.
|
||||
* @param flags Trace flags.
|
||||
* @param rtype Method to calculate the ray direction.
|
||||
* @param entity Entity to clip to.
|
||||
*/
|
||||
native void TR_ClipRayToEntity(const float pos[3],
|
||||
const float vec[3],
|
||||
int flags,
|
||||
RayType rtype,
|
||||
int entity);
|
||||
|
||||
/**
|
||||
* Clips a ray hull to a particular entity.
|
||||
*
|
||||
* @param pos Starting position of the ray.
|
||||
* @param vec Ending position of the ray.
|
||||
* @param mins Hull minimum size.
|
||||
* @param maxs Hull maximum size.
|
||||
* @param flags Trace flags.
|
||||
* @param entity Entity to clip to.
|
||||
*/
|
||||
native void TR_ClipRayHullToEntity(const float pos[3],
|
||||
const float vec[3],
|
||||
const float mins[3],
|
||||
const float maxs[3],
|
||||
int flags,
|
||||
int entity);
|
||||
|
||||
/**
|
||||
* Clips the current global ray (or hull) to a particular entity.
|
||||
*
|
||||
* @param flags Trace flags.
|
||||
* @param entity Entity to clip to.
|
||||
*/
|
||||
native void TR_ClipCurrentRayToEntity(int flags, int entity);
|
||||
|
||||
/**
|
||||
* Starts up a new trace ray using a new trace result.
|
||||
*
|
||||
@ -305,6 +461,50 @@ native Handle TR_TraceHullFilterEx(const float pos[3],
|
||||
TraceEntityFilter filter,
|
||||
any data=0);
|
||||
|
||||
/**
|
||||
* Clips a ray to a particular entity.
|
||||
*
|
||||
* @param pos Starting position of the ray.
|
||||
* @param vec Depending on RayType, it will be used as the ending
|
||||
* point, or the direction angle.
|
||||
* @param flags Trace flags.
|
||||
* @param rtype Method to calculate the ray direction.
|
||||
* @param entity Entity to clip to.
|
||||
* @return Ray trace handle, which must be closed via CloseHandle().
|
||||
*/
|
||||
native Handle TR_ClipRayToEntityEx(const float pos[3],
|
||||
const float vec[3],
|
||||
int flags,
|
||||
RayType rtype,
|
||||
int entity);
|
||||
|
||||
/**
|
||||
* Clips a ray hull to a particular entity.
|
||||
*
|
||||
* @param pos Starting position of the ray.
|
||||
* @param vec Ending position of the ray.
|
||||
* @param mins Hull minimum size.
|
||||
* @param maxs Hull maximum size.
|
||||
* @param flags Trace flags.
|
||||
* @param entity Entity to clip to.
|
||||
* @return Ray trace handle, which must be closed via CloseHandle().
|
||||
*/
|
||||
native Handle TR_ClipRayHullToEntityEx(const float pos[3],
|
||||
const float vec[3],
|
||||
const float mins[3],
|
||||
const float maxs[3],
|
||||
int flags,
|
||||
int entity);
|
||||
|
||||
/**
|
||||
* Clips the current global ray (or hull) to a particular entity.
|
||||
*
|
||||
* @param flags Trace flags.
|
||||
* @param entity Entity to clip to.
|
||||
* @return Ray trace handle, which must be closed via CloseHandle().
|
||||
*/
|
||||
native Handle TR_ClipCurrentRayToEntityEx(int flags, int entity);
|
||||
|
||||
/**
|
||||
* Returns the time fraction from a trace result (1.0 means no collision).
|
||||
*
|
||||
@ -314,6 +514,25 @@ native Handle TR_TraceHullFilterEx(const float pos[3],
|
||||
*/
|
||||
native float TR_GetFraction(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns the time fraction from a trace result when it left a solid.
|
||||
* Only valid if trace started in solid
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return Time fraction left solid value of the trace.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native float TR_GetFractionLeftSolid(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns the starting position of a trace.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @param pos Vector buffer to store data in.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native void TR_GetStartPosition(Handle hndl, float pos[3]);
|
||||
|
||||
/**
|
||||
* Returns the collision position of a trace result.
|
||||
*
|
||||
@ -332,6 +551,70 @@ native void TR_GetEndPosition(float pos[3], Handle hndl=INVALID_HANDLE);
|
||||
*/
|
||||
native int TR_GetEntityIndex(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns the displacement flags for the surface that was hit. See DISPSURF_FLAG_*.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return Displacement flags.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native int TR_GetDisplacementFlags(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns the name of the surface that was hit.
|
||||
*
|
||||
* @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
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native void TR_GetSurfaceName(Handle hndl, char[] buffer, int maxlen);
|
||||
|
||||
/**
|
||||
* Returns the surface properties index of the surface that was hit.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return Surface props.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native int TR_GetSurfaceProps(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns the surface flags. See SURF_*.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return Surface flags.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native int TR_GetSurfaceFlags(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns the index of the physics bone that was hit.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return Physics bone index.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native int TR_GetPhysicsBone(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns whether the entire trace was in a solid area.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return True if entire trace was in a solid area, otherwise false.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native bool TR_AllSolid(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns whether the initial point was in a solid area.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return True if initial point was in a solid area, otherwise false.
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native bool TR_StartSolid(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns if there was any kind of collision along the trace ray.
|
||||
*
|
||||
@ -350,6 +633,18 @@ native bool TR_DidHit(Handle hndl=INVALID_HANDLE);
|
||||
*/
|
||||
native int TR_GetHitGroup(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Returns in which hitbox the trace collided if any.
|
||||
*
|
||||
* Note: if the entity that collided with the trace is the world entity,
|
||||
* then this function doesn't return an hitbox index but a static prop index.
|
||||
*
|
||||
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
|
||||
* @return Hitbox index (Or static prop index).
|
||||
* @error Invalid Handle.
|
||||
*/
|
||||
native int TR_GetHitBoxIndex(Handle hndl=INVALID_HANDLE);
|
||||
|
||||
/**
|
||||
* Find the normal vector to the collision plane of a trace.
|
||||
*
|
||||
|
93
env/include/sdktools_variant_t.inc
vendored
Normal file
93
env/include/sdktools_variant_t.inc
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2017 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#if defined _sdktools_variant_t_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _sdktools_variant_t_included
|
||||
|
||||
/**
|
||||
* Sets a bool value in the global variant object.
|
||||
*
|
||||
* @param val Input value.
|
||||
*/
|
||||
native void SetVariantBool(bool val);
|
||||
|
||||
/**
|
||||
* Sets a string in the global variant object.
|
||||
*
|
||||
* @param str Input string.
|
||||
*/
|
||||
native void SetVariantString(const char[] str);
|
||||
|
||||
/**
|
||||
* Sets an integer value in the global variant object.
|
||||
*
|
||||
* @param val Input value.
|
||||
*/
|
||||
native void SetVariantInt(int val);
|
||||
|
||||
/**
|
||||
* Sets a floating point value in the global variant object.
|
||||
*
|
||||
* @param val Input value.
|
||||
*/
|
||||
native void SetVariantFloat(float val);
|
||||
|
||||
/**
|
||||
* Sets a 3D vector in the global variant object.
|
||||
*
|
||||
* @param vec Input vector.
|
||||
*/
|
||||
native void SetVariantVector3D(const float vec[3]);
|
||||
|
||||
/**
|
||||
* Sets a 3D position vector in the global variant object.
|
||||
*
|
||||
* @param vec Input position vector.
|
||||
*/
|
||||
native void SetVariantPosVector3D(const float vec[3]);
|
||||
|
||||
/**
|
||||
* Sets a color in the global variant object.
|
||||
*
|
||||
* @param color Input color.
|
||||
*/
|
||||
native void SetVariantColor(const int color[4]);
|
||||
|
||||
/**
|
||||
* Sets an entity in the global variant object.
|
||||
*
|
||||
* @param entity Entity index.
|
||||
* @error Invalid entity index.
|
||||
*/
|
||||
native void SetVariantEntity(int entity);
|
4
env/include/sdktools_voice.inc
vendored
4
env/include/sdktools_voice.inc
vendored
@ -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);
|
||||
|
2
env/include/sorting.inc
vendored
2
env/include/sorting.inc
vendored
@ -53,7 +53,7 @@ enum SortType
|
||||
{
|
||||
Sort_Integer = 0,
|
||||
Sort_Float,
|
||||
Sort_String,
|
||||
Sort_String
|
||||
};
|
||||
|
||||
/**
|
||||
|
90
env/include/sourcemod.inc
vendored
90
env/include/sourcemod.inc
vendored
@ -132,6 +132,7 @@ native FeatureStatus GetFeatureStatus(FeatureType type, const char[] name);
|
||||
native void RequireFeature(FeatureType type, const char[] name,
|
||||
const char[] fmt="", any ...);
|
||||
|
||||
|
||||
#include <core>
|
||||
#include <float>
|
||||
#include <vector>
|
||||
@ -169,6 +170,37 @@ enum APLRes
|
||||
APLRes_SilentFailure /**< Plugin shouldn't load but do so silently */
|
||||
};
|
||||
|
||||
methodmap GameData < Handle
|
||||
{
|
||||
// Loads a game config file.
|
||||
//
|
||||
// @param file File to load. The path must be relative to the 'gamedata' folder under the config folder
|
||||
// and the extension should be omitted.
|
||||
// @return A handle to the game config file or null on failure.
|
||||
public native GameData(const char[] file);
|
||||
|
||||
// Returns an offset value.
|
||||
//
|
||||
// @param key Key to retrieve from the offset section.
|
||||
// @return An offset, or -1 on failure.
|
||||
public native int GetOffset(const char[] key);
|
||||
|
||||
// Gets the value of a key from the "Keys" section.
|
||||
//
|
||||
// @param key Key to retrieve from the Keys section.
|
||||
// @param buffer Destination string buffer.
|
||||
// @param maxlen Maximum length of output string buffer.
|
||||
// @return True if key existed, false otherwise.
|
||||
public native bool GetKeyValue(const char[] key, char[] buffer, int maxlen);
|
||||
|
||||
// Finds an address calculation in a GameConfig file,
|
||||
// performs LoadFromAddress on it as appropriate, then returns the final address.
|
||||
//
|
||||
// @param name Name of the property to find.
|
||||
// @return An address calculated on success, or 0 on failure.
|
||||
public native Address GetAddress(const char[] name);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when the plugin is fully initialized and all known external references
|
||||
* are resolved. This is only called once in the lifetime of the plugin, and is
|
||||
@ -199,7 +231,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.
|
||||
@ -397,6 +428,16 @@ native void SetFailState(const char[] string, any ...);
|
||||
*/
|
||||
native void ThrowError(const char[] fmt, any ...);
|
||||
|
||||
/**
|
||||
* Logs a stack trace from the current function call. Code
|
||||
* execution continues after the call
|
||||
*
|
||||
* @param fmt Format string to send with the stack trace.
|
||||
* @param ... Format arguments.
|
||||
* @error Always logs a stack trace.
|
||||
*/
|
||||
native void LogStackTrace(const char[] fmt, any ...);
|
||||
|
||||
/**
|
||||
* Gets the system time as a unix timestamp.
|
||||
*
|
||||
@ -411,6 +452,10 @@ native int GetTime(int bigStamp[2]={0,0});
|
||||
* See this URL for valid parameters:
|
||||
* http://cplusplus.com/reference/clibrary/ctime/strftime.html
|
||||
*
|
||||
* Note that available parameters depends on support from your operating system.
|
||||
* In particular, ones highlighted in yellow on that page are not currently
|
||||
* available on Windows and should be avoided for portable plugins.
|
||||
*
|
||||
* @param buffer Destination string buffer.
|
||||
* @param maxlength Maximum length of output string buffer.
|
||||
* @param format Formatting rules (passing NULL_STRING will use the rules defined in sm_datetime_format).
|
||||
@ -424,9 +469,9 @@ native void FormatTime(char[] buffer, int maxlength, const char[] format, int st
|
||||
*
|
||||
* @param file File to load. The path must be relative to the 'gamedata' folder under the config folder
|
||||
* and the extension should be omitted.
|
||||
* @return A handle to the game config file or INVALID_HANDLE in failure.
|
||||
* @return A handle to the game config file or INVALID_HANDLE on failure.
|
||||
*/
|
||||
native Handle LoadGameConfigFile(const char[] file);
|
||||
native GameData LoadGameConfigFile(const char[] file);
|
||||
|
||||
/**
|
||||
* Returns an offset value.
|
||||
@ -452,7 +497,7 @@ native bool GameConfGetKeyValue(Handle gc, const char[] key, char[] buffer, int
|
||||
* Finds an address calculation in a GameConfig file,
|
||||
* performs LoadFromAddress on it as appropriate, then returns the final address.
|
||||
*
|
||||
* @param gameconf GameConfig Handle, or INVALID_HANDLE to use sdktools.games.txt.
|
||||
* @param gameconf Game config handle.
|
||||
* @param name Name of the property to find.
|
||||
* @return An address calculated on success, or 0 on failure.
|
||||
*/
|
||||
@ -563,8 +608,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
|
||||
@ -624,7 +669,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
|
||||
};
|
||||
|
||||
/**
|
||||
@ -645,6 +690,37 @@ native int LoadFromAddress(Address addr, NumberType size);
|
||||
*/
|
||||
native void StoreToAddress(Address addr, int data, NumberType size);
|
||||
|
||||
methodmap FrameIterator < Handle {
|
||||
// Creates a stack frame iterator to build your own stack traces.
|
||||
// @return New handle to a FrameIterator.
|
||||
public native FrameIterator();
|
||||
|
||||
// Advances the iterator to the next stack frame.
|
||||
// @return True if another frame was fetched and data can be successfully read.
|
||||
// @error No next element exception.
|
||||
public native bool Next();
|
||||
|
||||
// Resets the iterator back to it's starting position.
|
||||
public native void Reset();
|
||||
|
||||
// Returns the line number of the current function call.
|
||||
property int LineNumber {
|
||||
public native get();
|
||||
}
|
||||
|
||||
// Gets the name of the current function in the call stack.
|
||||
//
|
||||
// @param buffer Buffer to copy to.
|
||||
// @param maxlen Max size of the buffer.
|
||||
public native void GetFunctionName(char[] buffer, int maxlen);
|
||||
|
||||
// Gets the file path to the current call in the call stack.
|
||||
//
|
||||
// @param buffer Buffer to copy to.
|
||||
// @param maxlen Max size of the buffer.
|
||||
public native void GetFilePath(char[] buffer, int maxlen);
|
||||
}
|
||||
|
||||
#include <helpers>
|
||||
#include <entity>
|
||||
#include <entity_prop_stocks>
|
||||
|
27
env/include/string.inc
vendored
27
env/include/string.inc
vendored
@ -392,10 +392,10 @@ native bool IsCharLower(int chr);
|
||||
native bool StripQuotes(char[] text);
|
||||
|
||||
/**
|
||||
* Returns an uppercase character to a lowercase character.
|
||||
* Converts a lowercase character to its uppercase counterpart.
|
||||
*
|
||||
* @param chr Character to convert.
|
||||
* @return Lowercase character on success,
|
||||
* @return Uppercase character on success,
|
||||
* no change on failure.
|
||||
*/
|
||||
stock int CharToUpper(int chr)
|
||||
@ -404,14 +404,15 @@ stock int CharToUpper(int chr)
|
||||
{
|
||||
return (chr & ~(1<<5));
|
||||
}
|
||||
|
||||
return chr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a lowercase character to an uppercase character.
|
||||
* Converts an uppercase character to its lowercase counterpart.
|
||||
*
|
||||
* @param chr Character to convert.
|
||||
* @return Uppercase character on success,
|
||||
* @return Lowercase character on success,
|
||||
* no change on failure.
|
||||
*/
|
||||
stock int CharToLower(int 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;
|
||||
}
|
||||
|
21
env/include/testing.inc
vendored
21
env/include/testing.inc
vendored
@ -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);
|
||||
}
|
||||
|
86
env/include/textparse.inc
vendored
86
env/include/textparse.inc
vendored
@ -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.
|
||||
*
|
||||
|
257
env/include/tf2.inc
vendored
257
env/include/tf2.inc
vendored
@ -42,6 +42,7 @@
|
||||
#define TF_STUNFLAG_NOSOUNDOREFFECT (1 << 5) /**< no sound or particle */
|
||||
#define TF_STUNFLAG_THIRDPERSON (1 << 6) /**< panic animation */
|
||||
#define TF_STUNFLAG_GHOSTEFFECT (1 << 7) /**< ghost particles */
|
||||
#define TF_STUNFLAG_SOUND (1 << 8) /**< sound */
|
||||
|
||||
#define TF_STUNFLAGS_LOSERSTATE TF_STUNFLAG_SLOWDOWN|TF_STUNFLAG_NOSOUNDOREFFECT|TF_STUNFLAG_THIRDPERSON
|
||||
#define TF_STUNFLAGS_GHOSTSCARE TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON
|
||||
@ -73,129 +74,139 @@ enum TFTeam
|
||||
|
||||
enum TFCond
|
||||
{
|
||||
TFCond_Slowed = 0,
|
||||
TFCond_Zoomed,
|
||||
TFCond_Disguising,
|
||||
TFCond_Disguised,
|
||||
TFCond_Cloaked,
|
||||
TFCond_Ubercharged,
|
||||
TFCond_TeleportedGlow,
|
||||
TFCond_Taunting,
|
||||
TFCond_UberchargeFading,
|
||||
TFCond_Slowed = 0, //0: Revving Minigun, Sniper Rifle. Gives zoomed/revved pose
|
||||
TFCond_Zoomed, //1: Sniper Rifle zooming
|
||||
TFCond_Disguising, //2: Disguise smoke
|
||||
TFCond_Disguised, //3: Disguise
|
||||
TFCond_Cloaked, //4: Cloak effect
|
||||
TFCond_Ubercharged, //5: Invulnerability, removed when being healed or by another Uber effect
|
||||
TFCond_TeleportedGlow, //6: Teleport trail effect
|
||||
TFCond_Taunting, //7: Used for taunting, can remove to stop taunting
|
||||
TFCond_UberchargeFading, //8: Invulnerability expiration effect
|
||||
TFCond_Unknown1, //9
|
||||
TFCond_CloakFlicker = 9,
|
||||
TFCond_Teleporting,
|
||||
TFCond_Kritzkrieged,
|
||||
TFCond_CloakFlicker = 9, //9: Cloak flickering effect
|
||||
TFCond_Teleporting, //10: Used for teleporting, does nothing applying
|
||||
TFCond_Kritzkrieged, //11: Crit boost, removed when being healed or another Uber effect
|
||||
TFCond_Unknown2, //12
|
||||
TFCond_TmpDamageBonus = 12,
|
||||
TFCond_DeadRingered,
|
||||
TFCond_Bonked,
|
||||
TFCond_Dazed,
|
||||
TFCond_Buffed,
|
||||
TFCond_Charging,
|
||||
TFCond_DemoBuff,
|
||||
TFCond_CritCola,
|
||||
TFCond_InHealRadius,
|
||||
TFCond_Healing,
|
||||
TFCond_OnFire,
|
||||
TFCond_Overhealed,
|
||||
TFCond_Jarated,
|
||||
TFCond_Bleeding,
|
||||
TFCond_DefenseBuffed,
|
||||
TFCond_Milked,
|
||||
TFCond_MegaHeal,
|
||||
TFCond_RegenBuffed,
|
||||
TFCond_MarkedForDeath,
|
||||
TFCond_NoHealingDamageBuff,
|
||||
TFCond_SpeedBuffAlly, // 32
|
||||
TFCond_HalloweenCritCandy,
|
||||
TFCond_CritCanteen,
|
||||
TFCond_CritDemoCharge,
|
||||
TFCond_CritHype,
|
||||
TFCond_CritOnFirstBlood,
|
||||
TFCond_CritOnWin,
|
||||
TFCond_CritOnFlagCapture,
|
||||
TFCond_CritOnKill,
|
||||
TFCond_RestrictToMelee,
|
||||
TFCond_DefenseBuffNoCritBlock,
|
||||
TFCond_Reprogrammed,
|
||||
TFCond_CritMmmph,
|
||||
TFCond_DefenseBuffMmmph,
|
||||
TFCond_FocusBuff,
|
||||
TFCond_DisguiseRemoved,
|
||||
TFCond_MarkedForDeathSilent,
|
||||
TFCond_DisguisedAsDispenser,
|
||||
TFCond_Sapped,
|
||||
TFCond_UberchargedHidden,
|
||||
TFCond_UberchargedCanteen,
|
||||
TFCond_HalloweenBombHead,
|
||||
TFCond_HalloweenThriller,
|
||||
TFCond_RadiusHealOnDamage,
|
||||
TFCond_CritOnDamage,
|
||||
TFCond_UberchargedOnTakeDamage,
|
||||
TFCond_UberBulletResist,
|
||||
TFCond_UberBlastResist,
|
||||
TFCond_UberFireResist,
|
||||
TFCond_SmallBulletResist,
|
||||
TFCond_SmallBlastResist,
|
||||
TFCond_SmallFireResist,
|
||||
TFCond_Stealthed, // 64
|
||||
TFCond_MedigunDebuff,
|
||||
TFCond_StealthedUserBuffFade,
|
||||
TFCond_BulletImmune,
|
||||
TFCond_BlastImmune,
|
||||
TFCond_FireImmune,
|
||||
TFCond_PreventDeath,
|
||||
TFCond_MVMBotRadiowave,
|
||||
TFCond_HalloweenSpeedBoost,
|
||||
TFCond_HalloweenQuickHeal,
|
||||
TFCond_HalloweenGiant,
|
||||
TFCond_HalloweenTiny,
|
||||
TFCond_HalloweenInHell,
|
||||
TFCond_HalloweenGhostMode,
|
||||
TFCond_MiniCritOnKill,
|
||||
TFCond_TmpDamageBonus = 12, //12: Temporary damage buff, something along with attribute 19
|
||||
TFCond_DeadRingered, //13: Dead Ringer damage resistance, gives TFCond_Cloaked
|
||||
TFCond_Bonked, //14: Bonk! Atomic Punch effect
|
||||
TFCond_Dazed, //15: Slow effect, can remove to remove stun effects
|
||||
TFCond_Buffed, //16: Buff Banner mini-crits, icon, and glow
|
||||
TFCond_Charging, //17: Forced forward, charge effect
|
||||
TFCond_DemoBuff, //18: Eyelander eye glow
|
||||
TFCond_CritCola, //19: Mini-crit effect
|
||||
TFCond_InHealRadius, //20: Ring effect, rings disappear after a taunt ends
|
||||
TFCond_Healing, //21: Used for healing, does nothing applying
|
||||
TFCond_OnFire, //22: Ignite sound and vocals, can remove to remove afterburn
|
||||
TFCond_Overhealed, //23: Used for overheal, does nothing applying
|
||||
TFCond_Jarated, //24: Jarate effect
|
||||
TFCond_Bleeding, //25: Bleed effect
|
||||
TFCond_DefenseBuffed, //26: Battalion's Backup's defense, icon, and glow
|
||||
TFCond_Milked, //27: Mad Milk effect
|
||||
TFCond_MegaHeal, //28: Quick-Fix Ubercharge's knockback/stun immunity and visual effect
|
||||
TFCond_RegenBuffed, //29: Concheror's speed boost, heal on hit, icon, and glow
|
||||
TFCond_MarkedForDeath, //30: Fan o' War marked-for-death effect
|
||||
TFCond_NoHealingDamageBuff, //31: Mini-crits, blocks healing, glow, no weapon mini-crit effects
|
||||
TFCond_SpeedBuffAlly, //32: Disciplinary Action speed boost
|
||||
TFCond_HalloweenCritCandy, //33: Halloween pumpkin crit-boost
|
||||
TFCond_CritCanteen, //34: Crit-boost and doubles Sentry Gun fire-rate
|
||||
TFCond_CritDemoCharge, //35: Crit glow, adds TFCond_Charging when charge meter is below 75%
|
||||
TFCond_CritHype, //36: Soda Popper multi-jump effect
|
||||
TFCond_CritOnFirstBlood, //37: Arena first blood crit-boost
|
||||
TFCond_CritOnWin, //38: End-of-round crit-boost (May not remove correctly?)
|
||||
TFCond_CritOnFlagCapture, //39: Intelligence capture crit-boost
|
||||
TFCond_CritOnKill, //40: Crit-boost from crit-on-kill weapons
|
||||
TFCond_RestrictToMelee, //41: Prevents switching once melee is out
|
||||
TFCond_DefenseBuffNoCritBlock, //42: MvM Bomb Carrier defense buff (TFCond_DefenseBuffed without crit resistance)
|
||||
TFCond_Reprogrammed, //43: No longer functions
|
||||
TFCond_CritMmmph, //44: Phlogistinator crit-boost
|
||||
TFCond_DefenseBuffMmmph, //45: Old Phlogistinator defense buff
|
||||
TFCond_FocusBuff, //46: Hitman's Heatmaker no-unscope and faster Sniper charge
|
||||
TFCond_DisguiseRemoved, //47: Enforcer damage bonus removed
|
||||
TFCond_MarkedForDeathSilent, //48: Marked-for-death without sound effect
|
||||
TFCond_DisguisedAsDispenser, //49: Dispenser disguise when crouching, max movement speed, sentries ignore player
|
||||
TFCond_Sapped, //50: Sapper sparkle effect in MvM
|
||||
TFCond_UberchargedHidden, //51: Out-of-bounds robot invulnerability effect
|
||||
TFCond_UberchargedCanteen, //52: Invulnerability effect and Sentry Gun damage resistance
|
||||
TFCond_HalloweenBombHead, //53: Bomb head effect (does not explode)
|
||||
TFCond_HalloweenThriller, //54: Forced Thriller taunting
|
||||
TFCond_RadiusHealOnDamage, //55: Radius healing, adds TFCond_InHealRadius, TFCond_Healing. Removed when a taunt ends, but this condition stays but does nothing
|
||||
TFCond_CritOnDamage, //56: Miscellaneous crit-boost
|
||||
TFCond_UberchargedOnTakeDamage, //57: Miscellaneous invulnerability
|
||||
TFCond_UberBulletResist, //58: Vaccinator Uber bullet resistance
|
||||
TFCond_UberBlastResist, //59: Vaccinator Uber blast resistance
|
||||
TFCond_UberFireResist, //60: Vaccinator Uber fire resistance
|
||||
TFCond_SmallBulletResist, //61: Vaccinator healing bullet resistance
|
||||
TFCond_SmallBlastResist, //62: Vaccinator healing blast resistance
|
||||
TFCond_SmallFireResist, //63: Vaccinator healing fire resistance
|
||||
TFCond_Stealthed, //64: Cloaked until next attack
|
||||
TFCond_MedigunDebuff, //65: Unknown
|
||||
TFCond_StealthedUserBuffFade, //66: Cloaked, will appear for a few seconds on attack and cloak again
|
||||
TFCond_BulletImmune, //67: Full bullet immunity
|
||||
TFCond_BlastImmune, //68: Full blast immunity
|
||||
TFCond_FireImmune, //69: Full fire immunity
|
||||
TFCond_PreventDeath, //70: Survive to 1 health, then the condition is removed
|
||||
TFCond_MVMBotRadiowave, //71: Stuns bots and applies radio effect
|
||||
TFCond_HalloweenSpeedBoost, //72: Speed boost, non-melee fire rate and reload, infinite air jumps
|
||||
TFCond_HalloweenQuickHeal, //73: Healing effect, adds TFCond_Healing along with TFCond_MegaHeal temporarily
|
||||
TFCond_HalloweenGiant, //74: Double size, x10 max health increase, ammo regeneration, and forced thirdperson
|
||||
TFCond_HalloweenTiny, //75: Half size and increased head size
|
||||
TFCond_HalloweenInHell, //76: Applies TFCond_HalloweenGhostMode when the player dies
|
||||
TFCond_HalloweenGhostMode, //77: Becomes a ghost unable to attack but can fly
|
||||
TFCond_MiniCritOnKill, //78: Mini-crits effect
|
||||
TFCond_DodgeChance, //79
|
||||
TFCond_ObscuredSmoke = 79,
|
||||
TFCond_Parachute,
|
||||
TFCond_BlastJumping,
|
||||
TFCond_HalloweenKart,
|
||||
TFCond_HalloweenKartDash,
|
||||
TFCond_BalloonHead,
|
||||
TFCond_MeleeOnly,
|
||||
TFCond_SwimmingCurse,
|
||||
TFCond_ObscuredSmoke = 79, //79: 75% chance to dodge an attack
|
||||
TFCond_Parachute, //80: Parachute effect, removed when touching the ground
|
||||
TFCond_BlastJumping, //81: Player is blast jumping
|
||||
TFCond_HalloweenKart, //82: Player forced into a Halloween kart
|
||||
TFCond_HalloweenKartDash, //83: Forced forward if in TFCond_HalloweenKart, zoom in effect, and dash animations
|
||||
TFCond_BalloonHead, //84: Big head and lowered gravity
|
||||
TFCond_MeleeOnly, //85: Forced melee, along with TFCond_SpeedBuffAlly and TFCond_HalloweenTiny
|
||||
TFCond_SwimmingCurse, //86: Swim in the air with Jarate overlay
|
||||
TFCond_HalloweenKartNoTurn, //87
|
||||
TFCond_FreezeInput = 87,
|
||||
TFCond_HalloweenKartCage,
|
||||
TFCond_HasRune,
|
||||
TFCond_RuneStrength,
|
||||
TFCond_RuneHaste,
|
||||
TFCond_RuneRegen,
|
||||
TFCond_RuneResist,
|
||||
TFCond_RuneVampire,
|
||||
TFCond_RuneWarlock,
|
||||
TFCond_RunePrecision, // 96
|
||||
TFCond_RuneAgility,
|
||||
TFCond_GrapplingHook,
|
||||
TFCond_GrapplingHookSafeFall,
|
||||
TFCond_GrapplingHookLatched,
|
||||
TFCond_GrapplingHookBleeding,
|
||||
TFCond_AfterburnImmune,
|
||||
TFCond_RuneKnockout,
|
||||
TFCond_RuneImbalance,
|
||||
TFCond_CritRuneTemp,
|
||||
TFCond_PasstimeInterception,
|
||||
TFCond_SwimmingNoEffects,
|
||||
TFCond_EyeaductUnderworld,
|
||||
TFCond_KingRune,
|
||||
TFCond_PlagueRune,
|
||||
TFCond_SupernovaRune,
|
||||
TFCond_Plague,
|
||||
TFCond_KingAura,
|
||||
TFCond_SpawnOutline, //114
|
||||
TFCond_KnockedIntoAir,
|
||||
TFCond_CompetitiveWinner,
|
||||
TFCond_CompetitiveLoser,
|
||||
TFCond_NoTaunting,
|
||||
TFCond_FreezeInput = 87, //87: Prevents player from using controls
|
||||
TFCond_HalloweenKartCage, //88: Puts a cage around the player if in TFCond_HalloweenKart, otherwise crashes
|
||||
TFCond_HasRune, //89: Has a powerup
|
||||
TFCond_RuneStrength, //90: Double damage and no damage falloff
|
||||
TFCond_RuneHaste, //91: Double fire rate, reload speed, clip and ammo size, and 30% faster movement speed
|
||||
TFCond_RuneRegen, //92: Regen ammo, health, and metal
|
||||
TFCond_RuneResist, //93: Takes 1/2 damage and critical immunity
|
||||
TFCond_RuneVampire, //94: Takes 3/4 damage, gain health on damage, and 40% increase in max health
|
||||
TFCond_RuneWarlock, //95: Attacker takes damage and knockback on hitting the player and 50% increase in max health
|
||||
TFCond_RunePrecision, //96: Less bullet spread, no damage falloff, 250% faster projectiles, and double damage, faster charge, and faster re-zoom for Sniper Rifles
|
||||
TFCond_RuneAgility, //97: Increased movement speed, grappling hook speed, jump height, and instant weapon switch
|
||||
TFCond_GrapplingHook, //98: Used when a player fires their grappling hook, no effect applying or removing
|
||||
TFCond_GrapplingHookSafeFall, //99: Used when a player is pulled by their grappling hook, no effect applying or removing
|
||||
TFCond_GrapplingHookLatched, //100: Used when a player latches onto a wall, no effect applying or removing
|
||||
TFCond_GrapplingHookBleeding, //101: Used when a player is hit by attacker's grappling hook
|
||||
TFCond_AfterburnImmune, //102: Deadringer afterburn immunity
|
||||
TFCond_RuneKnockout, //103: Melee and grappling hook only, increased max health, knockback immunity, x4 more damage against buildings, and knockbacks a powerup off a victim on hit
|
||||
TFCond_RuneImbalance, //104: Prevents gaining a crit-boost or Uber powerups
|
||||
TFCond_CritRuneTemp, //105: Crit-boost effect
|
||||
TFCond_PasstimeInterception, //106: Used when a player intercepts the Jack/Ball
|
||||
TFCond_SwimmingNoEffects, //107: Swimming in the air without animations or overlay
|
||||
TFCond_EyeaductUnderworld, //108: Refills max health, short Uber, escaped the underworld message on removal
|
||||
TFCond_KingRune, //109: Increased max health and applies TFCond_KingAura
|
||||
TFCond_PlagueRune, //110: Radius health kit stealing, increased max health, TFCond_Plague on touching a victim
|
||||
TFCond_SupernovaRune, //111: Charge meter passively increasing, when charged activiated causes radius Bonk stun
|
||||
TFCond_Plague, //112: Plague sound effect and message, blocks King powerup health regen
|
||||
TFCond_KingAura, //113: Increased fire rate, reload speed, and health regen to players in a radius
|
||||
TFCond_SpawnOutline, //114: Outline and health meter of teammates (and disguised spies)
|
||||
TFCond_KnockedIntoAir, //115: Used when a player is airblasted
|
||||
TFCond_CompetitiveWinner, //116: Unknown
|
||||
TFCond_CompetitiveLoser, //117: Unknown
|
||||
TFCond_NoTaunting_DEPRECATED, //118
|
||||
TFCond_HealingDebuff = 118, //118: Healing debuff from Medics and dispensers
|
||||
TFCond_PasstimePenaltyDebuff, //119: Marked-for-death effect
|
||||
TFCond_GrappledToPlayer, //120: Prevents taunting and some Grappling Hook actions
|
||||
TFCond_GrappledByPlayer, //121: Unknown
|
||||
TFCond_ParachuteDeployed, //122: Parachute deployed, prevents reopening it
|
||||
TFCond_Gas, //123: Gas Passer effect
|
||||
TFCond_BurningPyro, //124: Dragon's Fury afterburn on Pyros
|
||||
TFCond_RocketPack, //125: Thermal Thruster launched effects, prevents reusing
|
||||
TFCond_LostFooting, //126: Less ground friction
|
||||
TFCond_AirCurrent //127: Reduced air control and friction
|
||||
};
|
||||
|
||||
const float TFCondDuration_Infinite = -1.0;
|
||||
@ -234,13 +245,16 @@ enum TFObjectMode
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets a client on fire for 10 seconds.
|
||||
* Sets a client on fire.
|
||||
*
|
||||
* @note Fire duration is capped to 10 seconds.
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param attacker Attacker's index.
|
||||
* @param duration Duration of fire (in seconds).
|
||||
* @error Invalid client index, client not in game, or no mod support.
|
||||
*/
|
||||
native void TF2_IgnitePlayer(int client, int attacker);
|
||||
native void TF2_IgnitePlayer(int client, int attacker, float duration=10.0);
|
||||
|
||||
/**
|
||||
* Respawns a client
|
||||
@ -334,6 +348,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();
|
||||
|
27
env/include/tf2_stocks.inc
vendored
27
env/include/tf2_stocks.inc
vendored
@ -79,6 +79,8 @@
|
||||
#define TF_DEATHFLAG_INTERRUPTED (1 << 6)
|
||||
#define TF_DEATHFLAG_GIBBED (1 << 7)
|
||||
#define TF_DEATHFLAG_PURGATORY (1 << 8)
|
||||
#define TF_DEATHFLAG_MINIBOSS (1 << 9)
|
||||
#define TF_DEATHFLAG_AUSTRALIUM (1 << 10)
|
||||
|
||||
// Custom kill identifiers for the customkill property on the player_death event
|
||||
enum {
|
||||
@ -159,6 +161,12 @@ enum {
|
||||
TF_CUSTOM_KART,
|
||||
TF_CUSTOM_GIANT_HAMMER,
|
||||
TF_CUSTOM_RUNE_REFLECT,
|
||||
TF_CUSTOM_DRAGONS_FURY_IGNITE,
|
||||
TF_CUSTOM_DRAGONS_FURY_BONUS_BURNING,
|
||||
TF_CUSTOM_SLAP_KILL,
|
||||
TF_CUSTOM_CROC,
|
||||
TF_CUSTOM_TAUNTATK_GASBLAST,
|
||||
TF_CUSTOM_AXTINGUISHER_BOOSTED
|
||||
};
|
||||
|
||||
// Weapon codes as used in some events, such as player_death
|
||||
@ -268,6 +276,12 @@ enum {
|
||||
TF_WEAPON_GRAPPLINGHOOK,
|
||||
TF_WEAPON_PASSTIME_GUN,
|
||||
TF_WEAPON_CHARGED_SMG,
|
||||
TF_WEAPON_BREAKABLE_SIGN,
|
||||
TF_WEAPON_ROCKETPACK,
|
||||
TF_WEAPON_SLAP,
|
||||
TF_WEAPON_JAR_GAS,
|
||||
TF_WEAPON_GRENADE_JAR_GAS,
|
||||
TF_WEAPON_FLAME_BALL
|
||||
};
|
||||
|
||||
// TF2 Weapon Loadout Slots
|
||||
@ -400,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)
|
||||
@ -436,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)
|
||||
@ -513,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)
|
||||
@ -570,9 +587,19 @@ stock bool TF2_IsPlayerInCondition(int client, TFCond cond)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
int bit = (1 << (iCond - 128));
|
||||
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx4") & bit) == bit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
ThrowError("Invalid TFCond value %d", iCond);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
18
env/include/topmenus.inc
vendored
18
env/include/topmenus.inc
vendored
@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
@ -430,5 +430,17 @@ public void __ext_topmenus_SetNTVOptional()
|
||||
MarkNativeAsOptional("DisplayTopMenuCategory");
|
||||
MarkNativeAsOptional("FindTopMenuCategory");
|
||||
MarkNativeAsOptional("SetTopMenuTitleCaching");
|
||||
MarkNativeAsOptional("TopMenu.TopMenu");
|
||||
MarkNativeAsOptional("TopMenu.FromHandle");
|
||||
MarkNativeAsOptional("TopMenu.LoadConfig");
|
||||
MarkNativeAsOptional("TopMenu.AddCategory");
|
||||
MarkNativeAsOptional("TopMenu.AddItem");
|
||||
MarkNativeAsOptional("TopMenu.GetInfoString");
|
||||
MarkNativeAsOptional("TopMenu.GetObjName");
|
||||
MarkNativeAsOptional("TopMenu.Remove");
|
||||
MarkNativeAsOptional("TopMenu.Display");
|
||||
MarkNativeAsOptional("TopMenu.DisplayCategory");
|
||||
MarkNativeAsOptional("TopMenu.FindCategory");
|
||||
MarkNativeAsOptional("TopMenu.CacheTitles.set");
|
||||
}
|
||||
#endif
|
||||
|
31
env/include/usermessages.inc
vendored
31
env/include/usermessages.inc
vendored
@ -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,15 +84,21 @@ stock Protobuf UserMessageToProtobuf(Handle msg)
|
||||
stock BfWrite UserMessageToBfWrite(Handle msg)
|
||||
{
|
||||
if (GetUserMessageType() == UM_Protobuf)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return view_as<BfWrite>(msg);
|
||||
}
|
||||
|
||||
// Make sure to only call this on readable buffers (eg from a message hook).
|
||||
stock BfWrite UserMessageToBfRead(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.
|
||||
*
|
||||
@ -125,10 +135,11 @@ native bool GetUserMessageName(UserMsg msg_id, char[] msg, int maxlength);
|
||||
* @error Invalid message name, unable to start a message, invalid client,
|
||||
* or client not connected.
|
||||
*/
|
||||
native Handle StartMessage(char[] msgname, int[] clients, int numClients, int flags=0);
|
||||
native Handle StartMessage(const char[] msgname, const int[] clients, int numClients, int flags=0);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -141,7 +152,7 @@ native Handle StartMessage(char[] msgname, int[] clients, int numClients, int fl
|
||||
* @error Invalid message name, unable to start a message, invalid client,
|
||||
* or client not connected.
|
||||
*/
|
||||
native Handle StartMessageEx(UserMsg msg, int[] clients, int numClients, int flags=0);
|
||||
native Handle StartMessageEx(UserMsg msg, const int[] clients, int numClients, int flags=0);
|
||||
|
||||
/**
|
||||
* Ends a previously started user message (network message).
|
||||
@ -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.
|
||||
@ -223,22 +235,24 @@ native void UnhookUserMessage(UserMsg msg_id, MsgHook hook, bool intercept=false
|
||||
* @return A handle to a bf_write bit packing structure, or
|
||||
* INVALID_HANDLE on failure.
|
||||
*/
|
||||
stock Handle StartMessageAll(char[] msgname, int flags=0)
|
||||
stock Handle StartMessageAll(const char[] msgname, int flags=0)
|
||||
{
|
||||
int total = 0;
|
||||
int[] clients = new int[MaxClients];
|
||||
for (int i=1; i<=MaxClients; i++)
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientConnected(i))
|
||||
{
|
||||
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.
|
||||
@ -247,10 +261,9 @@ stock Handle StartMessageAll(char[] msgname, int flags=0)
|
||||
* @return A handle to a bf_write bit packing structure, or
|
||||
* INVALID_HANDLE on failure.
|
||||
*/
|
||||
stock Handle StartMessageOne(char[] msgname, int client, 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);
|
||||
|
14
env/include/version.inc
vendored
14
env/include/version.inc
vendored
@ -38,12 +38,12 @@
|
||||
#tryinclude <version_auto>
|
||||
|
||||
#if !defined _auto_version_included
|
||||
#define SOURCEMOD_V_TAG "manual"
|
||||
#define SOURCEMOD_V_REV 0
|
||||
#define SOURCEMOD_V_CSET "0"
|
||||
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
|
||||
#define SOURCEMOD_V_MINOR 8 /**< SourceMod Minor version */
|
||||
#define SOURCEMOD_V_RELEASE 0 /**< SourceMod Release version */
|
||||
#define SOURCEMOD_V_TAG "manual"
|
||||
#define SOURCEMOD_V_REV 0
|
||||
#define SOURCEMOD_V_CSET "0"
|
||||
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
|
||||
#define SOURCEMOD_V_MINOR 10 /**< SourceMod Minor version */
|
||||
#define SOURCEMOD_V_RELEASE 0 /**< SourceMod Release version */
|
||||
|
||||
#define SOURCEMOD_VERSION "1.8.0-manual" /**< SourceMod version string (major.minor.release-tag) */
|
||||
#define SOURCEMOD_VERSION "1.10.0-manual" /**< SourceMod version string (major.minor.release-tag) */
|
||||
#endif
|
||||
|
8
env/include/version_auto.inc
vendored
8
env/include/version_auto.inc
vendored
@ -5,11 +5,11 @@
|
||||
#define _auto_version_included
|
||||
|
||||
#define SOURCEMOD_V_TAG ""
|
||||
#define SOURCEMOD_V_CSET "19b0d34"
|
||||
#define SOURCEMOD_V_CSET "72a4b127"
|
||||
#define SOURCEMOD_V_MAJOR 1
|
||||
#define SOURCEMOD_V_MINOR 9
|
||||
#define SOURCEMOD_V_MINOR 10
|
||||
#define SOURCEMOD_V_RELEASE 0
|
||||
#define SOURCEMOD_V_REV 5970
|
||||
#define SOURCEMOD_V_REV 6457
|
||||
|
||||
#define SOURCEMOD_VERSION "1.9.0.5970"
|
||||
#define SOURCEMOD_VERSION "1.10.0.6457"
|
||||
|
BIN
env/linux/bin/spcomp
vendored
BIN
env/linux/bin/spcomp
vendored
Binary file not shown.
BIN
env/win32/bin/spcomp.exe
vendored
BIN
env/win32/bin/spcomp.exe
vendored
Binary file not shown.
Reference in New Issue
Block a user