Updated includes and spcomp to SourceMod 1.9

This commit is contained in:
BotoX 2016-08-23 15:34:00 +02:00
parent 0c0ce1adfc
commit 584ab0c27a
80 changed files with 2851 additions and 2474 deletions

View File

@ -5,8 +5,8 @@ SOURCEDIR=src
SMINCLUDES=env/include
ZRINCLUDES=src/include
BUILDDIR=build
SPCOMP_LINUX=env/linux/bin/spcomp-1.7.0
SPCOMP_DARWIN=env/darwin/bin/spcomp-1.7.0
SPCOMP_LINUX=env/linux/bin/spcomp
SPCOMP_DARWIN=env/darwin/bin/spcomp
DOS2UNIX_LINUX=dos2unix
DOS2UNIX_DARWIN=env/darwin/bin/dos2unix -p
VERSIONDUMP=./updateversion.sh

View File

@ -3,7 +3,7 @@
set SOURCEDIR=src
set SMINCLUDES=env\include
set BUILDDIR=build
set SPCOMP=env\win32\bin\spcomp-1.7.0.exe
set SPCOMP=env\win32\bin\spcomp.exe
set VERSIONDUMP=updateversion.bat
:: Dump version and revision information first.

BIN
env/darwin/bin/spcomp vendored Executable file

Binary file not shown.

24
env/include/DynamicTargeting.inc vendored Normal file
View File

@ -0,0 +1,24 @@
#if defined _DynamicTargeting_Included
#endinput
#endif
#define _DynamicTargeting_Included
native int AmbiguousMenu(int client, char[] sCommand, char[] sArgString, char[] sPattern, int FilterFlags);
public SharedPlugin __pl_DynamicTargeting =
{
name = "DynamicTargeting",
file = "DynamicTargeting.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_PLUGIN
public __pl_DynamicTargeting_SetNTVOptional()
{
MarkNativeAsOptional("AmbiguousMenu");
}
#endif

266
env/include/admin.inc vendored
View File

@ -168,21 +168,174 @@ enum AdminCachePart
AdminCache_Admins = 2, /**< All admins */
};
methodmap AdminId {
// Retrieves an admin's user name as made with CreateAdmin().
//
// @note This function can return UTF-8 strings, and will safely chop UTF-8 strings.
//
// @param name String buffer to store name.
// @param maxlength Maximum size of string buffer.
// @return Number of bytes written.
public native void GetUsername(char[] name, int maxlength);
// Binds an admin to an identity for fast lookup later on. The bind must be unique.
//
// @param authMethod Auth method to use, predefined or from RegisterAuthIdentType().
// @param ident String containing the arbitrary, unique identity.
// @return True on success, false if the auth method was not found,
// ident was already taken, or ident invalid for auth method.
public native bool BindIdentity(const char[] authMethod, const char[] ident);
// Sets whether or not a flag is enabled on an admin.
//
// @param flag Admin flag to use.
// @param enabled True to enable, false to disable.
public native void SetFlag(AdminFlag flag, bool enabled);
// Returns whether or not a flag is enabled on an admin.
//
// @param flag Admin flag to use.
// @param mode Access mode to check.
// @return True if enabled, false otherwise.
public native bool HasFlag(AdminFlag flag, AdmAccessMode mode=Access_Effective);
// Returns the bitstring of access flags on an admin.
//
// @param mode Access mode to use.
// @return A bitstring containing which flags are enabled.
public native int GetFlags(AdmAccessMode mode);
// Adds a group to an admin's inherited group list. Any flags the group has
// will be added to the admin's effective flags.
//
// @param gid GroupId index of the group.
// @return True on success, false on invalid input or duplicate membership.
public native bool InheritGroup(GroupId gid);
// Returns group information from an admin.
//
// @param index Group number to retrieve, from 0 to N-1, where N
// is the value of the GroupCount property.
// @param name Buffer to store the group's name.
// Note: This will safely chop UTF-8 strings.
// @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);
// Sets a password on an admin.
//
// @param password String containing the password.
public native void SetPassword(const char[] password);
// Gets an admin's password.
//
// @param buffer Optional buffer to store the admin's password.
// @param maxlength Maximum size of the output name buffer.
// Note: This will safely chop UTF-8 strings.
// @return True if there was a password set, false otherwise.
public native bool GetPassword(char[] buffer="", int maxlength=0);
// Tests whether one admin can target another.
//
// The heuristics for this check are as follows:
// 0. If the targeting AdminId is INVALID_ADMIN_ID, targeting fails.
// 1. If the targeted AdminId is INVALID_ADMIN_ID, targeting succeeds.
// 2. If the targeted AdminId is the same as the targeting AdminId,
// (self) targeting succeeds.
// 3. If the targeting admin is root, targeting succeeds.
// 4. If the targeted admin has access higher (as interpreted by
// (sm_immunity_mode) than the targeting admin, then targeting fails.
// 5. If the targeted admin has specific immunity from the
// targeting admin via group immunities, targeting fails.
// 6. Targeting succeeds.
//
// @param target Target admin (may be INVALID_ADMIN_ID).
// @return True if targetable, false if immune.
public native bool CanTarget(AdminId other);
// The number of groups of which this admin is a member.
property int GroupCount {
public native get();
}
// Immunity level used for targetting.
property int ImmunityLevel {
public native get();
public native set(int level);
}
}
methodmap GroupId {
// Gets whether or not a flag is enabled on a group's flag set.
//
// @param flag Admin flag to retrieve.
// @return True if enabled, false otherwise,
public native bool HasFlag(AdminFlag flag);
// Adds or removes a flag from a group's flag set.
//
// @param flag Admin flag to toggle.
// @param enabled True to set the flag, false to unset/disable.
public native void SetFlag(AdminFlag flag, bool enabled);
// Returns the flag set that is added to users from this group.
//
// @return Bitstring containing the flags enabled.
public native int GetFlags();
// Returns a group that this group is immune to given an index.
//
// @param number Index from 0 to N-1, from GroupImmunitiesCount.
// @return GroupId that this group is immune to, or INVALID_GROUP_ID on failure.
public native GroupId GetGroupImmunity(int index);
// Adds immunity to a specific group.
//
// @param other Group id to receive immunity to.
public native void AddGroupImmunity(GroupId other);
// Retrieves a group-specific command override.
//
// @param name String containing command name (case sensitive).
// @param type Override type (specific command or group).
// @param rule Optional pointer to store allow/deny setting.
// @return True if an override exists, false otherwise.
public native bool GetCommandOverride(const char[] name, OverrideType type, OverrideRule &rule);
// Adds a group-specific override type.
//
// @param name String containing command name (case sensitive).
// @param type Override type (specific command or group).
// @param rule Override allow/deny setting.
public native void AddCommandOverride(const char[] name, OverrideType type, OverrideRule rule);
// Number of specific group immunities
property int GroupImmunitiesCount {
public native get();
}
// Immunity level used for targetting.
property int ImmunityLevel {
public native get();
public native set(int level);
}
}
/**
* Called when part of the cache needs to be rebuilt.
*
* @param part Part of the admin cache to rebuild.
*/
forward OnRebuildAdminCache(AdminCachePart:part);
forward void OnRebuildAdminCache(AdminCachePart part);
/**
* Tells the admin system to dump a portion of the cache.
*
* @param part Part of the cache to dump. Specifying groups also dumps admins.
* @param rebuild If true, the rebuild forwards will fire.
* @noreturn
*/
native DumpAdminCache(AdminCachePart:part, bool:rebuild);
native void DumpAdminCache(AdminCachePart part, bool rebuild);
/**
* Adds a global command flag override. Any command registered with this name
@ -191,9 +344,8 @@ native DumpAdminCache(AdminCachePart:part, bool:rebuild);
* @param cmd String containing command name (case sensitive).
* @param type Override type (specific command or group).
* @param flags New admin flag.
* @noreturn
*/
native AddCommandOverride(const String:cmd[], OverrideType:type, flags);
native void AddCommandOverride(const char[] cmd, OverrideType type, int flags);
/**
* Returns a command override.
@ -203,16 +355,15 @@ native AddCommandOverride(const String:cmd[], OverrideType:type, flags);
* @param flags By-reference cell to store the flag (undefined if not found).
* @return True if there is an override, false otherwise.
*/
native bool:GetCommandOverride(const String:cmd[], OverrideType:type, &flags);
native bool GetCommandOverride(const char[] cmd, OverrideType type, int &flags);
/**
* Unsets a command override.
*
* @param cmd String containing command name (case sensitive).
* @param type Override type (specific command or group).
* @noreturn
*/
native UnsetCommandOverride(const String:cmd[], OverrideType:type);
native void UnsetCommandOverride(const char[] cmd, OverrideType type);
/**
* Adds a new group. Name must be unique.
@ -220,7 +371,7 @@ native UnsetCommandOverride(const String:cmd[], OverrideType:type);
* @param group_name String containing the group name.
* @return A new group id, INVALID_GROUP_ID if it already exists.
*/
native GroupId:CreateAdmGroup(const String:group_name[]);
native GroupId CreateAdmGroup(const char[] group_name);
/**
* Finds a group by name.
@ -228,7 +379,7 @@ native GroupId:CreateAdmGroup(const String:group_name[]);
* @param group_name String containing the group name.
* @return A group id, or INVALID_GROUP_ID if not found.
*/
native GroupId:FindAdmGroup(const String:group_name[]);
native GroupId FindAdmGroup(const char[] group_name);
/**
* Adds or removes a flag from a group's flag set.
@ -237,9 +388,8 @@ native GroupId:FindAdmGroup(const String:group_name[]);
* @param id Group id.
* @param flag Admin flag to toggle.
* @param enabled True to set the flag, false to unset/disable.
* @noreturn
*/
native SetAdmGroupAddFlag(GroupId:id, AdminFlag:flag, bool:enabled);
native void SetAdmGroupAddFlag(GroupId id, AdminFlag flag, bool enabled);
/**
* Gets the set value of an add flag on a group's flag set.
@ -249,7 +399,7 @@ native SetAdmGroupAddFlag(GroupId:id, AdminFlag:flag, bool:enabled);
* @param flag Admin flag to retrieve.
* @return True if enabled, false otherwise,
*/
native bool:GetAdmGroupAddFlag(GroupId:id, AdminFlag:flag);
native bool GetAdmGroupAddFlag(GroupId id, AdminFlag flag);
/**
* Returns the flag set that is added to a user from their group.
@ -258,28 +408,27 @@ native bool:GetAdmGroupAddFlag(GroupId:id, AdminFlag:flag);
* @param id GroupId of the group.
* @return Bitstring containing the flags enabled.
*/
native GetAdmGroupAddFlags(GroupId:id);
native int GetAdmGroupAddFlags(GroupId id);
/**
* @deprecated Functionality removed.
*/
#pragma deprecated Use SetAdmGroupImmunityLevel() instead.
native SetAdmGroupImmunity(GroupId:id, ImmunityType:type, bool:enabled);
native void SetAdmGroupImmunity(GroupId id, ImmunityType type, bool enabled);
/**
* @deprecated Functionality removed.
*/
#pragma deprecated Use GetAdmGroupImmunityLevel() instead.
native bool:GetAdmGroupImmunity(GroupId:id, ImmunityType:type);
native bool GetAdmGroupImmunity(GroupId id, ImmunityType type);
/**
* Adds immunity to a specific group.
*
* @param id Group id.
* @param other_id Group id to receive immunity to.
* @noreturn
*/
native SetAdmGroupImmuneFrom(GroupId:id, GroupId:other_id);
native void SetAdmGroupImmuneFrom(GroupId id, GroupId other_id);
/**
* Returns the number of specific group immunities.
@ -287,7 +436,7 @@ native SetAdmGroupImmuneFrom(GroupId:id, GroupId:other_id);
* @param id Group id.
* @return Number of group immunities.
*/
native GetAdmGroupImmuneCount(GroupId:id);
native int GetAdmGroupImmuneCount(GroupId id);
/**
* Returns a group that this group is immune to given an index.
@ -296,7 +445,7 @@ native GetAdmGroupImmuneCount(GroupId:id);
* @param number Index from 0 to N-1, from GetAdmGroupImmuneCount().
* @return GroupId that this group is immune to, or INVALID_GROUP_ID on failure.
*/
native GroupId:GetAdmGroupImmuneFrom(GroupId:id, number);
native GroupId GetAdmGroupImmuneFrom(GroupId id, int number);
/**
* Adds a group-specific override type.
@ -305,9 +454,8 @@ native GroupId:GetAdmGroupImmuneFrom(GroupId:id, number);
* @param name String containing command name (case sensitive).
* @param type Override type (specific command or group).
* @param rule Override allow/deny setting.
* @noreturn
*/
native AddAdmGroupCmdOverride(GroupId:id, const String:name[], OverrideType:type, OverrideRule:rule);
native void AddAdmGroupCmdOverride(GroupId id, const char[] name, OverrideType type, OverrideRule rule);
/**
* Retrieves a group-specific command override.
@ -318,16 +466,15 @@ native AddAdmGroupCmdOverride(GroupId:id, const String:name[], OverrideType:type
* @param rule Optional pointer to store allow/deny setting.
* @return True if an override exists, false otherwise.
*/
native bool:GetAdmGroupCmdOverride(GroupId:id, const String:name[], OverrideType:type, &OverrideRule:rule);
native bool GetAdmGroupCmdOverride(GroupId id, const char[] name, OverrideType type, OverrideRule &rule);
/**
* Registers an authentication identity type. You normally never need to call this except for
* very specific systems.
*
* @param name Codename to use for your authentication type.
* @noreturn
*/
native RegisterAuthIdentType(const String:name[]);
native void RegisterAuthIdentType(const char[] name);
/**
* Creates a new admin entry in the permissions cache.
@ -335,7 +482,7 @@ native RegisterAuthIdentType(const String:name[]);
* @param name Name for this entry (does not have to be unique).
* Specify an empty string for an anonymous admin.
*/
native AdminId:CreateAdmin(const String:name[]="");
native AdminId CreateAdmin(const char[] name="");
/**
* Retrieves an admin's user name as made with CreateAdmin().
@ -347,7 +494,7 @@ native AdminId:CreateAdmin(const String:name[]="");
* @param maxlength Maximum size of string buffer.
* @return Number of bytes written.
*/
native GetAdminUsername(AdminId:id, String:name[], maxlength);
native int GetAdminUsername(AdminId id, char[] name, int maxlength);
/**
* Binds an admin to an identity for fast lookup later on. The bind must be unique.
@ -358,7 +505,7 @@ native GetAdminUsername(AdminId:id, String:name[], maxlength);
* @return True on success, false if the auth method was not found,
* ident was already taken, or ident invalid for auth method.
*/
native bool:BindAdminIdentity(AdminId:id, const String:auth[], const String:ident[]);
native bool BindAdminIdentity(AdminId id, const char[] auth, const char[] ident);
/**
* Sets whether or not a flag is enabled on an admin.
@ -366,9 +513,8 @@ native bool:BindAdminIdentity(AdminId:id, const String:auth[], const String:iden
* @param id AdminId index of the admin.
* @param flag Admin flag to use.
* @param enabled True to enable, false to disable.
* @noreturn
*/
native SetAdminFlag(AdminId:id, AdminFlag:flag, bool:enabled);
native void SetAdminFlag(AdminId id, AdminFlag flag, bool enabled);
/**
* Returns whether or not a flag is enabled on an admin.
@ -378,7 +524,7 @@ native SetAdminFlag(AdminId:id, AdminFlag:flag, bool:enabled);
* @param mode Access mode to check.
* @return True if enabled, false otherwise.
*/
native bool:GetAdminFlag(AdminId:id, AdminFlag:flag, AdmAccessMode:mode=Access_Effective);
native bool GetAdminFlag(AdminId id, AdminFlag flag, AdmAccessMode mode=Access_Effective);
/**
* Returns the bitstring of access flags on an admin.
@ -387,7 +533,7 @@ native bool:GetAdminFlag(AdminId:id, AdminFlag:flag, AdmAccessMode:mode=Access_E
* @param mode Access mode to use.
* @return A bitstring containing which flags are enabled.
*/
native GetAdminFlags(AdminId:id, AdmAccessMode:mode);
native int GetAdminFlags(AdminId id, AdmAccessMode mode);
/**
* Adds a group to an admin's inherited group list. Any flags the group has
@ -397,7 +543,7 @@ native GetAdminFlags(AdminId:id, AdmAccessMode:mode);
* @param gid GroupId index of the group.
* @return True on success, false on invalid input or duplicate membership.
*/
native bool:AdminInheritGroup(AdminId:id, GroupId:gid);
native bool AdminInheritGroup(AdminId id, GroupId gid);
/**
* Returns the number of groups this admin is a member of.
@ -405,7 +551,7 @@ native bool:AdminInheritGroup(AdminId:id, GroupId:gid);
* @param id AdminId index of the admin.
* @return Number of groups this admin is a member of.
*/
native GetAdminGroupCount(AdminId:id);
native int GetAdminGroupCount(AdminId id);
/**
* Returns group information from an admin.
@ -418,17 +564,16 @@ native GetAdminGroupCount(AdminId:id);
* @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.
*/
native GroupId:GetAdminGroup(AdminId:id, index, const String:name[], maxlength);
*/
native GroupId GetAdminGroup(AdminId id, int index, const char[] name, int maxlength);
/**
* Sets a password on an admin.
*
* @param id AdminId index of the admin.
* @param password String containing the password.
* @noreturn
*/
native SetAdminPassword(AdminId:id, const String:password[]);
native void SetAdminPassword(AdminId id, const char[] password);
/**
* Gets an admin's password.
@ -439,7 +584,7 @@ native SetAdminPassword(AdminId:id, const String:password[]);
* Note: This will safely chop UTF-8 strings.
* @return True if there was a password set, false otherwise.
*/
native bool:GetAdminPassword(AdminId:id, String:buffer[]="", maxlength=0);
native bool GetAdminPassword(AdminId id, char[] buffer="", int maxlength=0);
/**
* Attempts to find an admin by an auth method and an identity.
@ -448,7 +593,7 @@ native bool:GetAdminPassword(AdminId:id, String:buffer[]="", maxlength=0);
* @param identity Identity string to look up.
* @return An AdminId index if found, INVALID_ADMIN_ID otherwise.
*/
native AdminId:FindAdminByIdentity(const String:auth[], const String:identity[]);
native AdminId FindAdminByIdentity(const char[] auth, const char[] identity);
/**
* Removes an admin entry from the cache.
@ -458,7 +603,7 @@ native AdminId:FindAdminByIdentity(const String:auth[], const String:identity[])
* @param id AdminId index to remove/invalidate.
* @return True on success, false otherwise.
*/
native bool:RemoveAdmin(AdminId:id);
native bool RemoveAdmin(AdminId id);
/**
* Converts a flag bit string to a bit array.
@ -468,7 +613,7 @@ native bool:RemoveAdmin(AdminId:id);
* @param maxSize Maximum number of flags the array can store.
* @return Number of flags written.
*/
native FlagBitsToBitArray(bits, bool:array[], maxSize);
native int FlagBitsToBitArray(int bits, bool[] array, int maxSize);
/**
* Converts a flag array to a bit string.
@ -477,7 +622,7 @@ native FlagBitsToBitArray(bits, bool:array[], maxSize);
* @param maxSize Maximum size of the flag array.
* @return A bit string composed of the array bits.
*/
native FlagBitArrayToBits(const bool:array[], maxSize);
native int FlagBitArrayToBits(const bool[] array, int maxSize);
/**
* Converts an array of flags to bits.
@ -486,7 +631,7 @@ native FlagBitArrayToBits(const bool:array[], maxSize);
* @param numFlags Number of flags in the array.
* @return A bit string composed of the array flags.
*/
native FlagArrayToBits(const AdminFlag:array[], numFlags);
native int FlagArrayToBits(const AdminFlag[] array, int numFlags);
/**
* Converts a bit string to an array of flags.
@ -496,7 +641,7 @@ native FlagArrayToBits(const AdminFlag:array[], numFlags);
* @param maxSize Maximum size of the flag array.
* @return Number of flags written.
*/
native FlagBitsToArray(bits, AdminFlag:array[], maxSize);
native int FlagBitsToArray(int bits, AdminFlag[] array, int maxSize);
/**
* Finds a flag by its string name.
@ -505,7 +650,7 @@ native FlagBitsToArray(bits, AdminFlag:array[], maxSize);
* @param flag Variable to store flag in.
* @return True on success, false if not found.
*/
native bool:FindFlagByName(const String:name[], &AdminFlag:flag);
native bool FindFlagByName(const char[] name, AdminFlag &flag);
/**
* Finds a flag by a given character.
@ -514,16 +659,16 @@ native bool:FindFlagByName(const String:name[], &AdminFlag:flag);
* @param flag Variable to store flag in.
* @return True on success, false if not found.
*/
native bool:FindFlagByChar(c, &AdminFlag:flag);
native bool FindFlagByChar(int c, AdminFlag &flag);
/**
* Finds a flag char by a gived admin flag.
* Finds the flag char for a given admin flag.
*
* @param flag Flag to look up.
* @param c Variable to store flag char.
* @return True on success, false if not found.
*/
native bool:FindFlagChar(AdminFlag:flag, &c);
native bool FindFlagChar(AdminFlag flag, int &c);
/**
* Converts a string of flag characters to a bit string.
@ -532,7 +677,7 @@ native bool:FindFlagChar(AdminFlag:flag, &c);
* @param numchars Optional variable to store the number of bytes read.
* @return Bit string of ADMFLAG values.
*/
native ReadFlagString(const String:flags[], &numchars=0);
native int ReadFlagString(const char[] flags, int &numchars=0);
/**
* Tests whether one admin can target another.
@ -553,7 +698,7 @@ native ReadFlagString(const String:flags[], &numchars=0);
* @param target Target admin (may be INVALID_ADMIN_ID).
* @return True if targetable, false if immune.
*/
native CanAdminTarget(AdminId:admin, AdminId:target);
native bool CanAdminTarget(AdminId admin, AdminId target);
/**
* Creates an admin auth method. This does not need to be called more than once
@ -562,7 +707,7 @@ native CanAdminTarget(AdminId:admin, AdminId:target);
* @param method Name of the authentication method.
* @return True on success, false on failure.
*/
native bool:CreateAuthMethod(const String:method[]);
native bool CreateAuthMethod(const char[] method);
/**
* Sets a group's immunity level.
@ -571,7 +716,7 @@ native bool:CreateAuthMethod(const String:method[]);
* @param level Immunity level value.
* @return Old immunity level value.
*/
native SetAdmGroupImmunityLevel(GroupId:gid, level);
native int SetAdmGroupImmunityLevel(GroupId gid, int level);
/**
* Gets a group's immunity level (defaults to 0).
@ -579,7 +724,7 @@ native SetAdmGroupImmunityLevel(GroupId:gid, level);
* @param gid Group Id.
* @return Immunity level value.
*/
native GetAdmGroupImmunityLevel(GroupId:gid);
native int GetAdmGroupImmunityLevel(GroupId gid);
/**
* Sets an admin's immunity level.
@ -588,7 +733,7 @@ native GetAdmGroupImmunityLevel(GroupId:gid);
* @param level Immunity level value.
* @return Old immunity level value.
*/
native SetAdminImmunityLevel(AdminId:id, level);
native int SetAdminImmunityLevel(AdminId id, int level);
/**
* Gets an admin's immunity level.
@ -596,7 +741,7 @@ native SetAdminImmunityLevel(AdminId:id, level);
* @param id Admin Id.
* @return Immunity level value.
*/
native GetAdminImmunityLevel(AdminId:id);
native int GetAdminImmunityLevel(AdminId id);
/**
* Converts a flag to its single bit.
@ -604,9 +749,9 @@ native GetAdminImmunityLevel(AdminId:id);
* @param flag Flag to convert.
* @return Bit representation of the flag.
*/
stock FlagToBit(AdminFlag:flag)
stock int FlagToBit(AdminFlag flag)
{
return (1<<_:flag);
return (1 << view_as<int>(flag));
}
/**
@ -616,9 +761,9 @@ stock FlagToBit(AdminFlag:flag)
* @param flag Stores the converted flag by reference.
* @return True on success, false otherwise.
*/
stock bool:BitToFlag(bit, &AdminFlag:flag)
stock bool BitToFlag(int bit, AdminFlag &flag)
{
new AdminFlag:array[1];
AdminFlag array[1];
if (FlagBitsToArray(bit, array, 1))
{
@ -628,4 +773,3 @@ stock bool:BitToFlag(bit, &AdminFlag:flag)
return false;
}

View File

@ -63,17 +63,15 @@
* the Handle or add categories.
*
* @param topmenu Handle to the admin menu's TopMenu.
* @noreturn
*/
forward OnAdminMenuCreated(Handle topmenu);
forward void OnAdminMenuCreated(Handle topmenu);
/**
* Called when the admin menu is ready to have items added.
*
* @param topmenu Handle to the admin menu's TopMenu.
* @noreturn
*/
forward OnAdminMenuReady(Handle topmenu);
forward void OnAdminMenuReady(Handle topmenu);
/**
* Retrieves the Handle to the admin top menu.
@ -95,10 +93,10 @@ native TopMenu GetAdminTopMenu();
* @param alive_only True to only select alive players.
* @return Number of clients added.
*/
native AddTargetsToMenu(Handle:menu,
source_client,
bool:in_game_only=true,
bool:alive_only=false);
native int AddTargetsToMenu(Handle menu,
int source_client,
bool in_game_only=true,
bool alive_only=false);
/**
* Adds targets to an admin menu.
@ -111,7 +109,7 @@ native AddTargetsToMenu(Handle:menu,
* @param flags COMMAND_FILTER flags from commandfilters.inc.
* @return Number of clients added.
*/
native AddTargetsToMenu2(Handle:menu, source_client, flags);
native int AddTargetsToMenu2(Handle menu, int source_client, int flags);
/**
* Re-displays the admin menu to a client after selecting an item.
@ -121,7 +119,7 @@ native AddTargetsToMenu2(Handle:menu, source_client, flags);
* @param client Client index.
* @return True on success, false on failure.
*/
stock bool:RedisplayAdminMenu(Handle:topmenu, client)
stock bool RedisplayAdminMenu(Handle topmenu, int client)
{
if (topmenu == INVALID_HANDLE)
{
@ -133,7 +131,7 @@ stock bool:RedisplayAdminMenu(Handle:topmenu, client)
/* DO NOT EDIT BELOW THIS LINE */
public SharedPlugin:__pl_adminmenu =
public SharedPlugin __pl_adminmenu =
{
name = "adminmenu",
file = "adminmenu.smx",
@ -145,7 +143,7 @@ public SharedPlugin:__pl_adminmenu =
};
#if !defined REQUIRE_PLUGIN
public __pl_adminmenu_SetNTVOptional()
public void __pl_adminmenu_SetNTVOptional()
{
MarkNativeAsOptional("GetAdminTopMenu");
MarkNativeAsOptional("AddTargetsToMenu");

View File

@ -42,7 +42,7 @@
* @param size Number of bytes.
* @return Minimum number of cells required to fit the byte count.
*/
stock ByteCountToCells(size)
stock int ByteCountToCells(int size)
{
if (!size)
return 1;
@ -62,7 +62,7 @@ methodmap ArrayList < Handle {
// hold. For example, 32 cells is equivalent to:
// new Array[X][32]
// @param startsize Initial size of the array. Note that data will
// NOT be auto-intialized.
// NOT be auto-initialized.
// @return New Handle to the array object.
public native ArrayList(int blocksize=1, int startsize=0);
@ -128,7 +128,7 @@ methodmap ArrayList < Handle {
// @param maxlength Maximum size of the buffer.
// @return Number of characters copied.
// @error Invalid index.
public native int GetString(int index, char[] buffer, maxlength);
public native int GetString(int index, char[] buffer, int maxlength);
// Retrieves an array of cells from an array.
//
@ -191,19 +191,21 @@ methodmap ArrayList < Handle {
// @error Invalid index.
public native void SwapAt(int index1, int index2);
// Returns the index for the first occurance of the provided string. If
// Returns the index for the first occurrence of the provided string. If
// the string cannot be located, -1 will be returned.
//
// @param item String to search for
// @return Array index, or -1 on failure
public native int FindString(const char[] item);
// Returns the index for the first occurance of the provided value. If the
// Returns the index for the first occurrence of the provided value. If the
// value cannot be located, -1 will be returned.
//
// @param item Value to search for
// @param block Optionally which block to search in
// @return Array index, or -1 on failure
public native int FindValue(any item);
// @error Invalid block index
public native int FindValue(any item, int block=0);
// Retrieve the size of the array.
property int Length {
@ -224,7 +226,7 @@ methodmap ArrayList < Handle {
* hold. For example, 32 cells is equivalent to:
* new Array[X][32]
* @param startsize Initial size of the array. Note that data will
* NOT be auto-intialized.
* NOT be auto-initialized.
* @return New Handle to the array object.
*/
native ArrayList CreateArray(int blocksize=1, int startsize=0);
@ -254,10 +256,9 @@ native Handle CloneArray(Handle array);
*
* @param array Array Handle.
* @param newsize New size.
* @noreturn
* @error Invalid Handle or out of memory.
*/
native bool ResizeArray(Handle array, int newsize);
native void ResizeArray(Handle array, int newsize);
/**
* Returns the array size.
@ -330,7 +331,7 @@ native any GetArrayCell(Handle array, int index, int block=0, bool asChar=false)
* @return Number of characters copied.
* @error Invalid Handle or invalid index.
*/
native int GetArrayString(Handle array, int index, char[] buffer, maxlength);
native int GetArrayString(Handle array, int index, char[] buffer, int maxlength);
/**
* Retrieves an array of cells from an array.
@ -415,7 +416,7 @@ native void RemoveFromArray(Handle array, int index);
native void SwapArrayItems(Handle array, int index1, int index2);
/**
* Returns the index for the first occurance of the provided string. If the string
* Returns the index for the first occurrence of the provided string. If the string
* cannot be located, -1 will be returned.
*
* @param array Array Handle.
@ -426,12 +427,13 @@ native void SwapArrayItems(Handle array, int index1, int index2);
native int FindStringInArray(Handle array, const char[] item);
/**
* Returns the index for the first occurance of the provided value. If the value
* Returns the index for the first occurrence of the provided value. If the value
* cannot be located, -1 will be returned.
*
* @param array Array Handle.
* @param item Value to search for
* @param block Optionally which block to search in
* @return Array index, or -1 on failure
* @error Invalid Handle
* @error Invalid Handle or invalid block
*/
native int FindValueInArray(Handle array, any item);
native int FindValueInArray(Handle array, any item, int block=0);

View File

@ -221,6 +221,6 @@ native bool IsStackEmpty(Handle stack);
*/
stock bool PopStack(Handle stack)
{
new value;
int value;
return PopStackCell(stack, value);
}

View File

@ -166,7 +166,7 @@ methodmap StringMapSnapshot < Handle
*
* @return New Map Handle, which must be freed via CloseHandle().
*/
native StringMap:CreateTrie();
native StringMap CreateTrie();
/**
* Sets a value in a hash map, either inserting a new entry or replacing an old one.
@ -253,7 +253,7 @@ native bool GetTrieString(Handle map, const char[] key, char[] value, int max_si
* @return True on success, false if the value was never set.
* @error Invalid Handle.
*/
native RemoveFromTrie(Handle map, const char[] key);
native bool RemoveFromTrie(Handle map, const char[] key);
/**
* Clears all entries from a Map.
@ -261,7 +261,7 @@ native RemoveFromTrie(Handle map, const char[] key);
* @param map Map Handle.
* @error Invalid Handle.
*/
native ClearTrie(Handle map);
native void ClearTrie(Handle map);
/**
* Retrieves the number of elements in a map.
@ -270,7 +270,7 @@ native ClearTrie(Handle map);
* @return Number of elements in the trie.
* @error Invalid Handle.
*/
native GetTrieSize(Handle map);
native int GetTrieSize(Handle map);
/**
* Creates a snapshot of all keys in the map. If the map is changed after this
@ -291,7 +291,7 @@ native Handle CreateTrieSnapshot(Handle map);
* @return Number of keys.
* @error Invalid Handle.
*/
native TrieSnapshotLength(Handle snapshot);
native int TrieSnapshotLength(Handle snapshot);
/**
* Returns the buffer size required to store a given key. That is, it returns
@ -302,7 +302,7 @@ native TrieSnapshotLength(Handle snapshot);
* @return Buffer size required to store the key string.
* @error Invalid Handle or index out of range.
*/
native TrieSnapshotKeyBufferSize(Handle snapshot, int index);
native int TrieSnapshotKeyBufferSize(Handle snapshot, int index);
/**
* Retrieves the key string of a given key in a map snapshot.
@ -314,4 +314,4 @@ native TrieSnapshotKeyBufferSize(Handle snapshot, int index);
* @return Number of bytes written to the buffer.
* @error Invalid Handle or index out of range.
*/
native GetTrieSnapshotKey(Handle snapshot, int index, char[] buffer, int maxlength);
native int GetTrieSnapshotKey(Handle snapshot, int index, char[] buffer, int maxlength);

View File

@ -54,13 +54,13 @@
* @return Plugin_Handled to block the actual server banning.
* Kicking will still occur.
*/
forward Action:OnBanClient(client,
time,
flags,
const String:reason[],
const String:kick_message[],
const String:command[],
any:source);
forward Action OnBanClient(int client,
int time,
int flags,
const char[] reason,
const char[] kick_message,
const char[] command,
any source);
/**
* Called for calls to BanIdentity() with a non-empty command.
@ -73,12 +73,12 @@ forward Action:OnBanClient(client,
* @param source Source value passed via BanIdentity().
* @return Plugin_Handled to block the actual server banning.
*/
forward Action:OnBanIdentity(const String:identity[],
time,
flags,
const String:reason[],
const String:command[],
any:source);
forward Action OnBanIdentity(const char[] identity,
int time,
int flags,
const char[] reason,
const char[] command,
any source);
/**
* Called for calls to RemoveBan() with a non-empty command.
@ -89,10 +89,10 @@ forward Action:OnBanIdentity(const String:identity[],
* @param source Source value passed via BanIdentity().
* @return Plugin_Handled to block the actual server banning.
*/
forward Action:OnRemoveBan(const String:identity[],
flags,
const String:command[],
any:source);
forward Action OnRemoveBan(const char[] identity,
int flags,
const char[] command,
any source);
/**
* Bans a client.
@ -111,13 +111,13 @@ forward Action:OnRemoveBan(const String:identity[],
* @return True on success, false on failure.
* @error Invalid client index or client not in game.
*/
native bool:BanClient(client,
time,
flags,
const String:reason[],
const String:kick_message[]="",
const String:command[]="",
any:source=0);
native bool BanClient(int client,
int time,
int flags,
const char[] reason,
const char[] kick_message="",
const char[] command="",
any source=0);
/**
* Bans an identity (either an IP address or auth string).
@ -132,12 +132,12 @@ native bool:BanClient(client,
* index of any sort (not actually checked by Core).
* @return True on success, false on failure.
*/
native bool:BanIdentity(const String:identity[],
time,
flags,
const String:reason[],
const String:command[]="",
any:source=0);
native bool BanIdentity(const char[] identity,
int time,
int flags,
const char[] reason,
const char[] command="",
any source=0);
/**
* Removes a ban that was written to the server (either in memory or on disk).
@ -150,8 +150,7 @@ native bool:BanIdentity(const String:identity[],
* index of any sort (not actually checked by Core).
* @return True on success, false on failure.
*/
native bool:RemoveBan(const String:identity[],
flags,
const String:command[]="",
any:source=0);
native bool RemoveBan(const char[] identity,
int flags,
const char[] command="",
any source=0);

View File

@ -41,7 +41,7 @@
* @param client Client index
* @param muteState True if client was muted, false otherwise
*/
forward BaseComm_OnClientMute(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 BaseComm_OnClientGag(client, bool:gagState);
forward void BaseComm_OnClientGag(int client, bool gagState);
/**
* Returns whether or not a client is gagged
@ -57,7 +57,7 @@
* @param client Client index.
* @return True if client is gagged, false otherwise.
*/
native bool:BaseComm_IsClientGagged(client);
native bool BaseComm_IsClientGagged(int client);
/**
* Returns whether or not a client is muted
@ -65,7 +65,7 @@ native bool:BaseComm_IsClientGagged(client);
* @param client Client index.
* @return True if client is muted, false otherwise.
*/
native bool:BaseComm_IsClientMuted(client);
native bool BaseComm_IsClientMuted(int client);
/**
* Sets a client's gag state
@ -74,7 +74,7 @@ native bool:BaseComm_IsClientMuted(client);
* @param gagState True to gag client, false to ungag.
* @return True if this caused a change in gag state, false otherwise.
*/
native bool:BaseComm_SetClientGag(client, bool:gagState);
native bool BaseComm_SetClientGag(int client, bool gagState);
/**
* Sets a client's mute state
@ -83,11 +83,11 @@ native bool:BaseComm_SetClientGag(client, bool:gagState);
* @param muteState True to mute client, false to unmute.
* @return True if this caused a change in mute state, false otherwise.
*/
native bool:BaseComm_SetClientMute(client, bool:muteState);
native bool BaseComm_SetClientMute(int client, bool muteState);
/* DO NOT EDIT BELOW THIS LINE */
public SharedPlugin:__pl_basecomm =
public SharedPlugin __pl_basecomm =
{
name = "basecomm",
file = "basecomm.smx",
@ -99,7 +99,7 @@ public SharedPlugin:__pl_basecomm =
};
#if !defined REQUIRE_PLUGIN
public __pl_basecomm_SetNTVOptional()
public void __pl_basecomm_SetNTVOptional()
{
MarkNativeAsOptional("BaseComm_IsClientGagged");
MarkNativeAsOptional("BaseComm_IsClientMuted");

View File

@ -312,7 +312,6 @@ native void BfWriteVecCoord(Handle bf, float coord[3]);
*
* @param bf bf_write handle to write to.
* @param vec Vector to write.
* @noreturn
* @error Invalid or incorrect Handle.
*/
native void BfWriteVecNormal(Handle bf, float vec[3]);

View File

@ -95,7 +95,7 @@ enum CookieMenuAction
* exists, a handle to it will still be returned.
* @error Cookie name is blank.
*/
native Handle:RegClientCookie(const String:name[], const String:description[], CookieAccess:access);
native Handle RegClientCookie(const char[] name, const char[] description, CookieAccess access);
/**
* Searches for a Client preference cookie.
@ -106,7 +106,7 @@ native Handle:RegClientCookie(const String:name[], const String:description[], C
* @param name Name of cookie to find.
* @return A handle to the cookie if it is found. INVALID_HANDLE otherwise.
*/
native Handle:FindClientCookie(const String:name[]);
native Handle FindClientCookie(const char[] name);
/**
* Set the value of a Client preference cookie.
@ -114,10 +114,9 @@ native Handle:FindClientCookie(const String:name[]);
* @param client Client index.
* @param cookie Client preference cookie handle.
* @param value String value to set.
* @noreturn
* @error Invalid cookie handle or invalid client index.
*/
native SetClientCookie(client, Handle:cookie, const String:value[]);
native void SetClientCookie(int client, Handle cookie, const char[] value);
/**
* Retrieve the value of a Client preference cookie.
@ -126,10 +125,9 @@ native SetClientCookie(client, Handle:cookie, const String:value[]);
* @param cookie Client preference cookie handle.
* @param buffer Copyback buffer for value.
* @param maxlen Maximum length of the buffer.
* @noreturn
* @error Invalid cookie handle or invalid client index.
*/
native GetClientCookie(client, Handle:cookie, String:buffer[], maxlen);
native void GetClientCookie(int client, Handle cookie, char[] buffer, int maxlen);
/**
* Sets the value of a Client preference cookie based on an authID string.
@ -137,10 +135,9 @@ native GetClientCookie(client, Handle:cookie, String:buffer[], maxlen);
* @param authID String Auth/STEAM ID of player to set.
* @param cookie Client preference cookie handle.
* @param value String value to set.
* @noreturn
* @error Invalid cookie handle.
*/
native SetAuthIdCookie(const String:authID[], Handle:cookie, const String:value[]);
native void SetAuthIdCookie(const char[] authID, Handle cookie, const char[] value);
/**
* Checks if a clients cookies have been loaded from the database.
@ -149,14 +146,14 @@ native SetAuthIdCookie(const String:authID[], Handle:cookie, const String:value[
* @return True if loaded, false otherwise.
* @error Invalid client index.
*/
native bool:AreClientCookiesCached(client);
native bool AreClientCookiesCached(int client);
/**
* Called once a client's saved cookies have been loaded from the database.
*
* @param client Client index.
*/
forward OnClientCookiesCached(client);
forward void OnClientCookiesCached(int client);
/**
* Cookie Menu Callback prototype
@ -166,7 +163,6 @@ forward OnClientCookiesCached(client);
* @param info Info data passed.
* @param buffer Outbut buffer.
* @param maxlen Max length of the output buffer.
* @noreturn
*/
typedef CookieMenuHandler = function void (
int client,
@ -186,10 +182,9 @@ typedef CookieMenuHandler = function void (
* @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.
* @noreturn
* @error Invalid cookie handle.
*/
native SetCookiePrefabMenu(Handle:cookie, CookieMenu:type, const String:display[], CookieMenuHandler:handler=INVALID_FUNCTION, info=0);
native void SetCookiePrefabMenu(Handle cookie, CookieMenu type, const char[] display, CookieMenuHandler handler=INVALID_FUNCTION, any info=0);
/**
* Adds a new item to the client cookie settings menu.
@ -199,25 +194,23 @@ native SetCookiePrefabMenu(Handle:cookie, CookieMenu:type, const String:display[
* @param handler A MenuHandler callback function.
* @param info Data to pass to the callback.
* @param display Text to show on the menu.
* @noreturn
* @error Invalid cookie handle.
*/
native SetCookieMenuItem(CookieMenuHandler:handler, any:info, const String:display[]);
native void SetCookieMenuItem(CookieMenuHandler handler, any info, const char[] display);
/**
* Displays the settings menu to a client.
*
* @param client Client index.
* @noreturn
*/
native ShowCookieMenu(client);
native void ShowCookieMenu(int client);
/**
* Gets a cookie iterator. Must be freed with CloseHandle().
*
* @return A new cookie iterator.
*/
native Handle:GetCookieIterator();
native Handle GetCookieIterator();
/**
* Reads a cookie iterator, then advances to the next cookie if any.
@ -230,12 +223,12 @@ native Handle:GetCookieIterator();
* @param descLen Cookie description buffer size.
* @return True on success, false if there are no more commands.
*/
native bool:ReadCookieIterator(Handle:iter,
String:name[],
nameLen,
&CookieAccess:access,
String:desc[]="",
descLen=0);
native bool ReadCookieIterator(Handle iter,
char[] name,
int nameLen,
CookieAccess &access,
char[] desc="",
int descLen=0);
/**
* Returns the access level of a cookie
@ -244,7 +237,7 @@ native bool:ReadCookieIterator(Handle:iter,
* @return CookieAccess access level.
* @error Invalid cookie handle.
*/
native CookieAccess:GetCookieAccess(Handle:cookie);
native CookieAccess GetCookieAccess(Handle cookie);
/**
* Returns the last updated timestamp for a client cookie
@ -253,12 +246,12 @@ native CookieAccess:GetCookieAccess(Handle:cookie);
* @param cookie Cookie handle.
* @return Last updated timestamp.
*/
native GetClientCookieTime(client, Handle:cookie);
native int GetClientCookieTime(int client, Handle cookie);
/**
* Do not edit below this line!
*/
public Extension:__ext_cprefs =
public Extension __ext_cprefs =
{
name = "Client Preferences",
file = "clientprefs.ext",
@ -271,7 +264,7 @@ public Extension:__ext_cprefs =
};
#if !defined REQUIRE_EXTENSIONS
public __ext_cprefs_SetNTVOptional()
public void __ext_cprefs_SetNTVOptional()
{
MarkNativeAsOptional("RegClientCookie");
MarkNativeAsOptional("FindClientCookie");

View File

@ -67,15 +67,12 @@ enum AuthIdType
/**
* MAXPLAYERS is not the same as MaxClients.
* MAXPLAYERS is a hardcoded value as an upper limit. MaxClients changes based on the server.
*
* Both GetMaxClients() and MaxClients are only available once the map is loaded, and should
* not be used in OnPluginStart().
*/
#define MAXPLAYERS 65 /**< Maximum number of players SourceMod supports */
#define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */
public const MaxClients; /**< Maximum number of players the server supports (dynamic) */
public const int MaxClients; /**< Maximum number of players the server supports (dynamic) */
/**
* Called on client connection. If you return true, the client will be allowed in the server.
@ -91,15 +88,14 @@ public const MaxClients; /**< Maximum number of players the server supports (dyn
* @param maxlen Maximum number of characters for rejection buffer.
* @return True to validate client's connection, false to refuse it.
*/
forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
forward bool OnClientConnect(int client, char[] rejectmsg, int maxlen);
/**
* Called once a client successfully connects. This callback is paired with OnClientDisconnect.
*
* @param client Client index.
* @noreturn
*/
forward void OnClientConnected(client);
forward void OnClientConnected(int client);
/**
* Called when a client is entering the game.
@ -113,25 +109,22 @@ forward void OnClientConnected(client);
* function, as clients are already in game at this point.
*
* @param client Client index.
* @noreturn
*/
forward void OnClientPutInServer(client);
forward void OnClientPutInServer(int client);
/**
* Called when a client is disconnecting from the server.
*
* @param client Client index.
* @noreturn
*/
forward void OnClientDisconnect(client);
forward void OnClientDisconnect(int client);
/**
* Called when a client is disconnected from the server.
*
* @param client Client index.
* @noreturn
*/
forward void OnClientDisconnect_Post(client);
forward void OnClientDisconnect_Post(int client);
/**
* Called when a client is sending a command.
@ -141,17 +134,39 @@ forward void OnClientDisconnect_Post(client);
*
* @param client Client index.
* @param args Number of arguments.
* @noreturn
* @return Plugin_Handled blocks the command from being sent,
* and Plugin_Continue resumes normal functionality.
*/
forward Action:OnClientCommand(client, args);
forward Action OnClientCommand(int client, int args);
/**
* Called when a client is sending a KeyValues command.
*
* @param client Client index.
* @param kv Editable KeyValues data to be sent as the command.
* (This handle should not be stored and will be closed
* after this forward completes.)
* @return Plugin_Handled blocks the command from being sent,
* and Plugin_Continue resumes normal functionality.
*/
forward Action OnClientCommandKeyValues(int client, KeyValues kv);
/**
* Called after a client has sent a KeyValues command.
*
* @param client Client index.
* @param kv KeyValues data sent as the command.
* (This handle should not be stored and will be closed
* after this forward completes.)
*/
forward void OnClientCommandKeyValues_Post(int client, KeyValues kv);
/**
* Called whenever the client's settings are changed.
*
* @param client Client index.
* @noreturn
*/
forward void OnClientSettingsChanged(client);
forward void OnClientSettingsChanged(int client);
/**
* Called when a client receives an auth ID. The state of a client's
@ -162,9 +177,8 @@ forward void OnClientSettingsChanged(client);
*
* @param client Client index.
* @param auth Client Steam2 id, if available, else engine auth id.
* @noreturn
*/
forward void OnClientAuthorized(client, const String:auth[]);
forward void OnClientAuthorized(int client, const char[] auth);
/**
* Called once a client is authorized and fully in-game, but
@ -176,13 +190,13 @@ forward void OnClientAuthorized(client, const String:auth[]);
* Note: If handled/blocked, PostAdminCheck must be signalled
* manually via NotifyPostAdminCheck().
*
* This callback is gauranteed to occur on all clients, and always
* This callback is guaranteed to occur on all clients, and always
* after each OnClientPutInServer() call.
*
* @param client Client index.
* @return Plugin_Handled to block admin checks.
*/
forward Action:OnClientPreAdminCheck(client);
forward Action OnClientPreAdminCheck(int client);
/**
* Called directly before OnClientPostAdminCheck() as a method to
@ -197,21 +211,19 @@ forward Action:OnClientPreAdminCheck(client);
* See OnClientPostAdminCheck() for more information.
*
* @param client Client index.
* @noreturn
*/
forward void OnClientPostAdminFilter(client);
forward void OnClientPostAdminFilter(int client);
/**
* Called once a client is authorized and fully in-game, and
* after all post-connection authorizations have been performed.
*
* This callback is gauranteed to occur on all clients, and always
* This callback is guaranteed to occur on all clients, and always
* after each OnClientPutInServer() call.
*
* @param client Client index.
* @noreturn
*/
forward void OnClientPostAdminCheck(client);
forward void OnClientPostAdminCheck(int client);
/**
* This function will be deprecated in a future release. Use the MaxClients variable instead.
@ -226,7 +238,7 @@ forward void OnClientPostAdminCheck(client);
*
* @return Maximum number of clients allowed.
*/
native GetMaxClients();
native int GetMaxClients();
/**
* Returns the maximum number of human players allowed on the server. This is
@ -241,7 +253,7 @@ native GetMaxClients();
*
* @return Maximum number of humans allowed.
*/
native GetMaxHumanPlayers();
native int GetMaxHumanPlayers();
/**
* Returns the client count put in the server.
@ -249,7 +261,7 @@ native GetMaxHumanPlayers();
* @param inGameOnly If false connecting players are also counted.
* @return Client count in the server.
*/
native GetClientCount(bool:inGameOnly=true);
native int GetClientCount(bool inGameOnly=true);
/**
* Returns the client's name.
@ -260,7 +272,7 @@ native GetClientCount(bool:inGameOnly=true);
* @return True on success, false otherwise.
* @error If the client is not connected an error will be thrown.
*/
native bool:GetClientName(client, String:name[], maxlen);
native bool GetClientName(int client, char[] name, int maxlen);
/**
* Retrieves a client's IP address.
@ -272,7 +284,7 @@ native bool:GetClientName(client, String:name[], maxlen);
* @return True on success, false otherwise.
* @error If the client is not connected or the index is invalid.
*/
native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
native bool GetClientIP(int client, char[] ip, int maxlen, bool remport=true);
/**
* Retrieves a client's authentication string (SteamID).
@ -287,7 +299,7 @@ native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
* @error If the client is not connected or the index is invalid.
*/
#pragma deprecated Use GetClientAuthId
native bool:GetClientAuthString(client, String:auth[], maxlen, bool:validate=true);
native bool GetClientAuthString(int client, char[] auth, int maxlen, bool validate=true);
/**
* Retrieves a client's authentication string (SteamID).
@ -302,7 +314,7 @@ native bool:GetClientAuthString(client, String:auth[], maxlen, bool:validate=tru
* @return True on success, false otherwise.
* @error If the client is not connected or the index is invalid.
*/
native bool:GetClientAuthId(client, AuthIdType:authType, String:auth[], maxlen, bool:validate=true);
native bool GetClientAuthId(int client, AuthIdType authType, char[] auth, int maxlen, bool validate=true);
/**
* Returns the client's Steam account ID.
@ -314,7 +326,7 @@ native bool:GetClientAuthId(client, AuthIdType:authType, String:auth[], maxlen,
* @return Steam account ID or 0 if not available.
* @error If the client is not connected or the index is invalid.
*/
native GetSteamAccountID(client, bool:validate=true);
native int GetSteamAccountID(int client, bool validate=true);
/**
* Retrieves a client's user id, which is an index incremented for every client
@ -324,7 +336,7 @@ native GetSteamAccountID(client, bool:validate=true);
* @return User id of the client.
* @error If the client is not connected or the index is invalid.
*/
native GetClientUserId(client);
native int GetClientUserId(int client);
/**
* Returns if a certain player is connected.
@ -332,7 +344,7 @@ native GetClientUserId(client);
* @param client Player index.
* @return True if player is connected to the server, false otherwise.
*/
native bool:IsClientConnected(client);
native bool IsClientConnected(int client);
/**
* Returns if a certain player has entered the game.
@ -341,7 +353,7 @@ native bool:IsClientConnected(client);
* @return True if player has entered the game, false otherwise.
* @error Invalid client index.
*/
native bool:IsClientInGame(client);
native bool IsClientInGame(int client);
/**
* Returns if a client is in the "kick queue" (i.e. the client will be kicked
@ -351,14 +363,14 @@ native bool:IsClientInGame(client);
* @return True if in the kick queue, false otherwise.
* @error Invalid client index.
*/
native bool:IsClientInKickQueue(client);
native bool IsClientInKickQueue(int client);
/**
* Backwards compatibility stock - use IsClientInGame
* @deprecated Renamed to IsClientInGame
*/
#pragma deprecated Use IsClientInGame() instead
stock bool:IsPlayerInGame(client)
stock bool IsPlayerInGame(int client)
{
return IsClientInGame(client);
}
@ -369,7 +381,7 @@ stock bool:IsPlayerInGame(client)
* @param client Player index.
* @return True if player has been authenticated, false otherwise.
*/
native bool:IsClientAuthorized(client);
native bool IsClientAuthorized(int client);
/**
* Returns if a certain player is a fake client.
@ -377,7 +389,7 @@ native bool:IsClientAuthorized(client);
* @param client Player index.
* @return True if player is a fake client, false otherwise.
*/
native bool:IsFakeClient(client);
native bool IsFakeClient(int client);
/**
* Returns if a certain player is the SourceTV bot.
@ -385,7 +397,7 @@ native bool:IsFakeClient(client);
* @param client Player index.
* @return True if player is the SourceTV bot, false otherwise.
*/
native bool:IsClientSourceTV(client);
native bool IsClientSourceTV(int client);
/**
* Returns if a certain player is the Replay bot.
@ -393,15 +405,15 @@ native bool:IsClientSourceTV(client);
* @param client Player index.
* @return True if player is the Replay bot, false otherwise.
*/
native bool:IsClientReplay(client);
native bool IsClientReplay(int client);
/**
* Returns if a certain player is an observer/spectator.
*
* @param client Player index.
* @return True if player is an obverser, false otherwise.
* @return True if player is an observer, false otherwise.
*/
native bool:IsClientObserver(client);
native bool IsClientObserver(int client);
/**
* Returns if the client is alive or dead.
@ -412,7 +424,7 @@ native bool:IsClientObserver(client);
* @return True if the client is alive, false otherwise.
* @error Invalid client index, client not in game, or no mod support.
*/
native bool:IsPlayerAlive(client);
native bool IsPlayerAlive(int client);
/**
* Retrieves values from client replicated keys.
@ -424,7 +436,7 @@ native bool:IsPlayerAlive(client);
* @return True on success, false otherwise.
* @error Invalid client index, or client not connected.
*/
native bool:GetClientInfo(client, const String:key[], String:value[], maxlen);
native bool GetClientInfo(int client, const char[] key, char[] value, int maxlen);
/**
* Retrieves a client's team index.
@ -433,7 +445,7 @@ native bool:GetClientInfo(client, const String:key[], String:value[], maxlen);
* @return Team index the client is on (mod specific).
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientTeam(client);
native int GetClientTeam(int client);
/**
* Sets a client's AdminId.
@ -441,10 +453,9 @@ native GetClientTeam(client);
* @param client Player's index.
* @param id AdminId to set. INVALID_ADMIN_ID removes admin permissions.
* @param temp True if the id should be freed on disconnect.
* @noreturn
* @error Invalid client index, client not connected, or bogus AdminId.
*/
native SetUserAdmin(client, AdminId:id, bool:temp=false);
native void SetUserAdmin(int client, AdminId id, bool temp=false);
/**
* Retrieves a client's AdminId.
@ -453,7 +464,7 @@ native SetUserAdmin(client, AdminId:id, bool:temp=false);
* @return AdminId of the client, or INVALID_ADMIN_ID if none.
* @error Invalid client index, or client not connected.
*/
native AdminId:GetUserAdmin(client);
native AdminId GetUserAdmin(int client);
/**
* Sets access flags on a client. If the client is not an admin,
@ -461,10 +472,9 @@ native AdminId:GetUserAdmin(client);
*
* @param client Player's index.
* @param ... Flags to set on the client.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native AddUserFlags(client, AdminFlag:...);
native void AddUserFlags(int client, AdminFlag ...);
/**
* Removes flags from a client. If the client is not an admin,
@ -472,10 +482,9 @@ native AddUserFlags(client, AdminFlag:...);
*
* @param client Player's index.
* @param ... Flags to remove from the client.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native RemoveUserFlags(client, AdminFlag:...);
native void RemoveUserFlags(int client, AdminFlag ...);
/**
* Sets access flags on a client using bits instead of flags. If the
@ -483,9 +492,8 @@ native RemoveUserFlags(client, AdminFlag:...);
*
* @param client Player's index.
* @param flags Bitstring of flags to set on client.
* @noreturn
*/
native SetUserFlagBits(client, flags);
native void SetUserFlagBits(int client, int flags);
/**
* Returns client access flags. If the client is not an admin,
@ -495,7 +503,7 @@ native SetUserFlagBits(client, flags);
* @return Flags
* @error Invalid client index, or client not connected.
*/
native GetUserFlagBits(client);
native int GetUserFlagBits(int client);
/**
* Returns whether a user can target another user.
@ -506,7 +514,7 @@ native GetUserFlagBits(client);
* @return True if target is targettable by the player, false otherwise.
* @error Invalid or unconnected player indexers.
*/
native bool:CanUserTarget(client, target);
native bool CanUserTarget(int client, int target);
/**
* Runs through the Core-defined admin authorization checks on a player.
@ -518,7 +526,7 @@ native bool:CanUserTarget(client, target);
* @return True if access was changed, false if it did not.
* @error Invalid client index or client not in-game AND authorized.
*/
native bool:RunAdminCacheChecks(client);
native bool RunAdminCacheChecks(int client);
/**
* Signals that a player has completed post-connection admin checks.
@ -527,10 +535,9 @@ native bool:RunAdminCacheChecks(client);
* Note: This must be sent even if no admin id was assigned.
*
* @param client Client index.
* @noreturn
* @error Invalid client index or client not in-game AND authorized.
*/
native NotifyPostAdminCheck(client);
native void NotifyPostAdminCheck(int client);
/**
* Creates a fake client.
@ -538,7 +545,7 @@ native NotifyPostAdminCheck(client);
* @param name Name to use.
* @return Client index on success, 0 otherwise.
*/
native CreateFakeClient(const String:name[]);
native int CreateFakeClient(const char[] name);
/**
* Sets a convar value on a fake client.
@ -546,11 +553,10 @@ native CreateFakeClient(const String:name[]);
* @param client Client index.
* @param cvar ConVar name.
* @param value ConVar value.
* @noreturn
* @error Invalid client index, client not connected,
* or client not a fake client.
*/
native SetFakeClientConVar(client, const String:cvar[], const String:value[]);
native void SetFakeClientConVar(int client, const char[] cvar, const char[] value);
/**
* Returns the client's health.
@ -559,7 +565,7 @@ native SetFakeClientConVar(client, const String:cvar[], const String:value[]);
* @return Health value.
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientHealth(client);
native int GetClientHealth(int client);
/**
* Returns the client's model name.
@ -567,10 +573,9 @@ native GetClientHealth(client);
* @param client Player's index.
* @param model Buffer to store the client's model name.
* @param maxlen Maximum length of string buffer (includes NULL terminator).
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientModel(client, String:model[], maxlen);
native void GetClientModel(int client, char[] model, int maxlen);
/**
* Returns the client's weapon name.
@ -578,50 +583,45 @@ native GetClientModel(client, String:model[], maxlen);
* @param client Player's index.
* @param weapon Buffer to store the client's weapon name.
* @param maxlen Maximum length of string buffer (includes NULL terminator).
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientWeapon(client, String:weapon[], maxlen);
native void GetClientWeapon(int client, char[] weapon, int maxlen);
/**
* Returns the client's max size vector.
*
* @param client Player's index.
* @param vec Destination vector to store the client's max size.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientMaxs(client, Float:vec[3]);
native void GetClientMaxs(int client, float vec[3]);
/**
* Returns the client's min size vector.
*
* @param client Player's index.
* @param vec Destination vector to store the client's min size.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientMins(client, Float:vec[3]);
native void GetClientMins(int client, float vec[3]);
/**
* Returns the client's position angle.
*
* @param client Player's index.
* @param ang Destination vector to store the client's position angle.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientAbsAngles(client, Float:ang[3]);
native void GetClientAbsAngles(int client, float ang[3]);
/**
* Returns the client's origin vector.
*
* @param client Player's index.
* @param vec Destination vector to store the client's origin vector.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientAbsOrigin(client, Float:vec[3]);
native void GetClientAbsOrigin(int client, float vec[3]);
/**
* Returns the client's armor.
@ -630,7 +630,7 @@ native GetClientAbsOrigin(client, Float:vec[3]);
* @return Armor value.
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientArmor(client);
native int GetClientArmor(int client);
/**
* Returns the client's death count.
@ -639,7 +639,7 @@ native GetClientArmor(client);
* @return Death count.
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientDeaths(client);
native int GetClientDeaths(int client);
/**
* Returns the client's frag count.
@ -648,7 +648,7 @@ native GetClientDeaths(client);
* @return Frag count.
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientFrags(client);
native int GetClientFrags(int client);
/**
* Returns the client's send data rate in bytes/sec.
@ -657,7 +657,7 @@ native GetClientFrags(client);
* @return Data rate.
* @error Invalid client index, client not connected, or fake client.
*/
native GetClientDataRate(client);
native int GetClientDataRate(int client);
/**
* Returns if a client is timing out
@ -666,7 +666,7 @@ native GetClientDataRate(client);
* @return True if client is timing out, false otherwise.
* @error Invalid client index, client not connected, or fake client.
*/
native bool:IsClientTimingOut(client);
native bool IsClientTimingOut(int client);
/**
* Returns the client's connection time in seconds.
@ -675,7 +675,7 @@ native bool:IsClientTimingOut(client);
* @return Connection time.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientTime(client);
native float GetClientTime(int client);
/**
* Returns the client's current latency (RTT), more accurate than GetAvgLatency but jittering.
@ -685,7 +685,7 @@ native Float:GetClientTime(client);
* @return Latency, or -1 if network info is not available.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientLatency(client, NetFlow:flow);
native float GetClientLatency(int client, NetFlow flow);
/**
* Returns the client's average packet latency in seconds.
@ -695,7 +695,7 @@ native Float:GetClientLatency(client, NetFlow:flow);
* @return Latency, or -1 if network info is not available.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgLatency(client, NetFlow:flow);
native float GetClientAvgLatency(int client, NetFlow flow);
/**
* Returns the client's average packet loss, values go from 0 to 1 (for percentages).
@ -705,7 +705,7 @@ native Float:GetClientAvgLatency(client, NetFlow:flow);
* @return Average packet loss, or -1 if network info is not available.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgLoss(client, NetFlow:flow);
native float GetClientAvgLoss(int client, NetFlow flow);
/**
* Returns the client's average packet choke, values go from 0 to 1 (for percentages).
@ -715,7 +715,7 @@ native Float:GetClientAvgLoss(client, NetFlow:flow);
* @return Average packet loss, or -1 if network info is not available.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgChoke(client, NetFlow:flow);
native float GetClientAvgChoke(int client, NetFlow flow);
/**
* Returns the client's data flow in bytes/sec.
@ -725,7 +725,7 @@ native Float:GetClientAvgChoke(client, NetFlow:flow);
* @return Data flow.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgData(client, NetFlow:flow);
native float GetClientAvgData(int client, NetFlow flow);
/**
* Returns the client's average packet frequency in packets/sec.
@ -735,7 +735,7 @@ native Float:GetClientAvgData(client, NetFlow:flow);
* @return Packet frequency.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgPackets(client, NetFlow:flow);
native float GetClientAvgPackets(int client, NetFlow flow);
/**
* Translates an userid index to the real player index.
@ -744,7 +744,7 @@ native Float:GetClientAvgPackets(client, NetFlow:flow);
* @return Client value.
* @error Returns 0 if invalid userid.
*/
native GetClientOfUserId(userid);
native int GetClientOfUserId(int userid);
/**
* Disconnects a client from the server as soon as the next frame starts.
@ -762,10 +762,9 @@ native GetClientOfUserId(userid);
* @param format Optional formatting rules for disconnect reason.
* Note that a period is automatically appended to the string by the engine.
* @param ... Variable number of format parameters.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native KickClient(client, const String:format[]="", any:...);
native void KickClient(int client, const char[] format="", any ...);
/**
* Immediately disconnects a client from the server.
@ -778,10 +777,9 @@ native KickClient(client, const String:format[]="", any:...);
* @param format Optional formatting rules for disconnect reason.
* Note that a period is automatically appended to the string by the engine.
* @param ... Variable number of format parameters.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native KickClientEx(client, const String:format[]="", any:...);
native void KickClientEx(int client, const char[] format="", any ...);
/**
* Changes a client's team through the mod's generic team changing function.
@ -789,19 +787,19 @@ native KickClientEx(client, const String:format[]="", any:...);
*
* @param client Client index.
* @param team Mod-specific team index.
* @noreturn
* @error Invalid client index, client not connected, or lack of
* mod support.
*/
native ChangeClientTeam(client, team);
native void ChangeClientTeam(int client, int team);
/**
* Returns the clients unique serial identifier.
*
* @param client Client index.
* @return Serial number.
* @error Invalid client index, or client not connected.
*/
native GetClientSerial(client);
native int GetClientSerial(int client);
/**
* Returns the client index by its serial number.
@ -809,5 +807,4 @@ native GetClientSerial(client);
* @param serial Serial number.
* @return Client index, or 0 for invalid serial.
*/
native GetClientFromSerial(serial);
native int GetClientFromSerial(int serial);

View File

@ -75,14 +75,33 @@
* if one valid client is found. Otherwise, a COMMAND_TARGET reason
* for failure is returned.
*/
native ProcessTargetString(const String:pattern[],
admin,
targets[],
max_targets,
filter_flags,
String:target_name[],
tn_maxlength,
&bool:tn_is_ml);
native int ProcessTargetString(const char[] pattern,
int admin,
int[] targets,
int max_targets,
int filter_flags,
char[] target_name,
int tn_maxlength,
bool &tn_is_ml);
/**
* Retrieves arguments that were passed to the last ProcessTargetString call.
*
* @param pattern Buffer to store the pattern.
* @param p_maxlen Maximum length of the pattern buffer.
* @param admin OUTPUT: Admin performing the action, or 0 if the server.
* @param filter_flags OUTPUT: Filter flags.
* @noreturn
*/
native void GetLastProcessTargetString(char[] pattern,
int p_maxlen,
int &admin,
int &filter_flags);
#undef REQUIRE_PLUGIN
#include <DynamicTargeting>
#define REQUIRE_PLUGIN
/**
* Replies to a client with a given message describing a targetting
@ -92,9 +111,8 @@ native ProcessTargetString(const String:pattern[],
*
* @param client Client index, or 0 for server.
* @param reason COMMAND_TARGET reason.
* @noreturn
*/
stock ReplyToTargetError(client, reason)
stock void ReplyToTargetError(int client, int reason, bool dynamic=true)
{
switch (reason)
{
@ -129,6 +147,34 @@ stock ReplyToTargetError(client, reason)
case COMMAND_TARGET_AMBIGUOUS:
{
ReplyToCommand(client, "[SM] %t", "More than one client matched");
if(dynamic &&
GetFeatureStatus(FeatureType_Native, "GetLastProcessTargetString") == FeatureStatus_Available &&
LibraryExists("DynamicTargeting"))
{
if(GetFeatureStatus(FeatureType_Native, "IsCommandCallback") == FeatureStatus_Available &&
!IsCommandCallback())
{
return;
}
char sCommand[128];
GetCmdArg(0, sCommand, sizeof(sCommand));
char sArgString[256];
GetCmdArgString(sArgString, sizeof(sArgString));
char pattern[MAX_TARGET_LENGTH];
int admin;
int filter_flags;
GetLastProcessTargetString(pattern, sizeof(pattern), admin, filter_flags);
if(!admin || !IsClientInGame(admin) || IsFakeClient(admin))
return;
AmbiguousMenu(admin, sCommand, sArgString, pattern, filter_flags);
}
}
}
}
@ -138,9 +184,10 @@ stock ReplyToTargetError(client, reason)
*
* @param pattern Pattern name.
* @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.
*/
typedef MultiTargetFilter = function bool (const char[] pattern, Handle clients);
typedef MultiTargetFilter = function bool (const char[] pattern, Handle clients, int client);
/**
* Adds a multi-target filter function for ProcessTargetString().
@ -149,17 +196,14 @@ typedef MultiTargetFilter = function bool (const char[] pattern, Handle clients)
* @param filter Filter function.
* @param phrase Descriptive phrase to display on successful match.
* @param phraseIsML True if phrase is multi-lingual, false otherwise.
* @noreturn
*/
native AddMultiTargetFilter(const String:pattern[], MultiTargetFilter:filter,
const String:phrase[], bool:phraseIsML);
native void AddMultiTargetFilter(const char[] pattern, MultiTargetFilter filter,
const char[] phrase, bool phraseIsML);
/**
* Removes a multi-target filter function from ProcessTargetString().
*
* @param pattern Pattern to match (case sensitive).
* @param filter Filter function.
* @noreturn
*/
native RemoveMultiTargetFilter(const String:pattern[], MultiTargetFilter:filter);
native void RemoveMultiTargetFilter(const char[] pattern, MultiTargetFilter filter);

View File

@ -43,7 +43,7 @@
* @return True if the command line is valid; otherwise, false.
* @error No command line available, or no mod support.
*/
native bool:GetCommandLine(String:commandLine[], maxlen);
native bool GetCommandLine(char[] commandLine, int maxlen);
/**
* Gets the value of a command line parameter the server was launched with.
@ -52,10 +52,9 @@ native bool:GetCommandLine(String:commandLine[], maxlen);
* @param value Buffer to store the parameter value in.
* @param maxlen Maximum length of the value buffer.
* @param defValue The default value to return if the parameter wasn't specified.
* @return True if the command line is valid; otherwise, false.
* @error No command line available, or no mod support.
*/
native GetCommandLineParam(const String:param[], String:value[], maxlen, const String:defValue[]="");
native void GetCommandLineParam(const char[] param, char[] value, int maxlen, const char[] defValue="");
/**
* Gets the value of a command line parameter the server was launched with.
@ -65,7 +64,7 @@ native GetCommandLineParam(const String:param[], String:value[], maxlen, const S
* @return The integer value of the command line parameter value.
* @error No command line available, or no mod support.
*/
native GetCommandLineParamInt(const String:param[], defValue=0);
native int GetCommandLineParamInt(const char[] param, int defValue=0);
/**
* Gets the value of a command line parameter the server was launched with.
@ -75,7 +74,7 @@ native GetCommandLineParamInt(const String:param[], defValue=0);
* @return The floating point value of the command line parameter value.
* @error No command line available, or no mod support.
*/
native Float:GetCommandLineParamFloat(const String:param[], Float:defValue=0.0);
native float GetCommandLineParamFloat(const char[] param, float defValue=0.0);
/**
* Determines if a specific command line parameter is present.
@ -84,4 +83,4 @@ native Float:GetCommandLineParamFloat(const String:param[], Float:defValue=0.0);
* @return True if the command line parameter is specified; otherwise, false.
* @error No command line available, or no mod support.
*/
native bool:FindCommandLineParam(const String:param[]);
native bool FindCommandLineParam(const char[] param);

View File

@ -58,35 +58,49 @@ enum ReplySource
* @section Flags for console commands and console variables. The descriptions
* for each constant come directly from the Source SDK.
*/
#define FCVAR_NONE 0 /**< The default, no flags at all */
#define FCVAR_UNREGISTERED (1<<0) /**< If this is set, don't add to linked list, etc. */
#define FCVAR_LAUNCHER (1<<1) /**< Defined by launcher. */
#define FCVAR_GAMEDLL (1<<2) /**< Defined by the game DLL. */
#define FCVAR_CLIENTDLL (1<<3) /**< Defined by the client DLL. */
#define FCVAR_MATERIAL_SYSTEM (1<<4) /**< Defined by the material system. */
#define FCVAR_PROTECTED (1<<5) /**< It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value. */
#define FCVAR_SPONLY (1<<6) /**< This cvar cannot be changed by clients connected to a multiplayer server. */
#define FCVAR_ARCHIVE (1<<7) /**< Set to cause it to be saved to vars.rc */
#define FCVAR_NOTIFY (1<<8) /**< Notifies players when changed. */
#define FCVAR_USERINFO (1<<9) /**< Changes the client's info string. */
#define FCVAR_PRINTABLEONLY (1<<10) /**< This cvar's string cannot contain unprintable characters (e.g., used for player name, etc.) */
#define FCVAR_UNLOGGED (1<<11) /**< If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log */
#define FCVAR_NEVER_AS_STRING (1<<12) /**< Never try to print that cvar. */
#define FCVAR_REPLICATED (1<<13) /**< Server setting enforced on clients. */
#define FCVAR_CHEAT (1<<14) /**< Only useable in singleplayer / debug / multiplayer & sv_cheats */
#define FCVAR_STUDIORENDER (1<<15) /**< Defined by the studiorender system. */
#define FCVAR_DEMO (1<<16) /**< Record this cvar when starting a demo file. */
#define FCVAR_DONTRECORD (1<<17) /**< Don't record these command in demo files. */
#define FCVAR_PLUGIN (1<<18) /**< Defined by a 3rd party plugin. */
#define FCVAR_DATACACHE (1<<19) /**< Defined by the datacache system. */
#define FCVAR_TOOLSYSTEM (1<<20) /**< Defined by an IToolSystem library */
#define FCVAR_FILESYSTEM (1<<21) /**< Defined by the file system. */
#define FCVAR_NOT_CONNECTED (1<<22) /**< Cvar cannot be changed by a client that is connected to a server. */
#define FCVAR_SOUNDSYSTEM (1<<23) /**< Defined by the soundsystem library. */
#define FCVAR_ARCHIVE_XBOX (1<<24) /**< Cvar written to config.cfg on the Xbox. */
#define FCVAR_INPUTSYSTEM (1<<25) /**< Defined by the inputsystem DLL. */
#define FCVAR_NETWORKSYSTEM (1<<26) /**< Defined by the network system. */
#define FCVAR_VPHYSICS (1<<27) /**< Defined by vphysics. */
#pragma deprecated No logic using this flag ever existed in a released game. It only ever appeared in the first hl2sdk.
#define FCVAR_PLUGIN 0 // Actual value is same as FCVAR_SS_ADDED in Left 4 Dead and later.
#pragma deprecated Did you mean FCVAR_DEVELOPMENTONLY? (No logic using this flag ever existed in a released game. It only ever appeared in the first hl2sdk.)
#define FCVAR_LAUNCHER (1<<1) // Same value as FCVAR_DEVELOPMENTONLY, which is what most usages of this were intending to use.
#define FCVAR_NONE 0 // The default, no flags at all
#define FCVAR_UNREGISTERED (1<<0) // If this is set, don't add to linked list, etc.
#define FCVAR_DEVELOPMENTONLY (1<<1) // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined. (OB+)
#define FCVAR_GAMEDLL (1<<2) // Defined by the game DLL.
#define FCVAR_CLIENTDLL (1<<3) // Defined by the client DLL.
#define FCVAR_MATERIAL_SYSTEM (1<<4) // Defined by the material system. (EP1-only)
#define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in find or autocomplete. Like DEVELOPMENTONLY, but can't be compiled out.1 (OB+)
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc.
// Sends 1 if it's not bland/zero, 0 otherwise as value.
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
#define FCVAR_ARCHIVE (1<<7) // Set to cause it to be saved to vars.rc
#define FCVAR_NOTIFY (1<<8) // Notifies players when changed.
#define FCVAR_USERINFO (1<<9) // Changes the client's info string.
#define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters (e.g., used for player name, etc.)
#define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
#define FCVAR_NEVER_AS_STRING (1<<12) // Never try to print that cvar.
#define FCVAR_REPLICATED (1<<13) // Server setting enforced on clients.
#define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats
#define FCVAR_SS (1<<15) // causes varnameN where N 2 through max splitscreen slots for mod to be autogenerated (L4D+)
#define FCVAR_DEMO (1<<16) // Record this cvar when starting a demo file.
#define FCVAR_DONTRECORD (1<<17) // Don't record these command in demo files.
#define FCVAR_SS_ADDED (1<<18) // This is one of the "added" FCVAR_SS variables for the splitscreen players (L4D+)
#define FCVAR_RELEASE (1<<19) // Cvars tagged with this are the only cvars available to customers (L4D+)
#define FCVAR_RELOAD_MATERIALS (1<<20) // If this cvar changes, it forces a material reload (OB+)
#define FCVAR_RELOAD_TEXTURES (1<<21) // If this cvar changes, if forces a texture reload (OB+)
#define FCVAR_NOT_CONNECTED (1<<22) // Cvar cannot be changed by a client that is connected to a server.
#define FCVAR_MATERIAL_SYSTEM_THREAD (1<<23) // Indicates this cvar is read from the material system thread (OB+)
#define FCVAR_ARCHIVE_XBOX (1<<24) // Cvar written to config.cfg on the Xbox.
#define FCVAR_ARCHIVE_GAMECONSOLE (1<<24) // Cvar written to config.cfg on the Xbox.
#define FCVAR_ACCESSIBLE_FROM_THREADS (1<<25) // used as a debugging tool necessary to check material system thread convars (OB+)
#define FCVAR_SERVER_CAN_EXECUTE (1<<28) // the server is allowed to execute this command on clients via
// ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd. (OB+)
#define FCVAR_SERVER_CANNOT_QUERY (1<<29) // If this is set, then the server is not allowed to query this cvar's value (via
// IServerPluginHelpers::StartQueryCvarValue).
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command.
// Note: IVEngineClient::ClientCmd_Unrestricted can run any client command.
/**
* @endsection
@ -97,9 +111,8 @@ enum ReplySource
*
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
*/
native ServerCommand(const String:format[], any:...);
native void ServerCommand(const char[] format, any ...);
/**
* Executes a server command as if it were on the server console (or RCON)
@ -114,25 +127,21 @@ native ServerCommand(const String:format[], any:...);
* @param maxlen Length of buffer.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
*/
native ServerCommandEx(String:buffer[], maxlen, const String:format[], any:...);
native void ServerCommandEx(char[] buffer, int maxlen, const char[] format, any ...);
/**
* Inserts a server command at the beginning of the server command buffer.
*
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
*/
native InsertServerCommand(const String:format[], any:...);
native void InsertServerCommand(const char[] format, any ...);
/**
* Executes every command in the server's command buffer, rather than once per frame.
*
* @noreturn
*/
native ServerExecute();
native void ServerExecute();
/**
* Executes a client command. Note that this will not work on clients unless
@ -141,10 +150,9 @@ native ServerExecute();
* @param client Index of the client.
* @param fmt Format of the client command.
* @param ... Format parameters
* @noreturn
* @error Invalid client index, or client not connected.
*/
native ClientCommand(client, const String:fmt[], any:...);
native void ClientCommand(int client, const char[] fmt, any ...);
/**
* Executes a client command on the server without being networked.
@ -158,10 +166,9 @@ native ClientCommand(client, const String:fmt[], any:...);
* @param client Index of the client.
* @param fmt Format of the client command.
* @param ... Format parameters
* @noreturn
* @error Invalid client index, or client not connected.
*/
native FakeClientCommand(client, const String:fmt[], any:...);
native void FakeClientCommand(int client, const char[] fmt, any ...);
/**
* Executes a client command on the server without being networked. The
@ -171,19 +178,27 @@ native FakeClientCommand(client, const String:fmt[], any:...);
* @param client Index of the client.
* @param fmt Format of the client command.
* @param ... Format parameters
* @noreturn
* @error Invalid client index, or client not connected.
*/
native FakeClientCommandEx(client, const String:fmt[], any:...);
native void FakeClientCommandEx(int client, const char[] fmt, any ...);
/**
* Executes a KeyValues client command on the server without being networked.
*
* @param client Index of the client.
* @param kv KeyValues data to be sent.
* @error Invalid client index, client not connected,
* or unsupported on current game.
*/
native void FakeClientCommandKeyValues(int client, KeyValues kv);
/**
* Sends a message to the server console.
*
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
*/
native PrintToServer(const String:format[], any:...);
native void PrintToServer(const char[] format, any ...);
/**
* Sends a message to a client's console.
@ -191,10 +206,9 @@ native PrintToServer(const String:format[], any:...);
* @param client Client index.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error If the client is not connected an error will be thrown.
*/
native PrintToConsole(client, const String:format[], any:...);
native void PrintToConsole(int client, const char[] format, any ...);
/**
* Reples to a message in a command.
@ -206,17 +220,16 @@ native PrintToConsole(client, const String:format[], any:...);
* @param client Client index, or 0 for server.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error If the client is not connected or invalid.
*/
native ReplyToCommand(client, const String:format[], any:...);
native void ReplyToCommand(int client, const char[] format, any ...);
/**
* Returns the current reply source of a command.
*
* @return ReplySource value.
*/
native ReplySource:GetCmdReplySource();
native ReplySource GetCmdReplySource();
/**
* Sets the current reply source of a command.
@ -227,7 +240,7 @@ native ReplySource:GetCmdReplySource();
* @param source New ReplySource value.
* @return Old ReplySource value.
*/
native ReplySource:SetCmdReplySource(ReplySource:source);
native ReplySource SetCmdReplySource(ReplySource source);
/**
* Returns whether the current say hook is a chat trigger.
@ -236,7 +249,7 @@ native ReplySource:SetCmdReplySource(ReplySource:source);
*
* @return True if a chat trigger, false otherwise.
*/
native bool:IsChatTrigger();
native bool IsChatTrigger();
/**
* Displays usage of an admin command to users depending on the
@ -248,10 +261,9 @@ native bool:IsChatTrigger();
* @param tag Tag to prepend to the message.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error
*/
native ShowActivity2(client, const String:tag[], const String:format[], any:...);
native void ShowActivity2(int client, const char[] tag, const char[] format, any ...);
/**
* Displays usage of an admin command to users depending on the
@ -265,10 +277,9 @@ native ShowActivity2(client, const String:tag[], const String:format[], any:...)
* @param client Client index doing the action, or 0 for server.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error
*/
native ShowActivity(client, const String:format[], any:...);
native void ShowActivity(int client, const char[] format, any ...);
/**
* Same as ShowActivity(), except the tag parameter is used instead of
@ -278,10 +289,9 @@ native ShowActivity(client, const String:format[], any:...);
* @param tag Tag to display with.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error
*/
native ShowActivityEx(client, const String:tag[], const String:format[], any:...);
native void ShowActivityEx(int client, const char[] tag, const char[] format, any ...);
/**
* Given an originating client and a target client, returns the string
@ -299,7 +309,7 @@ native ShowActivityEx(client, const String:tag[], const String:format[], any:...
* sm_show_activity filters.
* @error Invalid client index or client not connected.
*/
native FormatActivitySource(client, target, const String:namebuf[], maxlength);
native bool FormatActivitySource(int client, int target, const char[] namebuf, int maxlength);
/**
* Called when a server-only command is invoked.
@ -319,10 +329,9 @@ typedef SrvCmd = function Action (int args);
* @param callback A function to use as a callback for when the command is invoked.
* @param description Optional description to use for command creation.
* @param flags Optional flags to use for command creation.
* @noreturn
* @error Command name is the same as an existing convar.
*/
native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:description[]="", flags=0);
native void RegServerCmd(const char[] cmd, SrvCmd callback, const char[] description="", int flags=0);
/**
* Called when a generic console command is invoked.
@ -345,10 +354,9 @@ typedef ConCmd = function Action (int client, int args);
* @param callback A function to use as a callback for when the command is invoked.
* @param description Optional description to use for command creation.
* @param flags Optional flags to use for command creation.
* @noreturn
* @error Command name is the same as an existing convar.
*/
native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:description[]="", flags=0);
native void RegConsoleCmd(const char[] cmd, ConCmd callback, const char[] description="", int flags=0);
/**
* Creates a console command as an administrative command. If the command does not exist,
@ -364,15 +372,21 @@ native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:descripti
* @param group String containing the command group to use. If empty,
* the plugin's filename will be used instead.
* @param flags Optional console flags.
* @noreturn
* @error Command name is the same as an existing convar.
*/
native RegAdminCmd(const String:cmd[],
ConCmd:callback,
adminflags,
const String:description[]="",
const String:group[]="",
flags=0);
native void RegAdminCmd(const char[] cmd,
ConCmd callback,
int adminflags,
const char[] description="",
const char[] group="",
int flags=0);
/**
* Returns whether there is a command callback available.
*
* @return True if called from inside a command callback.
*/
native bool IsCommandCallback();
/**
* Returns the number of arguments from the current console or server command.
@ -380,7 +394,7 @@ native RegAdminCmd(const String:cmd[],
*
* @return Number of arguments to the current command.
*/
native GetCmdArgs();
native int GetCmdArgs();
/**
* Retrieves a command argument given its index, from the current console or
@ -392,7 +406,7 @@ native GetCmdArgs();
* @param maxlength Maximum length of the buffer.
* @return Length of string written to buffer.
*/
native GetCmdArg(argnum, String:buffer[], maxlength);
native int GetCmdArg(int argnum, char[] buffer, int maxlength);
/**
* Retrieves the entire command argument string in one lump from the current
@ -402,14 +416,14 @@ native GetCmdArg(argnum, String:buffer[], maxlength);
* @param maxlength Maximum length of the buffer.
* @return Length of string written to buffer.
*/
native GetCmdArgString(String:buffer[], maxlength);
native int GetCmdArgString(char[] buffer, int maxlength);
/**
* Gets a command iterator. Must be freed with CloseHandle().
*
* @return A new command iterator.
*/
native Handle:GetCommandIterator();
native Handle GetCommandIterator();
/**
* Reads a command iterator, then advances to the next command if any.
@ -423,12 +437,12 @@ native Handle:GetCommandIterator();
* @param descLen Command description buffer size.
* @return True on success, false if there are no more commands.
*/
native bool:ReadCommandIterator(Handle:iter,
String:name[],
nameLen,
&eflags=0,
String:desc[]="",
descLen=0);
native bool ReadCommandIterator(Handle iter,
char[] name,
int nameLen,
int &eflags=0,
char[] desc="",
int descLen=0);
/**
* Returns whether a client has access to a given command string. The string
@ -447,10 +461,10 @@ native bool:ReadCommandIterator(Handle:iter,
* there is a matching admin command.
* @return True if the client has access, false otherwise.
*/
native bool:CheckCommandAccess(client,
const String:command[],
flags,
bool:override_only=false);
native bool CheckCommandAccess(int client,
const char[] command,
int flags,
bool override_only=false);
/**
* Returns whether an admin has access to a given command string. The string
@ -469,10 +483,10 @@ native bool:CheckCommandAccess(client,
* there is a matching admin command.
* @return True if the admin has access, false otherwise.
*/
native bool:CheckAccess(AdminId:id,
const String:command[],
flags,
bool:override_only=false);
native bool CheckAccess(AdminId id,
const char[] command,
int flags,
bool override_only=false);
/**
* Returns the bitstring of flags of a command.
@ -481,7 +495,7 @@ native bool:CheckAccess(AdminId:id,
* @return A bitstring containing the FCVAR_* flags that are enabled
* or INVALID_FCVAR_FLAGS if command not found.
*/
native GetCommandFlags(const String:name[]);
native int GetCommandFlags(const char[] name);
/**
* Sets the bitstring of flags of a command.
@ -490,7 +504,7 @@ native GetCommandFlags(const String:name[]);
* @param flags A bitstring containing the FCVAR_* flags to enable.
* @return True on success, otherwise false.
*/
native bool:SetCommandFlags(const String:name[], flags);
native bool SetCommandFlags(const char[] name, int flags);
/**
* Starts a ConCommandBase search, traversing the list of ConVars and
@ -512,7 +526,7 @@ native bool:SetCommandFlags(const String:name[], flags);
* On failure, INVALID_HANDLE is returned, and the
* contents of outputs is undefined.
*/
native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0);
native Handle FindFirstConCommand(char[] buffer, int max_size, bool &isCommand, int &flags=0, char[] description="", int descrmax_size=0);
/**
* Reads the next entry in a ConCommandBase iterator.
@ -530,7 +544,7 @@ native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &f
* If no more entries exist, false is returned, and the
* contents of outputs is undefined.
*/
native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0);
native bool FindNextConCommand(Handle search, char[] buffer, int max_size, bool &isCommand, int &flags=0, char[] description="", int descrmax_size=0);
/**
* Adds an informational string to the server's public "tags".
@ -540,17 +554,15 @@ native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:i
* Note: Currently, this function does nothing because of bugs in the Valve master.
*
* @param tag Tag string to append.
* @noreturn
*/
native AddServerTag(const String:tag[]);
native void AddServerTag(const char[] tag);
/**
* Removes a tag previously added by the calling plugin.
*
* @param tag Tag string to remove.
* @noreturn
*/
native RemoveServerTag(const String:tag[]);
native void RemoveServerTag(const char[] tag);
/**
* Callback for command listeners. This is invoked whenever any command
@ -597,7 +609,7 @@ typedef CommandListener = function Action (int client, const char[] command, int
* @return True if this feature is available on the current game,
* false otherwise.
*/
native bool:AddCommandListener(CommandListener:callback, const String:command[]="");
native bool AddCommandListener(CommandListener callback, const char[] command="");
/**
* Removes a previously added command listener, in reverse order of being added.
@ -607,7 +619,7 @@ native bool:AddCommandListener(CommandListener:callback, const String:command[]=
* The command is case insensitive.
* @error Callback has no active listeners.
*/
native RemoveCommandListener(CommandListener:callback, const String:command[]="");
native void RemoveCommandListener(CommandListener callback, const char[] command="");
/**
* Returns true if the supplied command exists.
@ -615,7 +627,7 @@ native RemoveCommandListener(CommandListener:callback, const String:command[]=""
* @param command Command to find.
* @return True if command is found, false otherwise.
*/
stock bool:CommandExists(const String:command[])
stock bool CommandExists(const char[] command)
{
return (GetCommandFlags(command) != INVALID_FCVAR_FLAGS);
}
@ -629,7 +641,7 @@ stock bool:CommandExists(const String:command[])
* @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.
*/
forward Action:OnClientSayCommand(client, const String:command[], const String:sArgs[]);
forward Action OnClientSayCommand(int client, const char[] command, const char[] sArgs);
/**
* Global post listener for the chat commands.
@ -637,6 +649,5 @@ forward Action:OnClientSayCommand(client, const String:command[], const String:s
* @param client Client index.
* @param command Command name.
* @param sArgs Chat argument string.
*
*/
forward void OnClientSayCommand_Post(int client, const char[] command, const char[] sArgs);

View File

@ -30,6 +30,11 @@
* Version: $Id$
*/
#if defined _convars_included
#endinput
#endif
#define _convars_included
/**
* Console variable bound values used with Get/SetConVarBounds()
*/
@ -211,7 +216,7 @@ methodmap ConVar < Handle
//
// @param name Buffer to store the name of the convar.
// @param maxlength Maximum length of string buffer.
public native void GetName(char[] name, maxlength);
public native void GetName(char[] name, int maxlength);
// Replicates a convar value to a specific client. This does not change the actual convar value.
//
@ -400,7 +405,7 @@ native int GetConVarFlags(Handle convar);
* @param flags A bitstring containing the FCVAR_* flags to enable.
* @error Invalid or corrupt Handle.
*/
native void SetConVarFlags(Handle convar, flags);
native void SetConVarFlags(Handle convar, int flags);
/**
* Retrieves the specified bound of a console variable.
@ -432,7 +437,7 @@ native void SetConVarBounds(Handle convar, ConVarBounds type, bool set, float va
* @param maxlength Maximum length of string buffer.
* @error Invalid or corrupt Handle.
*/
native void GetConVarName(Handle convar, char[] name, maxlength);
native void GetConVarName(Handle convar, char[] name, int maxlength);
/**
* Replicates a convar value to a specific client. This does not change the actual convar value.

25
env/include/core.inc vendored
View File

@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet:
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
@ -69,7 +69,7 @@ enum Identity
Identity_Plugin = 2
};
public PlVers:__version =
public PlVers __version =
{
version = SOURCEMOD_PLUGINAPI_VERSION,
filevers = SOURCEMOD_VERSION,
@ -92,13 +92,14 @@ enum PluginStatus
Plugin_Created, /**< Plugin is created but not initialized */
Plugin_Uncompiled, /**< Plugin is not yet compiled by the JIT */
Plugin_BadLoad, /**< Plugin failed to load */
Plugin_Evicted /**< Plugin was unloaded due to an error */
};
/**
* Plugin information properties. Plugins can declare a global variable with
* their info. Example,
*
* public Plugin:myinfo = {
* public Plugin myinfo = {
* name = "Admin Help",
* author = "AlliedModders LLC",
* description = "Display command information",
@ -114,7 +115,7 @@ enum PluginInfo
PlInfo_Name, /**< Plugin name */
PlInfo_Author, /**< Plugin author */
PlInfo_Description, /**< Plugin description */
PlInfo_Version, /**< Plugin verison */
PlInfo_Version, /**< Plugin version */
PlInfo_URL, /**< Plugin URL */
};
@ -139,13 +140,13 @@ struct SharedPlugin
public bool required; /**< Whether or not to require */
};
public Float:NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
public const String:NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
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 */
/**
* Horrible compatibility shim.
*/
public Extension:__ext_core =
public Extension __ext_core =
{
name = "Core",
file = "core",
@ -153,7 +154,7 @@ public Extension:__ext_core =
required = 0,
};
native VerifyCoreVersion();
native int VerifyCoreVersion();
/**
* Sets a native as optional, such that if it is unloaded, removed,
@ -161,11 +162,10 @@ native VerifyCoreVersion();
* removed natives results in a run-time error.
*
* @param name Native name.
* @noreturn
*/
native MarkNativeAsOptional(const String:name[]);
native void MarkNativeAsOptional(const char[] name);
public __ext_core_SetNTVOptional()
public void __ext_core_SetNTVOptional()
{
MarkNativeAsOptional("GetFeatureStatus");
MarkNativeAsOptional("RequireFeature");
@ -292,6 +292,9 @@ public __ext_core_SetNTVOptional()
MarkNativeAsOptional("Protobuf.ReadRepeatedMessage");
MarkNativeAsOptional("Protobuf.AddMessage");
MarkNativeAsOptional("IsCommandCallback");
MarkNativeAsOptional("GetLastProcessTargetString");
VerifyCoreVersion();
}

View File

@ -51,8 +51,8 @@
enum CSRoundEndReason
{
CSRoundEnd_TargetBombed = 0, /**< Target Successfully Bombed! */
CSRoundEnd_VIPEscaped, /**< The VIP has escaped! */
CSRoundEnd_VIPKilled, /**< VIP has been assassinated! */
CSRoundEnd_VIPEscaped, /**< The VIP has escaped! - Doesn't exist on CS:GO */
CSRoundEnd_VIPKilled, /**< VIP has been assassinated! - Doesn't exist on CS:GO */
CSRoundEnd_TerroristsEscaped, /**< The terrorists have escaped! */
CSRoundEnd_CTStoppedEscape, /**< The CTs have prevented most of the terrorists from escaping! */
CSRoundEnd_TerroristsStopped, /**< Escaping terrorists have all been neutralized! */
@ -64,12 +64,14 @@ enum CSRoundEndReason
CSRoundEnd_TargetSaved, /**< Target has been saved! */
CSRoundEnd_HostagesNotRescued, /**< Hostages have not been rescued! */
CSRoundEnd_TerroristsNotEscaped, /**< Terrorists have not escaped! */
CSRoundEnd_VIPNotEscaped, /**< VIP has not escaped! */
CSRoundEnd_VIPNotEscaped, /**< VIP has not escaped! - Doesn't exist on CS:GO */
CSRoundEnd_GameStart, /**< Game Commencing! */
// The below only exist on CS:GO
CSRoundEnd_TerroristsSurrender, /**< Terrorists Surrender */
CSRoundEnd_CTSurrender, /**< CTs Surrender */
CSRoundEnd_TerroristsPlanted, /**< Terrorists Planted the bomb */
CSRoundEnd_CTsReachedHostage, /**< CTs Reached the hostage */
};
enum CSWeaponID
@ -139,17 +141,17 @@ enum CSWeaponID
* @param client Client index
* @param weapon User input for weapon name
*/
forward Action:CS_OnBuyCommand(client, const String:weapon[]);
forward Action CS_OnBuyCommand(int client, const char[] weapon);
/**
* Called when CSWeaponDrop is called
* Return Plugin_Continue to allow the call or return a
* higher action to deny.
* higher action to block.
*
* @param client Client index
* @param weaponIndex Weapon index
*/
forward Action:CS_OnCSWeaponDrop(client, weaponIndex);
forward Action CS_OnCSWeaponDrop(int client, int weaponIndex);
/**
* Called when game retrieves a weapon's price for a player.
@ -164,7 +166,7 @@ forward Action:CS_OnCSWeaponDrop(client, weaponIndex);
*
* @note Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision.
*/
forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price);
forward Action CS_OnGetWeaponPrice(int client, const char[] weapon, int &price);
/**
* Called when TerminateRound is called.
@ -175,26 +177,24 @@ forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price);
* @param delay Time (in seconds) until new round starts
* @param reason Reason for round end
*/
forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason);
forward Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason);
/**
* Respawns a player.
*
* @param client Player's index.
* @noreturn
* @error Invalid client index, client not in game.
*/
native CS_RespawnPlayer(client);
native void CS_RespawnPlayer(int client);
/**
* Switches the player's team.
*
* @param client Player's index.
* @param team Team index.
* @noreturn
* @error Invalid client index, client not in game.
*/
native CS_SwitchTeam(client, team);
native void CS_SwitchTeam(int client, int team);
/**
* Forces a player to drop or toss their weapon
@ -204,10 +204,9 @@ native CS_SwitchTeam(client, team);
* @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
*
* @noreturn
* @error Invalid client index, client not in game, or invalid weapon index.
*/
native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
native void CS_DropWeapon(int client, int weaponIndex, bool toss, bool blockhook = false);
/**
* Forces round to end with a reason
@ -216,9 +215,8 @@ native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
* @param reason Reason for the round ending
* @param blockhook Set to true to stop the corresponding CS_OnTerminateRound
* forward from being called.
* @noreturn
*/
native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = false);
native void CS_TerminateRound(float delay, CSRoundEndReason reason, bool blockhook = false);
/**
* Gets a weapon name from a weapon alias
@ -226,11 +224,10 @@ native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook =
* @param alias Weapons alias to get weapon name for.
* @param weapon Buffer to store weapons name
* @param size Size of buffer to store the weapons name.
* @noreturn
*
* @note Will set the buffer to the original alias if it is not an alias to a weapon.
*/
native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size);
native void CS_GetTranslatedWeaponAlias(const char[] alias, char[] weapon, int size);
/**
* Gets a weapon's price
@ -243,7 +240,7 @@ native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size);
* @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 CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false);
native int CS_GetWeaponPrice(int client, CSWeaponID id, bool defaultprice = false);
/**
* Gets a clients clan tag
@ -254,17 +251,16 @@ native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false);
*
* @error Invalid client.
*/
native CS_GetClientClanTag(client, String:buffer[], size);
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.
* @noreturn
*
* @error Invalid client.
*/
native CS_SetClientClanTag(client, const String:tag[]);
native void CS_SetClientClanTag(int client, const char[] tag);
/**
* Gets a team's score
@ -273,18 +269,17 @@ native CS_SetClientClanTag(client, const String:tag[]);
*
* @error Invalid team index.
*/
native CS_GetTeamScore(team);
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.
* @noreturn
*
* @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.
*/
native CS_SetTeamScore(team, value);
native void CS_SetTeamScore(int team, int value);
/**
* Gets a client's mvp count
@ -293,17 +288,16 @@ native CS_SetTeamScore(team, value);
*
* @error Invalid client.
*/
native CS_GetMVPCount(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.
* @noreturn
*
* @error Invalid client.
*/
native CS_SetMVPCount(client, value);
native void CS_SetMVPCount(int client, int value);
/**
* Gets a client's contribution score (CS:GO only)
@ -312,17 +306,16 @@ native CS_SetMVPCount(client, value);
*
* @error Invalid client.
*/
native CS_GetClientContributionScore(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.
* @noreturn
*
* @error Invalid client.
*/
native CS_SetClientContributionScore(client, value);
native void CS_SetClientContributionScore(int client, int value);
/**
* Gets a client's assists (CS:GO only)
@ -331,17 +324,16 @@ native CS_SetClientContributionScore(client, value);
*
* @error Invalid client.
*/
native CS_GetClientAssists(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.
* @noreturn
*
* @error Invalid client.
*/
native CS_SetClientAssists(client, value);
native void CS_SetClientAssists(int client, int value);
/**
* Gets a weaponID from a alias
@ -350,7 +342,7 @@ native CS_SetClientAssists(client, value);
*
* @note For best results use CS_GetTranslatedWeaponAlias on the weapon name before passing it.
*/
native CSWeaponID:CS_AliasToWeaponID(const String:alias[]);
native CSWeaponID CS_AliasToWeaponID(const char[] alias);
/**
* Gets a alias from a weaponID
@ -359,7 +351,7 @@ native CSWeaponID:CS_AliasToWeaponID(const String:alias[]);
* @param len Length of the destination array.
* @return Returns number of cells written.
*/
native CS_WeaponIDToAlias(CSWeaponID:weaponID, String:destination[], len);
native int CS_WeaponIDToAlias(CSWeaponID weaponID, char[] destination, int len);
/**
* Returns weather a WeaponID is valid on the current mod (css or csgo)
@ -368,21 +360,20 @@ native CS_WeaponIDToAlias(CSWeaponID:weaponID, String:destination[], len);
*
* @note This will return false always for CSWeapon_NONE
*/
native bool:CS_IsValidWeaponID(CSWeaponID:id);
native bool CS_IsValidWeaponID(CSWeaponID id);
/**
* Sets a player's model based on their current class
*
* @param client Player's index.
* @noreturn
* @error Invalid client index, client not in game.
*/
native CS_UpdateClientModel(client);
native void CS_UpdateClientModel(int client);
/**
* Do not edit below this line!
*/
public Extension:__ext_cstrike =
public Extension __ext_cstrike =
{
name = "cstrike",
file = "games/game.cstrike.ext",
@ -395,7 +386,7 @@ public Extension:__ext_cstrike =
};
#if !defined REQUIRE_EXTENSIONS
public __ext_cstrike_SetNTVOptional()
public void __ext_cstrike_SetNTVOptional()
{
MarkNativeAsOptional("CS_RespawnPlayer");
MarkNativeAsOptional("CS_SwitchTeam");
@ -419,4 +410,3 @@ public __ext_cstrike_SetNTVOptional()
MarkNativeAsOptional("CS_UpdateClientModel");
}
#endif

View File

@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
@ -35,6 +35,77 @@
#endif
#define _datapack_included
/**
* Opaque handle to a datapack position.
*/
enum DataPackPos: {};
// A DataPack allows serializing multiple variables into a single stream.
methodmap DataPack < Handle
{
// Creates a new data pack.
public native DataPack();
// Packs a normal cell into a data pack.
//
// @param cell Cell to add.
public native void WriteCell(any cell);
// Packs a float into a data pack.
//
// @param val Float to add.
public native void WriteFloat(float val);
// Packs a string into a data pack.
//
// @param str String to add.
public native void WriteString(const char[] str);
// Packs a function pointer into a data pack.
//
// @param fktptr Function pointer to add.
public native void WriteFunction(Function fktptr);
// Reads a cell from a data pack.
//
// @param pack Handle to the data pack.
public native any ReadCell();
// Reads a float from a data pack.
//
// @param pack Handle to the data pack.
public native float ReadFloat();
// Reads a string from a data pack.
//
// @param buffer Destination string buffer.
// @param maxlen Maximum length of output string buffer.
public native void ReadString(char[] buffer, int maxlen);
// Reads a function pointer from a data pack.
//
// @return Function pointer.
public native Function ReadFunction();
// Resets the position in a data pack.
//
// @param clear If true, clears the contained data.
public native void Reset(bool clear=false);
// 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();
// The read or write position in a data pack.
property DataPackPos Position {
public native get();
public native set(DataPackPos pos);
}
};
/**
* Creates a new data pack.
*
@ -47,7 +118,6 @@ native DataPack CreateDataPack();
*
* @param pack Handle to the data pack.
* @param cell Cell to add.
* @noreturn
* @error Invalid handle.
*/
native void WritePackCell(Handle pack, any cell);
@ -57,7 +127,6 @@ native void WritePackCell(Handle pack, any cell);
*
* @param pack Handle to the data pack.
* @param val Float to add.
* @noreturn
* @error Invalid handle.
*/
native void WritePackFloat(Handle pack, float val);
@ -67,7 +136,6 @@ native void WritePackFloat(Handle pack, float val);
*
* @param pack Handle to the data pack.
* @param str String to add.
* @noreturn
* @error Invalid handle.
*/
native void WritePackString(Handle pack, const char[] str);
@ -77,7 +145,6 @@ native void WritePackString(Handle pack, const char[] str);
*
* @param pack Handle to the data pack.
* @param fktptr Function pointer to add.
* @noreturn
* @error Invalid handle.
*/
native void WritePackFunction(Handle pack, Function fktptr);
@ -106,10 +173,9 @@ native float ReadPackFloat(Handle pack);
* @param pack Handle to the data pack.
* @param buffer Destination string buffer.
* @param maxlen Maximum length of output string buffer.
* @noreturn
* @error Invalid handle, or bounds error.
*/
native void ReadPackString(Handle pack, char[] buffer, maxlen);
native void ReadPackString(Handle pack, char[] buffer, int maxlen);
/**
* Reads a function pointer from a data pack.
@ -125,7 +191,6 @@ native Function ReadPackFunction(Handle pack);
*
* @param pack Handle to the data pack.
* @param clear If true, clears the contained data.
* @noreturn
* @error Invalid handle.
*/
native void ResetPack(Handle pack, bool clear=false);
@ -134,20 +199,19 @@ native void ResetPack(Handle pack, bool clear=false);
* Returns the read or write position in a data pack.
*
* @param pack Handle to the data pack.
* @return Numerical position in the data pack.
* @return Position in the data pack, only usable with calls to SetPackPosition.
* @error Invalid handle.
*/
native int GetPackPosition(Handle pack);
native DataPackPos GetPackPosition(Handle pack);
/**
* Sets the read/write position in a data pack.
*
* @param pack Handle to the data pack.
* @param position New position to set.
* @noreturn
* @param position New position to set. Must have been previously retrieved from a call to GetPackPosition.
* @error Invalid handle, or position is beyond the pack bounds.
*/
native void SetPackPosition(Handle pack, int position);
native void SetPackPosition(Handle pack, DataPackPos position);
/**
* Returns whether or not a specified number of bytes from the data pack
@ -159,24 +223,3 @@ native void SetPackPosition(Handle pack, int position);
* @error Invalid handle.
*/
native bool IsPackReadable(Handle pack, int bytes);
methodmap DataPack < Handle
{
public DataPack() = CreateDataPack;
public WriteCell() = WritePackCell;
public WriteFloat() = WritePackFloat;
public WriteString() = WritePackString;
public WriteFunction() = WritePackFunction;
public ReadCell() = ReadPackCell;
public ReadFloat() = ReadPackFloat;
public ReadString() = ReadPackString;
public ReadFunction() = ReadPackFunction;
public Reset() = ResetPack;
public IsReadable() = IsPackReadable;
property int Position {
public get() = GetPackPosition;
public set() = SetPackPosition;
}
};

95
env/include/dbi.inc vendored
View File

@ -223,7 +223,7 @@ methodmap DBResultSet < Handle
// @param field The field index (starting from 0).
// @return True if data is NULL, false otherwise.
// @error Invalid field index, or no current result set.
public native bool IsFieldNull(Handle query, int field);
public native bool IsFieldNull(int field);
// Returns the length of a field's data in the current row of a result
// set. This only needs to be called for strings to determine how many
@ -236,14 +236,26 @@ methodmap DBResultSet < Handle
public native int FetchSize(int field);
};
// Callback for a successful transaction.
//
// @param db Database handle.
// @param data Data value passed to SQL_ExecuteTransaction().
// @param numQueries Number of queries executed in the transaction.
// @param results An array of Query handle results, one for each of numQueries. They are closed automatically.
// @param queryData An array of each data value passed to SQL_AddQuery().
typedef SQLTxnSuccess = function void (Database db, any data, int numQueries, Handle[] results, any[] queryData);
typeset SQLTxnSuccess
{
// Callback for a successful transaction.
//
// @param db Database handle.
// @param data Data value passed to SQL_ExecuteTransaction().
// @param numQueries Number of queries executed in the transaction.
// @param results An array of Query handle results, one for each of numQueries. They are closed automatically.
// @param queryData An array of each data value passed to SQL_AddQuery().
function void (Database db, any data, int numQueries, Handle[] results, any[] queryData);
// Callback for a successful transaction.
//
// @param db Database handle.
// @param data Data value passed to SQL_ExecuteTransaction().
// @param numQueries Number of queries executed in the transaction.
// @param results An array of DBResultSet results, one for each of numQueries. They are closed automatically.
// @param queryData An array of each data value passed to SQL_AddQuery().
function void (Database db, any data, int numQueries, DBResultSet[] results, any[] queryData);
}
// Callback for a failed transaction.
//
@ -376,7 +388,7 @@ methodmap Database < Handle
//
// The database handle returned through the callback is always a new Handle,
// and if necessary, IsSameConnection() should be used to test against other
// conenctions.
// connections.
//
// The result handle returned through the callback is temporary and destroyed
// at the end of the callback.
@ -399,8 +411,8 @@ methodmap Database < Handle
// @param data An optional value to pass to callbacks.
// @param prio Priority queue to use.
public native void Execute(Transaction txn,
SQLTxnSuccess:onSuccess = INVALID_FUNCTION,
SQLTxnFailure:onError = INVALID_FUNCTION,
SQLTxnSuccess onSuccess = INVALID_FUNCTION,
SQLTxnFailure onError = INVALID_FUNCTION,
any data = 0,
DBPriority priority = DBPrio_Normal);
};
@ -436,7 +448,7 @@ stock Database SQL_DefConnect(char[] error, int maxlength, bool persistent=true)
* Connects to a database using key value pairs containing the database info.
* The key/value pairs should match what would be in databases.cfg.
*
* I.e. "driver" should be "default" or a driver name (or ommitted for
* I.e. "driver" should be "default" or a driver name (or omitted for
* the default). For SQLite, only the "database" parameter is needed in addition.
* For drivers which require external connections, more of the parameters may be
* needed.
@ -455,7 +467,7 @@ stock Database SQL_DefConnect(char[] error, int maxlength, bool persistent=true)
*/
native Database SQL_ConnectCustom(Handle keyvalues,
char[] error,
maxlength,
int maxlength,
bool persistent);
/**
@ -475,17 +487,15 @@ native Database SQL_ConnectCustom(Handle keyvalues,
*/
stock Database SQLite_UseDatabase(const char[] database,
char[] error,
maxlength)
int maxlength)
{
Handle kv, db;
KeyValues kv = new KeyValues("");
kv.SetString("driver", "sqlite");
kv.SetString("database", database);
kv = CreateKeyValues("");
KvSetString(kv, "driver", "sqlite");
KvSetString(kv, "database", database);
Database db = SQL_ConnectCustom(kv, error, maxlength, false);
db = SQL_ConnectCustom(kv, error, maxlength, false);
CloseHandle(kv);
delete kv;
return db;
}
@ -495,15 +505,15 @@ stock Database SQLite_UseDatabase(const char[] database,
*/
#pragma deprecated Use SQL_ConnectCustom instead.
native Handle SQL_ConnectEx(Handle driver,
const String:host[],
const String:user[],
const String:pass[],
const String:database[],
const char[] host,
const char[] user,
const char[] pass,
const char[] database,
char[] error,
maxlength,
int maxlength,
bool persistent=true,
port=0,
maxTimeout=0);
int port=0,
int maxTimeout=0);
/**
* Returns if a named configuration is present in databases.cfg.
@ -533,7 +543,7 @@ native Handle SQL_GetDriver(const char[] name="");
* @param ident_length Maximum length of the buffer.
* @return Driver Handle.
*/
native Handle SQL_ReadDriver(Handle database, char[] ident="", ident_length=0);
native Handle SQL_ReadDriver(Handle database, char[] ident="", int ident_length=0);
/**
* Retrieves a driver's identification string.
@ -543,7 +553,6 @@ native Handle SQL_ReadDriver(Handle database, char[] ident="", ident_length=0);
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
* @param ident Identification string buffer.
* @param maxlength Maximum length of the buffer.
* @noreturn
* @error Invalid Handle other than INVALID_HANDLE.
*/
native void SQL_GetDriverIdent(Handle driver, char[] ident, int maxlength);
@ -556,7 +565,6 @@ native void SQL_GetDriverIdent(Handle driver, char[] ident, int maxlength);
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
* @param product Product string buffer.
* @param maxlength Maximum length of the buffer.
* @noreturn
* @error Invalid Handle other than INVALID_HANDLE.
*/
native void SQL_GetDriverProduct(Handle driver, char[] product, int maxlength);
@ -638,8 +646,8 @@ native bool SQL_EscapeString(Handle database,
stock bool SQL_QuoteString(Handle database,
const char[] string,
char[] buffer,
maxlength,
&written=0)
int maxlength,
int &written=0)
{
return SQL_EscapeString(database, string, buffer, maxlength, written);
}
@ -744,7 +752,7 @@ native int SQL_GetFieldCount(Handle query);
* @error Invalid query Handle, invalid field index, or
* no current result set.
*/
native void SQL_FieldNumToName(Handle query, int field, String:name[], int maxlength);
native void SQL_FieldNumToName(Handle query, int field, char[] name, int maxlength);
/**
* Retrieves a field index by name.
@ -755,7 +763,7 @@ native void SQL_FieldNumToName(Handle query, int field, String:name[], int maxle
* @return True if found, false if not found.
* @error Invalid query Handle or no current result set.
*/
native bool SQL_FieldNameToNum(Handle query, const char[] name, &field);
native bool SQL_FieldNameToNum(Handle query, const char[] name, int &field);
/**
* Fetches a row from the current result set. This must be
@ -803,7 +811,7 @@ native bool SQL_Rewind(Handle query);
* type conversion requested from the database,
* or no current result set.
*/
native int SQL_FetchString(Handle query, int field, char[] buffer, int maxlength, DBResult &result=DBVal_Error);
native int SQL_FetchString(Handle query, int field, char[] buffer, int maxlength, DBResult &result=DBVal_Error);
/**
* Fetches a float from a field in the current row of a result set.
@ -979,7 +987,7 @@ native void SQL_TConnect(SQLTCallback callback, const char[] name="default", any
*
* The database Handle returned through the callback is always a new Handle,
* and if necessary, SQL_IsSameConnection() should be used to test against
* other conenctions.
* other connections.
*
* The query Handle returned through the callback is temporary and destroyed
* at the end of the callback. If you need to hold onto it, use CloneHandle().
@ -1024,13 +1032,12 @@ native int SQL_AddQuery(Transaction txn, const char[] query, any data=0);
* @param onError An optional callback to receive an error message.
* @param data An optional value to pass to callbacks.
* @param prio Priority queue to use.
* @noreturn
* @error An invalid handle.
*/
native SQL_ExecuteTransaction(
native void SQL_ExecuteTransaction(
Handle db,
Transaction:txn,
SQLTxnSuccess:onSuccess = INVALID_FUNCTION,
SQLTxnFailure:onError = INVALID_FUNCTION,
Transaction txn,
SQLTxnSuccess onSuccess = INVALID_FUNCTION,
SQLTxnFailure onError = INVALID_FUNCTION,
any data=0,
DBPriority:priority=DBPrio_Normal);
DBPriority priority=DBPrio_Normal);

202
env/include/entity.inc vendored
View File

@ -79,27 +79,35 @@ enum PropFieldType
*/
/**
* Returns the maximum number of entities.
* Returns the maximum number of networked entities.
*
* @return Maximum number of entities.
* Note: For legacy reasons, this only returns the maximum
* networked entities (maximum edicts), rather than total
* maximum entities.
*
* @return Maximum number of networked entities.
*/
native GetMaxEntities();
native int GetMaxEntities();
/**
* Returns the number of entities in the server.
* Returns the number of networked entities in the server.
*
* Note: For legacy reasons, this only returns the current count
* of networked entities (current edicts), rather than total
* count of current entities.
*
* @return Number of entities in the server.
*/
native GetEntityCount();
native int GetEntityCount();
/**
* Returns whether or not an entity is valid. Returns false
* if there is no matching CBaseEntity for this edict index.
* if there is no matching CBaseEntity for this entity index.
*
* @param edict Index of the entity/edict.
* @param entity Index of the entity.
* @return True if valid, false otherwise.
*/
native bool:IsValidEntity(edict);
native bool IsValidEntity(int entity);
/**
* Returns whether or not an edict index is valid.
@ -107,31 +115,30 @@ native bool:IsValidEntity(edict);
* @param edict Index of the edict.
* @return True if valid, false otherwise.
*/
native bool:IsValidEdict(edict);
native bool IsValidEdict(int edict);
/**
* Returns whether or not an entity is a valid networkable edict.
* Returns whether or not an entity has a valid networkable edict.
*
* @param edict Index of the edict.
* @param edict Index of the entity.
* @return True if networkable, false if invalid or not networkable.
*/
native bool:IsEntNetworkable(edict);
native bool IsEntNetworkable(int entiy);
/**
* Creates a new edict (the basis of a networkable entity)
*
* @return Index of the edict, 0 on failure.
*/
native CreateEdict();
native int CreateEdict();
/**
* Removes an edict from the world.
*
* @param edict Index of the edict.
* @noreturn
* @error Invalid edict index.
*/
native RemoveEdict(edict);
native void RemoveEdict(int edict);
/**
* Returns the flags on an edict. These are not the same as entity flags.
@ -140,17 +147,16 @@ native RemoveEdict(edict);
* @return Edict flags.
* @error Invalid edict index.
*/
native GetEdictFlags(edict);
native int GetEdictFlags(int edict);
/**
* Sets the flags on an edict. These are not the same as entity flags.
*
* @param edict Index of the entity.
* @param flags Flags to set.
* @noreturn
* @error Invalid edict index.
*/
native SetEdictFlags(edict, flags);
native void SetEdictFlags(int edict, int flags);
/**
* Retrieves an edict classname.
@ -160,7 +166,7 @@ native SetEdictFlags(edict, flags);
* @param maxlength Maximum length of the buffer.
* @return True on success, false if there is no classname set.
*/
native bool:GetEdictClassname(edict, String:clsname[], maxlength);
native bool GetEdictClassname(int edict, char[] clsname, int maxlength);
/**
* Retrieves an entity's networkable serverclass name.
@ -168,11 +174,11 @@ native bool:GetEdictClassname(edict, String:clsname[], maxlength);
*
* @param edict Index of the entity.
* @param clsname Buffer to store the serverclass name.
* @param maxlength Maximum lnegth of the buffer.
* @param maxlength Maximum length of the buffer.
* @return True on success, false if the edict is not networkable.
* @error Invalid edict index.
*/
native bool:GetEntityNetClass(edict, String:clsname[], maxlength);
native bool GetEntityNetClass(int edict, char[] clsname, int maxlength);
/**
* @section Entity offset functions
@ -192,7 +198,7 @@ native bool:GetEntityNetClass(edict, String:clsname[], maxlength);
* below 32768. Offsets out of these bounds will throw an error. However,
* this does not represent any real range, it is simply a sanity check for
* illegal values. Any range outside of the CBaseEntity structure's private
* size will cause undefined behaviour or even crash.
* size will cause undefined behavior or even crash.
*/
/**
@ -203,10 +209,9 @@ native bool:GetEntityNetClass(edict, String:clsname[], maxlength);
* @param edict Index to the edict.
* @param offset Offset to mark as changed. If 0,
* the entire edict is marked as changed.
* @noreturn
* @error Invalid entity or offset out of bounds.
*/
native ChangeEdictState(edict, offset = 0);
native void ChangeEdictState(int edict, int offset = 0);
/**
* Peeks into an entity's object data and retrieves the integer value at
@ -218,7 +223,7 @@ native ChangeEdictState(edict, offset = 0);
* @return Value at the given memory location.
* @error Invalid entity or offset out of reasonable bounds.
*/
native GetEntData(entity, offset, size=4);
native int GetEntData(int entity, int offset, int size=4);
/**
* Peeks into an entity's object data and sets the integer value at
@ -229,11 +234,9 @@ native GetEntData(entity, offset, size=4);
* @param value Value to set.
* @param size Number of bytes to write (valid values are 1, 2, or 4).
* @param changeState If true, change will be sent over the network.
* @return Value at the given memory location.
* @error Invalid entity or offset out of reasonable bounds.
* @noreturn
*/
native SetEntData(entity, offset, any:value, size=4, bool:changeState=false);
native void SetEntData(int entity, int offset, any value, int size=4, bool changeState=false);
/**
* Peeks into an entity's object data and retrieves the float value at
@ -244,7 +247,7 @@ native SetEntData(entity, offset, any:value, size=4, bool:changeState=false);
* @return Value at the given memory location.
* @error Invalid entity or offset out of reasonable bounds.
*/
native Float:GetEntDataFloat(entity, offset);
native float GetEntDataFloat(int entity, int offset);
/**
* Peeks into an entity's object data and sets the float value at
@ -254,11 +257,9 @@ native Float:GetEntDataFloat(entity, offset);
* @param offset Offset to use.
* @param value Value to set.
* @param changeState If true, change will be sent over the network.
* @return Value at the given memory location.
* @error Invalid entity or offset out of reasonable bounds.
* @noreturn
*/
native SetEntDataFloat(entity, offset, Float:value, bool:changeState=false);
native void SetEntDataFloat(int entity, int offset, float value, bool changeState=false);
/**
* This function is deprecated. Use GetEntDataEnt2 instead, for
@ -276,7 +277,7 @@ native SetEntDataFloat(entity, offset, Float:value, bool:changeState=false);
* @error Invalid entity or offset out of reasonable bounds.
*/
#pragma deprecated Use GetEntDataEnt2() instead.
native GetEntDataEnt(entity, offset);
native int GetEntDataEnt(int entity, int offset);
/**
* This function is deprecated. Use SetEntDataEnt2 instead, for
@ -290,11 +291,10 @@ native GetEntDataEnt(entity, offset);
* @param offset Offset to use.
* @param other Entity index to set, or 0 to clear.
* @param changeState If true, change will be sent over the network.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
#pragma deprecated Use SetEntDataEnt2() instead.
native SetEntDataEnt(entity, offset, other, bool:changeState=false);
native void SetEntDataEnt(int entity, int offset, int other, bool changeState=false);
/**
* Peeks into an entity's object data and retrieves the entity index
@ -310,7 +310,7 @@ native SetEntDataEnt(entity, offset, other, bool:changeState=false);
* or the stored entity is invalid, then -1 is returned.
* @error Invalid input entity, or offset out of reasonable bounds.
*/
native GetEntDataEnt2(entity, offset);
native int GetEntDataEnt2(int entity, int offset);
/**
* Peeks into an entity's object data and sets the entity index at the
@ -324,10 +324,9 @@ native GetEntDataEnt2(entity, offset);
* @param offset Offset to use.
* @param other Entity index to set, or -1 to clear.
* @param changeState If true, change will be sent over the network.
* @noreturn
* @error Invalid input entity, or offset out of reasonable bounds.
*/
native SetEntDataEnt2(entity, offset, other, bool:changeState=false);
native void SetEntDataEnt2(int entity, int offset, int other, bool changeState=false);
/**
* Peeks into an entity's object data and retrieves the vector at the
@ -338,10 +337,9 @@ native SetEntDataEnt2(entity, offset, other, bool:changeState=false);
* @param entity Edict index.
* @param offset Offset to use.
* @param vec Vector buffer to store data in.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
native GetEntDataVector(entity, offset, Float:vec[3]);
native void GetEntDataVector(int entity, int offset, float vec[3]);
/**
* Peeks into an entity's object data and sets the vector at the given
@ -353,10 +351,9 @@ native GetEntDataVector(entity, offset, Float:vec[3]);
* @param offset Offset to use.
* @param vec Vector to set.
* @param changeState If true, change will be sent over the network.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
native SetEntDataVector(entity, offset, const Float:vec[3], bool:changeState=false);
native void SetEntDataVector(int entity, int offset, const float vec[3], bool changeState=false);
/**
* Peeks into an entity's object data and retrieves the string at
@ -369,7 +366,7 @@ native SetEntDataVector(entity, offset, const Float:vec[3], bool:changeState=fal
* @return Number of non-null bytes written.
* @error Invalid entity or offset out of reasonable bounds.
*/
native GetEntDataString(entity, offset, String:buffer[], maxlen);
native int GetEntDataString(int entity, int offset, char[] buffer, int maxlen);
/**
* Peeks into an entity's object data and sets the string at
@ -383,7 +380,7 @@ native GetEntDataString(entity, offset, String:buffer[], maxlen);
* @return Number of non-null bytes written.
* @error Invalid entity or offset out of reasonable bounds.
*/
native SetEntDataString(entity, offset, const String:buffer[], maxlen, bool:changeState=false);
native int SetEntDataString(int entity, int offset, const char[] buffer, int maxlen, bool changeState=false);
/**
* @endsection
@ -403,17 +400,13 @@ native SetEntDataString(entity, offset, const String:buffer[], maxlen, bool:chan
* @param prop Property name.
* @return An offset, or -1 on failure.
*/
native FindSendPropOffs(const String:cls[], const String:prop[]);
#pragma deprecated Use FindSendPropInfo instead, or HasEntProp if you just want to check for existence.
native int FindSendPropOffs(const char[] cls, const char[] prop);
/**
* Given a ServerClass name, finds a networkable send property offset.
* This information is cached for future calls.
*
* Note: This function will correctly compute nested offsets, unlike
* FindSendPropOffs(). YOU SHOULD NOT use this function to self-compute
* nested offsets. For example, it is okay to add indexes for arrays,
* but not to add DT_LocalPlayer to m_nDisguiseClass.
*
* @param cls Classname.
* @param prop Property name.
* @param type Optional parameter to store the type.
@ -427,11 +420,11 @@ native FindSendPropOffs(const String:cls[], const String:prop[]);
* If no offset is available, 0 is returned.
* If the property is not found, -1 is returned.
*/
native FindSendPropInfo(const String:cls[],
const String:prop[],
&PropFieldType:type=PropFieldType:0,
&num_bits=0,
&local_offset=0);
native int FindSendPropInfo(const char[] cls,
const char[] prop,
PropFieldType &type=view_as<PropFieldType>(0),
int &num_bits=0,
int &local_offset=0);
/**
* Given an entity, finds a datamap property offset.
@ -445,10 +438,11 @@ native FindSendPropInfo(const String:cls[],
* divisible by 8 (including 0 if unknown).
* @return An offset, or -1 on failure.
*/
native FindDataMapOffs(entity,
const String:prop[],
&PropFieldType:type=PropFieldType:0,
&num_bits=0);
#pragma deprecated Use FindDataMapInfo instead, or HasEntProp if you just want to check for existence.
native int FindDataMapOffs(int entity,
const char[] prop,
PropFieldType &type=view_as<PropFieldType>(0),
int &num_bits=0);
/**
* Given an entity, finds a nested datamap property offset.
@ -464,11 +458,11 @@ native FindDataMapOffs(entity,
* FindDataMapOffs() would return.
* @return An offset, or -1 on failure.
*/
native FindDataMapInfo(entity,
const String:prop[],
&PropFieldType:type=PropFieldType:0,
&num_bits=0,
&local_offset=0);
native int FindDataMapInfo(int entity,
const char[] prop,
PropFieldType &type=view_as<PropFieldType>(0),
int &num_bits=0,
int &local_offset=0);
/**
* Wrapper function for finding a send property for a particular entity.
@ -480,23 +474,51 @@ native FindDataMapInfo(entity,
* is used instead.
* @return An offset, or -1 on failure.
*/
stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false)
stock int GetEntSendPropOffs(int ent, const char[] prop, bool actual=false)
{
decl String:cls[64];
char cls[64];
if (!GetEntityNetClass(ent, cls, sizeof(cls)))
{
return -1;
}
int local = -1;
int offset = FindSendPropInfo(cls, prop, _, _, local);
if (actual)
{
return FindSendPropInfo(cls, prop);
return offset;
} else {
return local;
}
else
{
return FindSendPropOffs(cls, prop);
}
/**
* Checks if an entity property exists on an entity.
*
* @param entity Entity/edict index.
* @param type Property type.
* @param prop Property name.
* @return Whether the property exists on the entity.
* @error Invalid entity.
*/
stock bool HasEntProp(int entity, PropType type, const char[] prop)
{
if (type == Prop_Data) {
return (FindDataMapInfo(entity, prop) != -1);
}
if (type != Prop_Send) {
return false;
}
char cls[64];
if (!GetEntityNetClass(entity, cls, sizeof(cls))) {
return false;
}
return (FindSendPropInfo(cls, prop) != -1);
}
/**
@ -515,7 +537,7 @@ stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false)
* @return Value at the given property offset.
* @error Invalid entity or property not found.
*/
native GetEntProp(entity, PropType:type, const String:prop[], size=4, element=0);
native int GetEntProp(int entity, PropType type, const char[] prop, int size=4, int element=0);
/**
* Sets an integer value in an entity's property.
@ -532,9 +554,8 @@ native GetEntProp(entity, PropType:type, const String:prop[], size=4, element=0)
* only used as a fallback in case detection fails.
* @param element Element # (starting from 0) if property is an array.
* @error Invalid entity or offset out of reasonable bounds.
* @noreturn
*/
native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4, element=0);
native void SetEntProp(int entity, PropType type, const char[] prop, any value, int size=4, int element=0);
/**
* Retrieves a float value from an entity's property.
@ -549,7 +570,7 @@ native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4,
* @return Value at the given property offset.
* @error Invalid entity or offset out of reasonable bounds.
*/
native Float:GetEntPropFloat(entity, PropType:type, const String:prop[], element=0);
native float GetEntPropFloat(int entity, PropType type, const char[] prop, int element=0);
/**
* Sets a float value in an entity's property.
@ -562,10 +583,9 @@ native Float:GetEntPropFloat(entity, PropType:type, const String:prop[], element
* @param prop Property name.
* @param value Value to set.
* @param element Element # (starting from 0) if property is an array.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value, element=0);
native void SetEntPropFloat(int entity, PropType type, const char[] prop, float value, int element=0);
/**
* Retrieves an entity index from an entity's property.
@ -582,7 +602,7 @@ native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value,
* then -1 is returned.
* @error Invalid entity or offset out of reasonable bounds.
*/
native GetEntPropEnt(entity, PropType:type, const String:prop[], element=0);
native int GetEntPropEnt(int entity, PropType type, const char[] prop, int element=0);
/**
* Sets an entity index in an entity's property.
@ -595,10 +615,9 @@ native GetEntPropEnt(entity, PropType:type, const String:prop[], element=0);
* @param prop Property name.
* @param other Entity index to set, or -1 to unset.
* @param element Element # (starting from 0) if property is an array.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
native SetEntPropEnt(entity, PropType:type, const String:prop[], other, element=0);
native void SetEntPropEnt(int entity, PropType type, const char[] prop, int other, int element=0);
/**
* Retrieves a vector of floats from an entity, given a named network property.
@ -611,11 +630,10 @@ native SetEntPropEnt(entity, PropType:type, const String:prop[], other, element=
* @param prop Property name.
* @param vec Vector buffer to store data in.
* @param element Element # (starting from 0) if property is an array.
* @noreturn
* @error Invalid entity, property not found, or property not
* actually a vector data type.
*/
native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3], element=0);
native void GetEntPropVector(int entity, PropType type, const char[] prop, float vec[3], int element=0);
/**
* Sets a vector of floats in an entity, given a named network property.
@ -628,11 +646,10 @@ native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3]
* @param prop Property name.
* @param vec Vector to set.
* @param element Element # (starting from 0) if property is an array.
* @noreturn
* @error Invalid entity, property not found, or property not
* actually a vector data type.
*/
native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:vec[3], element=0);
native void SetEntPropVector(int entity, PropType type, const char[] prop, const float vec[3], int element=0);
/**
* Gets a network property as a string.
@ -646,22 +663,20 @@ native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:
* @return Number of non-null bytes written.
* @error Invalid entity, offset out of reasonable bounds, or property is not a valid string.
*/
native GetEntPropString(entity, PropType:type, const String:prop[], String:buffer[], maxlen, element=0);
native int GetEntPropString(int entity, PropType type, const char[] prop, char[] buffer, int maxlen, int element=0);
/**
* Sets a network property as a string.
*
* This cannot set property fields of type PropField_String_T (such as "m_target").
* To set such fields, you should use DispatchKeyValue() from SDKTools.
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @param buffer String to set.
* @param element Element # (starting from 0) if property is an array.
* @return Number of non-null bytes written.
* @error Invalid entity, offset out of reasonable bounds, or property is not a valid string.
*/
native SetEntPropString(entity, PropType:type, const String:prop[], const String:buffer[]);
native int SetEntPropString(int entity, PropType type, const char[] prop, const char[] buffer, int element=0);
/**
* Retrieves the count of values that an entity property's array can store.
@ -672,7 +687,7 @@ native SetEntPropString(entity, PropType:type, const String:prop[], const String
* @return Size of array (in elements) or 1 if property is not an array.
* @error Invalid entity or property not found.
*/
native GetEntPropArraySize(entity, PropType:type, const String:prop[]);
native int GetEntPropArraySize(int entity, PropType type, const char[] prop);
/**
* Copies an array of cells from an entity at a given offset.
@ -699,12 +714,11 @@ stock void GetEntDataArray(int entity, int offset, int[] array, int arraySize, i
* @param arraySize Number of values to copy.
* @param dataSize Size of each value in bytes (1, 2, or 4).
* @param changeState True to set the network state as changed; false otherwise.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
stock SetEntDataArray(entity, offset, const array[], arraySize, dataSize=4, bool:changeState=false)
stock void SetEntDataArray(int entity, int offset, const int[] array, int arraySize, int dataSize=4, bool changeState=false)
{
for (new i=0; i<arraySize; i++)
for (int i=0; i<arraySize; i++)
{
SetEntData(entity, offset + i*dataSize, array[i], dataSize, changeState);
}
@ -717,7 +731,7 @@ stock SetEntDataArray(entity, offset, const array[], arraySize, dataSize=4, bool
* @return Address of the entity.
* @error Invalid entity.
*/
native Address:GetEntityAddress(entity);
native Address GetEntityAddress(int entity);
/**
* Retrieves the classname of an entity.
@ -729,7 +743,7 @@ native Address:GetEntityAddress(entity);
* @param maxlength Maximum length of the buffer.
* @return True on success, false if there is no classname set.
*/
stock bool:GetEntityClassname(entity, String:clsname[], maxlength)
stock bool GetEntityClassname(int entity, char[] clsname, int maxlength)
{
return !!GetEntPropString(entity, Prop_Data, "m_iClassname", clsname, maxlength);
}

View File

@ -176,7 +176,7 @@ enum RenderFx
* @return Entity's flags, see entity flag defines above.
* @error Invalid entity index, or lack of mod compliance.
*/
native GetEntityFlags(entity);
native int GetEntityFlags(int entity);
/**
* Sets an entity's flags.
@ -187,10 +187,9 @@ native GetEntityFlags(entity);
*
* @param entity Entity index.
* @param flags Entity flags, see entity flag defines above.
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
native SetEntityFlags(entity, flags);
native void SetEntityFlags(int entity, int flags);
/**
@ -200,15 +199,15 @@ native SetEntityFlags(entity, flags);
* @return Movetype, see enum above.
* @error Invalid entity index, or lack of mod compliance.
*/
stock MoveType:GetEntityMoveType(entity)
stock MoveType GetEntityMoveType(int entity)
{
static bool:gotconfig = false;
static String:datamap[32];
static bool gotconfig = false;
static char datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
@ -219,7 +218,7 @@ stock MoveType:GetEntityMoveType(entity)
gotconfig = true;
}
return MoveType:GetEntProp(entity, Prop_Data, datamap);
return view_as<MoveType>(GetEntProp(entity, Prop_Data, datamap));
}
/**
@ -227,18 +226,17 @@ stock MoveType:GetEntityMoveType(entity)
*
* @param entity Entity index.
* @param mt Movetype, see enum above.
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
stock SetEntityMoveType(entity, MoveType:mt)
stock void SetEntityMoveType(int entity, MoveType mt)
{
static bool:gotconfig = false;
static String:datamap[32];
static bool gotconfig = false;
static char datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
@ -259,15 +257,15 @@ stock SetEntityMoveType(entity, MoveType:mt)
* @return RenderMode value.
* @error Invalid entity index, or lack of mod compliance.
*/
stock RenderMode:GetEntityRenderMode(entity)
stock RenderMode GetEntityRenderMode(int entity)
{
static bool:gotconfig = false;
static String:prop[32];
static bool gotconfig = false;
static char prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
@ -278,7 +276,7 @@ stock RenderMode:GetEntityRenderMode(entity)
gotconfig = true;
}
return RenderMode:GetEntProp(entity, Prop_Send, prop, 1);
return view_as<RenderMode>(GetEntProp(entity, Prop_Send, prop, 1));
}
/**
@ -286,18 +284,17 @@ stock RenderMode:GetEntityRenderMode(entity)
*
* @param entity Entity index.
* @param mode RenderMode value.
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
stock SetEntityRenderMode(entity, RenderMode:mode)
stock void SetEntityRenderMode(int entity, RenderMode mode)
{
static bool:gotconfig = false;
static String:prop[32];
static bool gotconfig = false;
static char prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
@ -318,15 +315,15 @@ stock SetEntityRenderMode(entity, RenderMode:mode)
* @return RenderFx value.
* @error Invalid entity index, or lack of mod compliance.
*/
stock RenderFx:GetEntityRenderFx(entity)
stock RenderFx GetEntityRenderFx(int entity)
{
static bool:gotconfig = false;
static String:prop[32];
static bool gotconfig = false;
static char prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
@ -337,7 +334,7 @@ stock RenderFx:GetEntityRenderFx(entity)
gotconfig = true;
}
return RenderFx:GetEntProp(entity, Prop_Send, prop, 1);
return view_as<RenderFx>(GetEntProp(entity, Prop_Send, prop, 1));
}
/**
@ -345,18 +342,17 @@ stock RenderFx:GetEntityRenderFx(entity)
*
* @param entity Entity index.
* @param fx RenderFx value.
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
stock SetEntityRenderFx(entity, RenderFx:fx)
stock void SetEntityRenderFx(int entity, RenderFx fx)
{
static bool:gotconfig = false;
static String:prop[32];
static bool gotconfig = false;
static char prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
@ -371,25 +367,24 @@ stock SetEntityRenderFx(entity, RenderFx:fx)
}
/**
* Sets an entity's color.
* Gets an entity's color.
*
* @param entity Entity index
* @param entity Entity index.
* @param r Amount of red (0-255)
* @param g Amount of green (0-255)
* @param b Amount of blue (0-255)
* @param a Amount of alpha (0-255)
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255)
stock void GetEntityRenderColor(int entity, int &r, int &g, int &b, int &a)
{
static bool:gotconfig = false;
static String:prop[32];
static bool gotconfig = false;
static char prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
@ -400,7 +395,49 @@ stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255)
gotconfig = true;
}
new offset = GetEntSendPropOffs(entity, prop);
int offset = GetEntSendPropOffs(entity, prop);
if (offset <= 0)
{
ThrowError("GetEntityRenderColor not supported by this mod");
}
r = GetEntData(entity, offset, 1);
g = GetEntData(entity, offset + 1, 1);
b = GetEntData(entity, offset + 2, 1);
a = GetEntData(entity, offset + 3, 1);
}
/**
* Sets an entity's color.
*
* @param entity Entity index
* @param r Amount of red (0-255)
* @param g Amount of green (0-255)
* @param b Amount of blue (0-255)
* @param a Amount of alpha (0-255)
* @error Invalid entity index, or lack of mod compliance.
*/
stock void SetEntityRenderColor(int entity, int r=255, int g=255, int b=255, int a=255)
{
static bool gotconfig = false;
static char prop[32];
if (!gotconfig)
{
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_clrRender");
}
gotconfig = true;
}
int offset = GetEntSendPropOffs(entity, prop);
if (offset <= 0)
{
@ -420,15 +457,15 @@ stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255)
* @return Entity's m_flGravity value.
* @error Invalid entity index, or lack of mod compliance.
*/
stock Float:GetEntityGravity(entity)
stock float GetEntityGravity(int entity)
{
static bool:gotconfig = false;
static String:datamap[32];
static bool gotconfig = false;
static char datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
@ -447,18 +484,17 @@ stock Float:GetEntityGravity(entity)
*
* @param entity Entity index.
* @param amount Gravity to set (default = 1.0, half = 0.5, double = 2.0).
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
stock SetEntityGravity(entity, Float:amount)
stock void SetEntityGravity(int entity, float amount)
{
static bool:gotconfig = false;
static String:datamap[32];
static bool gotconfig = false;
static char datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
@ -477,18 +513,17 @@ stock SetEntityGravity(entity, Float:amount)
*
* @param entity Entity index.
* @param amount Health amount.
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
stock SetEntityHealth(entity, amount)
stock void SetEntityHealth(int entity, int amount)
{
static bool:gotconfig = false;
static String:prop[32];
static bool gotconfig = false;
static char prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_iHealth", prop, sizeof(prop));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_iHealth", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
@ -499,9 +534,9 @@ stock SetEntityHealth(entity, amount)
gotconfig = true;
}
decl String:cls[64];
new PropFieldType:type;
new offset;
char cls[64];
PropFieldType type;
int offset;
if (!GetEntityNetClass(entity, cls, sizeof(cls)))
{
@ -536,15 +571,15 @@ stock SetEntityHealth(entity, amount)
* @error Invalid client index, client not in game,
* or lack of mod compliance.
*/
stock GetClientButtons(client)
stock int GetClientButtons(int client)
{
static bool:gotconfig = false;
static String:datamap[32];
static bool gotconfig = false;
static char datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nButtons", datamap, sizeof(datamap));
Handle gc = LoadGameConfigFile("core.games");
bool exists = GameConfGetKeyValue(gc, "m_nButtons", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)

View File

@ -66,7 +66,6 @@ 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.
// @noreturn
///
function void (Event event, const char[] name, bool dontBroadcast);
};
@ -80,6 +79,13 @@ methodmap Event < Handle
// @param dontBroadcast Optional boolean that determines if event should be broadcast to clients.
public native void Fire(bool dontBroadcast=false);
// Fires a game event to only the specified client.
//
// Unlike Fire, this function DOES NOT close the event Handle.
//
// @param client Index of client to receive the event..
public native void FireToClient(int client);
// Cancels a previously created game event that has not been fired. This
// is necessary to avoid leaking memory when an event isn't fired.
public native void Cancel();
@ -88,7 +94,7 @@ methodmap Event < Handle
//
// @param key Name of event key.
// @param defValue Optional default value to use if the key is not found.
// @return The boolean value of the specfied event key.
// @return The boolean value of the specified event key.
public native bool GetBool(const char[] key, bool defValue=false);
// Sets the boolean value of a game event's key.
@ -101,7 +107,7 @@ methodmap Event < Handle
//
// @param key Name of event key.
// @param defValue Optional default value to use if the key is not found.
// @return The integer value of the specfied event key.
// @return The integer value of the specified event key.
public native int GetInt(const char[] key, int defValue=0);
// Sets the integer value of a game event's key.
@ -119,7 +125,7 @@ methodmap Event < Handle
//
// @param key Name of event key.
// @param defValue Optional default value to use if the key is not found.
// @return The floating point value of the specfied event key.
// @return The floating point value of the specified event key.
public native float GetFloat(const char[] key, float defValue=0.0);
// Sets the floating point value of a game event's key.
@ -163,7 +169,6 @@ methodmap Event < Handle
* @param name Name of event.
* @param callback An EventHook function pointer.
* @param mode Optional EventHookMode determining the type of hook.
* @noreturn
* @error Invalid event name or invalid callback function.
*/
native void HookEvent(const char[] name, EventHook callback, EventHookMode mode=EventHookMode_Post);
@ -185,7 +190,6 @@ native bool HookEventEx(const char[] name, EventHook callback, EventHookMode mod
* @param name Name of event.
* @param callback An EventHook function pointer.
* @param mode Optional EventHookMode determining the type of hook.
* @noreturn
* @error Invalid callback function or no active hook for specified event.
*/
native void UnhookEvent(const char[] name, EventHook callback, EventHookMode mode=EventHookMode_Post);
@ -211,7 +215,6 @@ native Event CreateEvent(const char[] name, bool force=false);
*
* @param event Handle to the event.
* @param dontBroadcast Optional boolean that determines if event should be broadcast to clients.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void FireEvent(Handle event, bool dontBroadcast=false);
@ -220,7 +223,6 @@ native void FireEvent(Handle event, bool dontBroadcast=false);
* Cancels a previously created game event that has not been fired.
*
* @param event Handled to the event.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void CancelCreatedEvent(Handle event);
@ -231,7 +233,7 @@ native void CancelCreatedEvent(Handle event);
* @param event Handle to the event.
* @param key Name of event key.
* @param defValue Optional default value to use if the key is not found.
* @return The boolean value of the specfied event key.
* @return The boolean value of the specified event key.
* @error Invalid or corrupt Handle.
*/
native bool GetEventBool(Handle event, const char[] key, bool defValue=false);
@ -242,7 +244,6 @@ native bool GetEventBool(Handle event, const char[] key, bool defValue=false);
* @param event Handle to the event.
* @param key Name of event key.
* @param value New boolean value.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void SetEventBool(Handle event, const char[] key, bool value);
@ -253,7 +254,7 @@ native void SetEventBool(Handle event, const char[] key, bool value);
* @param event Handle to the event.
* @param key Name of event key.
* @param defValue Optional default value to use if the key is not found.
* @return The integer value of the specfied event key.
* @return The integer value of the specified event key.
* @error Invalid or corrupt Handle.
*/
native int GetEventInt(Handle event, const char[] key, int defValue=0);
@ -269,7 +270,6 @@ native int GetEventInt(Handle event, const char[] key, int defValue=0);
* @param event Handle to the event.
* @param key Name of event key.
* @param value New integer value.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void SetEventInt(Handle event, const char[] key, int value);
@ -280,7 +280,7 @@ native void SetEventInt(Handle event, const char[] key, int value);
* @param event Handle to the event.
* @param key Name of event key.
* @param defValue Optional default value to use if the key is not found.
* @return The floating point value of the specfied event key.
* @return The floating point value of the specified event key.
* @error Invalid or corrupt Handle.
*/
native float GetEventFloat(Handle event, const char[] key, float defValue=0.0);
@ -291,7 +291,6 @@ native float GetEventFloat(Handle event, const char[] key, float defValue=0.0);
* @param event Handle to the event.
* @param key Name of event key.
* @param value New floating point value.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void SetEventFloat(Handle event, const char[] key, float value);
@ -304,7 +303,6 @@ native void SetEventFloat(Handle event, const char[] key, float value);
* @param value Buffer to store the value of the specified event key.
* @param maxlength Maximum length of string buffer.
* @param defValue Optional default value to use if the key is not found.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void GetEventString(Handle event, const char[] key, char[] value, int maxlength, const char[] defvalue="");
@ -315,7 +313,6 @@ native void GetEventString(Handle event, const char[] key, char[] value, int max
* @param event Handle to the event.
* @param key Name of event key.
* @param value New string value.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void SetEventString(Handle event, const char[] key, const char[] value);
@ -326,7 +323,6 @@ native void SetEventString(Handle event, const char[] key, const char[] value);
* @param event Handle to the event.
* @param name Buffer to store the name of the event.
* @param maxlength Maximum length of string buffer.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native void GetEventName(Handle event, char[] name, int maxlength);
@ -339,7 +335,6 @@ native void GetEventName(Handle event, char[] name, int maxlength);
*
* @param event Handle to an event from an event hook.
* @param dontBroadcast True to disable broadcasting, false otherwise.
* @noreturn
* @error Invalid Handle.
*/
native void SetEventBroadcast(Handle event, bool dontBroadcast);

23
env/include/files.inc vendored
View File

@ -55,7 +55,7 @@
/**
* File inode types.
*/
enum FileType:
enum FileType
{
FileType_Unknown = 0, /* Unknown file type (device/socket) */
FileType_Directory = 1, /* File is a directory */
@ -65,7 +65,7 @@ enum FileType:
/**
* File time modes.
*/
enum FileTimeMode:
enum FileTimeMode
{
FileTime_LastAccess = 0, /* Last access (does not work on FAT) */
FileTime_Created = 1, /* Creation (does not work on FAT) */
@ -81,7 +81,7 @@ enum FileTimeMode:
/**
* Path types.
*/
enum PathType:
enum PathType
{
Path_SM, /**< SourceMod root folder */
};
@ -167,7 +167,7 @@ methodmap File < Handle
// @param format Formatting rules.
// @param ... Variable number of format parameters.
// @return True on success, false otherwise.
public native bool WriteLine(const char[] format, any:...);
public native bool WriteLine(const char[] format, any ...);
// Reads a single int8 (byte) from a file. The returned value is sign-
// extended to an int32.
@ -251,7 +251,7 @@ methodmap File < Handle
* @param ... Format arguments.
* @return Number of bytes written to buffer (not including null terminator).
*/
native int BuildPath(PathType type, char[] buffer, int maxlength, const char[] fmt, any:...);
native int BuildPath(PathType type, char[] buffer, int maxlength, const char[] fmt, any ...);
/**
* Opens a directory/folder for contents enumeration.
@ -392,7 +392,7 @@ native bool WriteFile(Handle hndl, const int[] items, int num_items, int size);
/**
* Writes a binary string to a file.
*
* @param hndl Handle to th efile.
* @param hndl Handle to the file.
* @param buffer String to write.
* @param term True to append NUL terminator, false otherwise.
* @return True on success, false on error.
@ -409,7 +409,7 @@ native bool WriteFileString(Handle hndl, const char[] buffer, bool term);
* @return True on success, false otherwise.
* @error Invalid Handle.
*/
native bool WriteFileLine(Handle hndl, const char[] format, any:...);
native bool WriteFileLine(Handle hndl, const char[] format, any ...);
/**
* Reads a single binary cell from a file.
@ -584,7 +584,7 @@ native bool CreateDirectory(const char[] path, int mode, bool use_valve_fs=false
* @param mode Permissions to set.
* @return True on success, false otherwise.
*/
native bool SetFilePermissions(const String:path[], int mode);
native bool SetFilePermissions(const char[] path, int mode);
/**
* Returns a file timestamp as a unix timestamp.
@ -593,7 +593,7 @@ native bool SetFilePermissions(const String:path[], int mode);
* @param tmode Time mode.
* @return Time value, or -1 on failure.
*/
native GetFileTime(const char[] file, FileTimeMode tmode);
native int GetFileTime(const char[] file, FileTimeMode tmode);
/**
* Same as LogToFile(), except uses an open file Handle. The file must
@ -604,7 +604,7 @@ native GetFileTime(const char[] file, FileTimeMode tmode);
* @param ... Message format parameters.
* @error Invalid Handle.
*/
native void LogToOpenFile(Handle hndl, const char[] message, any:...);
native void LogToOpenFile(Handle hndl, const char[] message, any ...);
/**
* Same as LogToFileEx(), except uses an open file Handle. The file must
@ -615,5 +615,4 @@ native void LogToOpenFile(Handle hndl, const char[] message, any:...);
* @param ... Message format parameters.
* @error Invalid Handle.
*/
native void LogToOpenFileEx(Handle hndl, const char[] message, any:...);
native void LogToOpenFileEx(Handle hndl, const char[] message, any ...);

149
env/include/float.inc vendored
View File

@ -42,7 +42,7 @@
* @param value Integer to convert.
* @return Floating point value.
*/
native Float:float(value);
native float float(int value);
#endif
/**
@ -52,7 +52,7 @@ native Float:float(value);
* @param oper2 Second value.
* @return oper1*oper2.
*/
native Float:FloatMul(Float:oper1, Float:oper2);
native float FloatMul(float oper1, float oper2);
/**
* Divides the dividend by the divisor.
@ -61,7 +61,7 @@ native Float:FloatMul(Float:oper1, Float:oper2);
* @param divisor Second value.
* @return dividend/divisor.
*/
native Float:FloatDiv(Float:dividend, Float:divisor);
native float FloatDiv(float dividend, float divisor);
/**
* Adds two floats together.
@ -70,7 +70,7 @@ native Float:FloatDiv(Float:dividend, Float:divisor);
* @param oper2 Second value.
* @return oper1+oper2.
*/
native Float:FloatAdd(Float:oper1, Float:oper2);
native float FloatAdd(float oper1, float oper2);
/**
* Subtracts oper2 from oper1.
@ -79,7 +79,7 @@ native Float:FloatAdd(Float:oper1, Float:oper2);
* @param oper2 Second value.
* @return oper1-oper2.
*/
native Float:FloatSub(Float:oper1, Float:oper2);
native float FloatSub(float oper1, float oper2);
/**
* Returns the decimal part of a float.
@ -87,7 +87,7 @@ native Float:FloatSub(Float:oper1, Float:oper2);
* @param value Input value.
* @return Decimal part.
*/
native Float:FloatFraction(Float:value);
native float FloatFraction(float value);
/**
* Rounds a float to the closest integer to zero.
@ -95,7 +95,7 @@ native Float:FloatFraction(Float:value);
* @param value Input value to be rounded.
* @return Rounded value.
*/
native RoundToZero(Float:value);
native int RoundToZero(float value);
/**
* Rounds a float to the next highest integer value.
@ -103,7 +103,7 @@ native RoundToZero(Float:value);
* @param value Input value to be rounded.
* @return Rounded value.
*/
native RoundToCeil(Float:value);
native int RoundToCeil(float value);
/**
* Rounds a float to the next lowest integer value.
@ -111,7 +111,7 @@ native RoundToCeil(Float:value);
* @param value Input value to be rounded.
* @return Rounded value.
*/
native RoundToFloor(Float:value);
native int RoundToFloor(float value);
/**
* Standard IEEE rounding.
@ -119,7 +119,7 @@ native RoundToFloor(Float:value);
* @param value Input value to be rounded.
* @return Rounded value.
*/
native RoundToNearest(Float:value);
native int RoundToNearest(float value);
/**
* Compares two floats.
@ -130,7 +130,7 @@ native RoundToNearest(Float:value);
* Returns -1 if the first argument is smaller than the second argument.
* Returns 0 if both arguments are equal.
*/
native FloatCompare(Float:fOne, Float:fTwo);
native int FloatCompare(float fOne, float fTwo);
/**
* Returns the square root of the input value, equivalent to floatpower(value, 0.5).
@ -138,7 +138,7 @@ native FloatCompare(Float:fOne, Float:fTwo);
* @param value Input value.
* @return Square root of the value.
*/
native Float:SquareRoot(Float:value);
native float SquareRoot(float value);
/**
* Returns the value raised to the power of the exponent.
@ -147,7 +147,7 @@ native Float:SquareRoot(Float:value);
* @param exponent Value to raise the base.
* @return value^exponent.
*/
native Float:Pow(Float:value, Float:exponent);
native float Pow(float value, float exponent);
/**
* Returns the value of raising the input by e.
@ -155,7 +155,7 @@ native Float:Pow(Float:value, Float:exponent);
* @param value Input value.
* @return exp(value).
*/
native Float:Exponential(Float:value);
native float Exponential(float value);
/**
* Returns the logarithm of any base specified.
@ -164,7 +164,7 @@ native Float:Exponential(Float:value);
* @param base Logarithm base to use, default is 10.
* @return log(value)/log(base).
*/
native Float:Logarithm(Float:value, Float:base=10.0);
native float Logarithm(float value, float base=10.0);
/**
* Returns the sine of the argument.
@ -172,7 +172,7 @@ native Float:Logarithm(Float:value, Float:base=10.0);
* @param value Input value in radians.
* @return sin(value).
*/
native Float:Sine(Float:value);
native float Sine(float value);
/**
* Returns the cosine of the argument.
@ -180,7 +180,7 @@ native Float:Sine(Float:value);
* @param value Input value in radians.
* @return cos(value).
*/
native Float:Cosine(Float:value);
native float Cosine(float value);
/**
* Returns the tangent of the argument.
@ -188,7 +188,7 @@ native Float:Cosine(Float:value);
* @param value Input value in radians.
* @return tan(value).
*/
native Float:Tangent(Float:value);
native float Tangent(float value);
/**
* Returns an absolute value.
@ -196,7 +196,7 @@ native Float:Tangent(Float:value);
* @param value Input value.
* @return Absolute value of the input.
*/
native Float:FloatAbs(Float:value);
native float FloatAbs(float value);
/**
* Returns the arctangent of the input value.
@ -204,7 +204,7 @@ native Float:FloatAbs(Float:value);
* @param angle Input value.
* @return atan(value) in radians.
*/
native Float:ArcTangent(Float:angle);
native float ArcTangent(float angle);
/**
* Returns the arccosine of the input value.
@ -212,7 +212,7 @@ native Float:ArcTangent(Float:angle);
* @param angle Input value.
* @return acos(value) in radians.
*/
native Float:ArcCosine(Float:angle);
native float ArcCosine(float angle);
/**
* Returns the arcsine of the input value.
@ -220,7 +220,7 @@ native Float:ArcCosine(Float:angle);
* @param angle Input value.
* @return asin(value) in radians.
*/
native Float:ArcSine(Float:angle);
native float ArcSine(float angle);
/**
* Returns the arctangent2 of the input values.
@ -229,7 +229,7 @@ native Float:ArcSine(Float:angle);
* @param y Vertical value.
* @return atan2(value) in radians.
*/
native Float:ArcTangent2(Float:x, Float:y);
native float ArcTangent2(float x, float y);
/**
* Rounds a floating point number using the "round to nearest" algorithm.
@ -237,140 +237,138 @@ native Float:ArcTangent2(Float:x, Float:y);
* @param value Floating point value to round.
* @return The value rounded to the nearest integer.
*/
stock RoundFloat(Float:value)
stock int RoundFloat(float value)
{
return RoundToNearest(value);
}
/**
* User defined operators.
*
*/
#if !defined __sourcepawn2__
#pragma rational Float
native bool:__FLOAT_GT__(Float:a, Float:b);
native bool:__FLOAT_GE__(Float:a, Float:b);
native bool:__FLOAT_LT__(Float:a, Float:b);
native bool:__FLOAT_LE__(Float:a, Float:b);
native bool:__FLOAT_EQ__(Float:a, Float:b);
native bool:__FLOAT_NE__(Float:a, Float:b);
native bool:__FLOAT_NOT__(Float:a);
native bool __FLOAT_GT__(float a, float b);
native bool __FLOAT_GE__(float a, float b);
native bool __FLOAT_LT__(float a, float b);
native bool __FLOAT_LE__(float a, float b);
native bool __FLOAT_EQ__(float a, float b);
native bool __FLOAT_NE__(float a, float b);
native bool __FLOAT_NOT__(float a);
native Float:operator*(Float:oper1, Float:oper2) = FloatMul;
native Float:operator/(Float:oper1, Float:oper2) = FloatDiv;
native Float:operator+(Float:oper1, Float:oper2) = FloatAdd;
native Float:operator-(Float:oper1, Float:oper2) = FloatSub;
native bool:operator!(Float:oper1) = __FLOAT_NOT__;
native bool:operator>(Float:oper1, Float:oper2) = __FLOAT_GT__;
native bool:operator>=(Float:oper1, Float:oper2) = __FLOAT_GE__;
native bool:operator<(Float:oper1, Float:oper2) = __FLOAT_LT__;
native bool:operator<=(Float:oper1, Float:oper2) = __FLOAT_LE__;
native bool:operator!=(Float:oper1, Float:oper2) = __FLOAT_NE__;
native bool:operator==(Float:oper1, Float:oper2) = __FLOAT_EQ__;
native float operator*(float oper1, float oper2) = FloatMul;
native float operator/(float oper1, float oper2) = FloatDiv;
native float operator+(float oper1, float oper2) = FloatAdd;
native float operator-(float oper1, float oper2) = FloatSub;
native bool operator!(float oper1) = __FLOAT_NOT__;
native bool operator>(float oper1, float oper2) = __FLOAT_GT__;
native bool operator>=(float oper1, float oper2) = __FLOAT_GE__;
native bool operator<(float oper1, float oper2) = __FLOAT_LT__;
native bool operator<=(float oper1, float oper2) = __FLOAT_LE__;
native bool operator!=(float oper1, float oper2) = __FLOAT_NE__;
native bool operator==(float oper1, float oper2) = __FLOAT_EQ__;
stock Float:operator++(Float:oper)
stock float operator++(float oper)
{
return oper+1.0;
}
stock Float:operator--(Float:oper)
stock float operator--(float oper)
{
return oper-1.0;
}
stock Float:operator-(Float:oper)
stock float operator-(float oper)
{
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
return oper^view_as<float>(cellmin); /* IEEE values are sign/magnitude */
}
stock Float:operator*(Float:oper1, oper2)
stock float operator*(float oper1, int oper2)
{
return FloatMul(oper1, float(oper2)); /* "*" is commutative */
}
stock Float:operator/(Float:oper1, oper2)
stock float operator/(float oper1, int oper2)
{
return FloatDiv(oper1, float(oper2));
}
stock Float:operator/(oper1, Float:oper2)
stock float operator/(int oper1, float oper2)
{
return FloatDiv(float(oper1), oper2);
}
stock Float:operator+(Float:oper1, oper2)
stock float operator+(float oper1, int oper2)
{
return FloatAdd(oper1, float(oper2)); /* "+" is commutative */
}
stock Float:operator-(Float:oper1, oper2)
stock float operator-(float oper1, int oper2)
{
return FloatSub(oper1, float(oper2));
}
stock Float:operator-(oper1, Float:oper2)
stock float operator-(int oper1, float oper2)
{
return FloatSub(float(oper1), oper2);
}
stock bool:operator==(Float:oper1, oper2)
stock bool operator==(float oper1, int oper2)
{
return __FLOAT_EQ__(oper1, float(oper2));
}
stock bool:operator!=(Float:oper1, oper2)
stock bool operator!=(float oper1, int oper2)
{
return __FLOAT_NE__(oper1, float(oper2));
}
stock bool:operator>(Float:oper1, oper2)
stock bool operator>(float oper1, int oper2)
{
return __FLOAT_GT__(oper1, float(oper2));
}
stock bool:operator>(oper1, Float:oper2)
stock bool operator>(int oper1, float oper2)
{
return __FLOAT_GT__(float(oper1), oper2);
}
stock bool:operator>=(Float:oper1, oper2)
stock bool operator>=(float oper1, int oper2)
{
return __FLOAT_GE__(oper1, float(oper2));
}
stock bool:operator>=(oper1, Float:oper2)
stock bool operator>=(int oper1, float oper2)
{
return __FLOAT_GE__(float(oper1), oper2);
}
stock bool:operator<(Float:oper1, oper2)
stock bool operator<(float oper1, int oper2)
{
return __FLOAT_LT__(oper1, float(oper2));
}
stock bool:operator<(oper1, Float:oper2)
stock bool operator<(int oper1, float oper2)
{
return __FLOAT_LT__(float(oper1), oper2);
}
stock bool:operator<=(Float:oper1, oper2)
stock bool operator<=(float oper1, int oper2)
{
return __FLOAT_LE__(oper1, float(oper2));
}
stock bool:operator<=(oper1, Float:oper2)
stock bool operator<=(int oper1, float oper2)
{
return __FLOAT_LE__(float(oper1), oper2);
}
/**
* Forbidden operators.
*
*/
forward operator%(Float:oper1, Float:oper2);
forward operator%(Float:oper1, oper2);
forward operator%(oper1, Float:oper2);
forward operator%(float oper1, float oper2);
forward operator%(float oper1, int oper2);
forward operator%(int oper1, float oper2);
#endif // __sourcepawn2__
#define FLOAT_PI 3.1415926535897932384626433832795
@ -381,7 +379,7 @@ forward operator%(oper1, Float:oper2);
* @param angle Degrees.
* @return Radians.
*/
stock Float:DegToRad(Float:angle)
stock float DegToRad(float angle)
{
return (angle*FLOAT_PI)/180;
}
@ -392,7 +390,7 @@ stock Float:DegToRad(Float:angle)
* @param angle Radians.
* @return Degrees.
*/
stock Float:RadToDeg(Float:angle)
stock float RadToDeg(float angle)
{
return (angle*180)/FLOAT_PI;
}
@ -404,7 +402,7 @@ stock Float:RadToDeg(Float:angle)
*
* @return Random integer.
*/
native GetURandomInt();
native int GetURandomInt();
/**
* Returns a uniform random float in the range [0, 1).
@ -413,7 +411,7 @@ native GetURandomInt();
*
* @return Uniform random floating-point number.
*/
native Float:GetURandomFloat();
native float GetURandomFloat();
/**
* Seeds a plugin's uniform random number stream. This is done automatically,
@ -421,21 +419,18 @@ native Float:GetURandomFloat();
*
* @param seeds Array of numbers to use as seeding data.
* @param numSeeds Number of seeds in the seeds array.
* @noreturn
*/
native SetURandomSeed(const seeds[], numSeeds);
native void SetURandomSeed(const int[] seeds, int numSeeds);
/**
* Seeds a plugin's uniform random number stream. This is done automatically,
* so normally it is totally unnecessary to call this.
*
* @param seed Single seed value.
* @noreturn
*/
stock SetURandomSeedSimple(seed)
stock void SetURandomSeedSimple(int seed)
{
new seeds[1];
int seeds[1];
seeds[0] = seed;
SetURandomSeed(seeds, 1);
}

View File

@ -88,7 +88,7 @@ enum ExecType
#define SP_ERROR_INVALID_ADDRESS 5 /**< A memory address was not valid */
#define SP_ERROR_NOT_FOUND 6 /**< The object in question was not found */
#define SP_ERROR_INDEX 7 /**< Invalid index parameter */
#define SP_ERROR_STACKLOW 8 /**< Nnot enough space left on the stack */
#define SP_ERROR_STACKLOW 8 /**< Not enough space left on the stack */
#define SP_ERROR_NOTDEBUGGING 9 /**< Debug mode was not on or debug section not found */
#define SP_ERROR_INVALID_INSTRUCTION 10 /**< Invalid instruction was encountered */
#define SP_ERROR_MEMACCESS 11 /**< Invalid memory access */
@ -120,7 +120,7 @@ enum ExecType
* @return Function id or INVALID_FUNCTION if not found.
* @error Invalid or corrupt plugin handle.
*/
native Function:GetFunctionByName(Handle:plugin, const String:name[]);
native Function GetFunctionByName(Handle plugin, const char[] name);
/**
* Creates a global forward.
@ -136,7 +136,7 @@ native Function:GetFunctionByName(Handle:plugin, const String:name[]);
* @return Handle to new global forward.
* @error More than 32 paramater types passed.
*/
native Handle:CreateGlobalForward(const String:name[], ExecType:type, ParamType:...);
native Handle CreateGlobalForward(const char[] name, ExecType type, ParamType ...);
/**
* Creates a private forward.
@ -150,7 +150,7 @@ native Handle:CreateGlobalForward(const String:name[], ExecType:type, ParamType:
* @return Handle to new private forward.
* @error More than 32 paramater types passed.
*/
native Handle:CreateForward(ExecType:type, ParamType:...);
native Handle CreateForward(ExecType type, ParamType ...);
/**
* Returns the number of functions in a global or private forward's call list.
@ -159,12 +159,12 @@ native Handle:CreateForward(ExecType:type, ParamType:...);
* @return Number of functions in forward.
* @error Invalid or corrupt forward handle.
*/
native GetForwardFunctionCount(Handle:fwd);
native int GetForwardFunctionCount(Handle fwd);
/**
* Adds a function to a private forward's call list.
*
* @note Cannot be used during an incompleted call.
* @note Cannot be used during an incomplete call.
*
* @param fwd Handle to private forward.
* @param plugin Handle of the plugin that contains the function.
@ -173,7 +173,7 @@ native GetForwardFunctionCount(Handle:fwd);
* @return True on success, false otherwise.
* @error Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function.
*/
native bool:AddToForward(Handle:fwd, Handle:plugin, Function:func);
native bool AddToForward(Handle fwd, Handle plugin, Function func);
/**
* Removes a function from a private forward's call list.
@ -188,7 +188,7 @@ native bool:AddToForward(Handle:fwd, Handle:plugin, Function:func);
* @return True on success, false otherwise.
* @error Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function.
*/
native bool:RemoveFromForward(Handle:fwd, Handle:plugin, Function:func);
native bool RemoveFromForward(Handle fwd, Handle plugin, Function func);
/**
* Removes all instances of a plugin from a private forward's call list.
@ -201,31 +201,29 @@ native bool:RemoveFromForward(Handle:fwd, Handle:plugin, Function:func);
* @return Number of functions removed from forward.
* @error Invalid or corrupt private forward handle or invalid or corrupt plugin handle.
*/
native RemoveAllFromForward(Handle:fwd, Handle:plugin);
native int RemoveAllFromForward(Handle fwd, Handle plugin);
/**
* Starts a call to functions in a forward's call list.
*
* @note Cannot be used during an incompleted call.
* @note Cannot be used during an incomplete call.
*
* @param fwd Handle to global or private forward.
* @noreturn
* @error Invalid or corrupt forward handle or called before another call has completed.
*/
native Call_StartForward(Handle:fwd);
native void Call_StartForward(Handle fwd);
/**
* Starts a call to a function.
*
* @note Cannot be used during an incompleted call.
* @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 call.
* @noreturn
* @error Invalid or corrupt plugin handle, invalid function, or called before another call has completed.
*/
native Call_StartFunction(Handle:plugin, Function:func);
native void Call_StartFunction(Handle plugin, Function func);
/**
* Pushes a cell onto the current call.
@ -233,10 +231,9 @@ native Call_StartFunction(Handle:plugin, Function:func);
* @note Cannot be used before a call has been started.
*
* @param value Cell value to push.
* @noreturn
* @error Called before a call has been started.
*/
native Call_PushCell(any:value);
native void Call_PushCell(any value);
/**
* Pushes a cell by reference onto the current call.
@ -244,10 +241,9 @@ native Call_PushCell(any:value);
* @note Cannot be used before a call has been started.
*
* @param value Cell reference to push.
* @noreturn
* @error Called before a call has been started.
*/
native Call_PushCellRef(&any:value);
native void Call_PushCellRef(any &value);
/**
* Pushes a float onto the current call.
@ -255,10 +251,9 @@ native Call_PushCellRef(&any:value);
* @note Cannot be used before a call has been started.
*
* @param value Floating point value to push.
* @noreturn
* @error Called before a call has been started.
*/
native Call_PushFloat(Float:value);
native void Call_PushFloat(float value);
/**
* Pushes a float by reference onto the current call.
@ -266,10 +261,9 @@ native Call_PushFloat(Float:value);
* @note Cannot be used before a call has been started.
*
* @param value Floating point reference to push.
* @noreturn
* @error Called before a call has been started.
*/
native Call_PushFloatRef(&Float:value);
native void Call_PushFloatRef(float &value);
/**
* Pushes an array onto the current call.
@ -279,10 +273,9 @@ native Call_PushFloatRef(&Float:value);
*
* @param value Array to push.
* @param size Size of array.
* @noreturn
* @error Called before a call has been started.
*/
native Call_PushArray(const any:value[], size);
native void Call_PushArray(const any[] value, int size);
/**
* Pushes an array onto the current call.
@ -293,10 +286,9 @@ native Call_PushArray(const any:value[], size);
* @param size Size of array.
* @param cpflags Whether or not changes should be copied back to the input array.
* See SP_PARAM_* constants for details.
* @noreturn
* @error Called before a call has been started.
*/
native Call_PushArrayEx(any:value[], size, cpflags);
native void Call_PushArrayEx(any[] value, int size, int cpflags);
/**
* Pushes a string onto the current call.
@ -305,10 +297,9 @@ native Call_PushArrayEx(any:value[], size, cpflags);
* @note Cannot be used before a call has been started.
*
* @param value String to push.
* @noreturn
* @error Called before a call has been started.
*/
native Call_PushString(const String:value[]);
native void Call_PushString(const char[] value);
/**
* Pushes a string onto the current call.
@ -318,14 +309,13 @@ native Call_PushString(const String:value[]);
* @param value String to push.
* @param length Length of string buffer.
* @param szflags Flags determining how string should be handled.
* See SP_PARAM_STRING_* constants for details.
* See SM_PARAM_STRING_* constants for details.
* The default (0) is to push ASCII.
* @param cpflags Whether or not changes should be copied back to the input array.
* See SP_PARAM_* constants for details.
* @noreturn
* See SM_PARAM_* constants for details.
* @error Called before a call has been started.
*/
native Call_PushStringEx(String:value[], length, szflags, cpflags);
native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags);
/**
* Completes a call to a function or forward's call list.
@ -336,17 +326,16 @@ native Call_PushStringEx(String:value[], length, szflags, cpflags);
* @return SP_ERROR_NONE on success, any other integer on failure.
* @error Called before a call has been started.
*/
native Call_Finish(&any:result=0);
native int Call_Finish(any &result=0);
/**
* Cancels a call to a function or forward's call list.
*
* @note Cannot be used before a call has been started.
*
* @noreturn
* @error Called before a call has been started.
*/
native Call_Cancel();
native void Call_Cancel();
/**
* Defines a native function.
@ -363,12 +352,11 @@ typedef NativeCall = function int (Handle plugin, int numParams);
* Creates a dynamic native. This should only be called in AskPluginLoad(), or
* else you risk not having your native shared with other plugins.
*
* @param name Name of the dynamic native; must be unique amongst
* @param name Name of the dynamic native; must be unique among
* all other registered dynamic natives.
* @param func Function to use as the dynamic native.
* @noreturn
*/
native CreateNative(const String:name[], NativeCall:func);
native void CreateNative(const char[] name, NativeCall func);
/**
* Throws an error in the calling plugin of a native, instead of your own plugin.
@ -377,7 +365,7 @@ native CreateNative(const String:name[], NativeCall:func);
* @param fmt Error message format.
* @param ... Format arguments.
*/
native ThrowNativeError(error, const String:fmt[], any:...);
native int ThrowNativeError(int error, const char[] fmt, any ...);
/**
* Retrieves the string length from a native parameter string. This is useful
@ -389,7 +377,7 @@ native ThrowNativeError(error, const String:fmt[], any:...);
* @return SP_ERROR_NONE on success, any other integer on failure.
* @error Invalid parameter number or calling from a non-native function.
*/
native GetNativeStringLength(param, &length);
native int GetNativeStringLength(int param, int &length);
/**
* Retrieves a string from a native parameter.
@ -402,7 +390,7 @@ native GetNativeStringLength(param, &length);
* @return SP_ERROR_NONE on success, any other integer on failure.
* @error Invalid parameter number or calling from a non-native function.
*/
native GetNativeString(param, String:buffer[], maxlength, &bytes=0);
native int GetNativeString(int param, char[] buffer, int maxlength, int &bytes=0);
/**
* Sets a string in a native parameter.
@ -417,7 +405,7 @@ native GetNativeString(param, String:buffer[], maxlength, &bytes=0);
* @return SP_ERROR_NONE on success, any other integer on failure.
* @error Invalid parameter number or calling from a non-native function.
*/
native SetNativeString(param, const String:source[], maxlength, bool:utf8=true, &bytes=0);
native int SetNativeString(int param, const char[] source, int maxlength, bool utf8=true, int &bytes=0);
/**
* Gets a cell from a native parameter.
@ -426,7 +414,7 @@ native SetNativeString(param, const String:source[], maxlength, bool:utf8=true,
* @return Cell value at the parameter number.
* @error Invalid parameter number or calling from a non-native function.
*/
native any:GetNativeCell(param);
native any GetNativeCell(int param);
/**
* Gets a function pointer from a native parameter.
@ -435,7 +423,7 @@ native any:GetNativeCell(param);
* @return Function pointer at the given parameter number.
* @error Invalid parameter number, or calling from a non-native function.
*/
native Function GetNativeFunction(param);
native Function GetNativeFunction(int param);
/**
* Gets a cell from a native parameter, by reference.
@ -444,17 +432,16 @@ native Function GetNativeFunction(param);
* @return Cell value at the parameter number.
* @error Invalid parameter number or calling from a non-native function.
*/
native any:GetNativeCellRef(param);
native any GetNativeCellRef(int param);
/**
* Sets a cell from a native parameter, by reference.
*
* @param param Parameter number, starting from 1.
* @param value Cell value at the parameter number to set by reference.
* @noreturn
* @error Invalid parameter number or calling from a non-native function.
*/
native SetNativeCellRef(param, any:value);
native void SetNativeCellRef(int param, any value);
/**
* Gets an array from a native parameter (always by reference).
@ -465,7 +452,7 @@ native SetNativeCellRef(param, any:value);
* @return SP_ERROR_NONE on success, anything else on failure.
* @error Invalid parameter number or calling from a non-native function.
*/
native GetNativeArray(param, any:local[], size);
native int GetNativeArray(int param, any[] local, int size);
/**
* Copies a local array into a native parameter array (always by reference).
@ -476,7 +463,7 @@ native GetNativeArray(param, any:local[], size);
* @return SP_ERROR_NONE on success, anything else on failure.
* @error Invalid parameter number or calling from a non-native function.
*/
native SetNativeArray(param, const any:local[], size);
native int SetNativeArray(int param, const any[] local, int size);
/**
* Formats a string using parameters from a native.
@ -494,19 +481,18 @@ native SetNativeArray(param, const any:local[], size);
* @param fmt_string Format string to use if fmt_param is not used.
* @return SP_ERROR_NONE on success, anything else on failure.
*/
native FormatNativeString(out_param,
fmt_param,
vararg_param,
out_len,
&written=0,
String:out_string[]="",
const String:fmt_string[]="");
native int FormatNativeString(int out_param,
int fmt_param,
int vararg_param,
int out_len,
int &written=0,
char[] out_string="",
const char[] fmt_string="");
/**
* Defines a RequestFrame Callback.
*
* @param data Data passed to the RequestFrame native.
* @noreturn
*/
typedef RequestFrameCallback = function void (any data);
@ -515,6 +501,5 @@ typedef RequestFrameCallback = function void (any data);
*
* @param Function Function to call on the next frame.
* @param data Value to be passed on the invocation of the Function.
* @noreturn
*/
native RequestFrame(RequestFrameCallback:Function, any:data=0);
native void RequestFrame(RequestFrameCallback Function, any data=0);

10
env/include/geoip.inc vendored
View File

@ -48,7 +48,7 @@
* @param ccode Destination string buffer to store the code.
* @return True on success, false if no country found.
*/
native bool:GeoipCode2(const String:ip[], String:ccode[3]);
native bool GeoipCode2(const char[] ip, char ccode[3]);
/**
* Gets the three character country code from an IP address. (USA, CAN, etc)
@ -57,7 +57,7 @@ native bool:GeoipCode2(const String:ip[], String:ccode[3]);
* @param ccode Destination string buffer to store the code.
* @return True on success, false if no country found.
*/
native bool:GeoipCode3(const String:ip[], String:ccode[4]);
native bool GeoipCode3(const char[] ip, char ccode[4]);
/**
* Gets the full country name. (max length of output string is 45)
@ -67,7 +67,7 @@ native bool:GeoipCode3(const String:ip[], String:ccode[4]);
* @param maxlength Maximum length of output string buffer.
* @return True on success, false if no country found.
*/
native bool:GeoipCountry(const String:ip[], String:name[], maxlength);
native bool GeoipCountry(const char[] ip, char[] name, int maxlength);
/**
* @endsection
@ -76,7 +76,7 @@ native bool:GeoipCountry(const String:ip[], String:name[], maxlength);
/**
* Do not edit below this line!
*/
public Extension:__ext_geoip =
public Extension __ext_geoip =
{
name = "GeoIP",
file = "geoip.ext",
@ -93,7 +93,7 @@ public Extension:__ext_geoip =
};
#if !defined REQUIRE_EXTENSIONS
public __ext_geoip_SetNTVOptional()
public void __ext_geoip_SetNTVOptional()
{
MarkNativeAsOptional("GeoipCode2");
MarkNativeAsOptional("GeoipCode3");

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2016 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -53,7 +53,7 @@
#define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */
#define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */
#define MOTDPANEL_TYPE_URL 2 /**< Treat msg as an URL link */
#define MOTDPANEL_TYPE_FILE 3 /**< Treat msg as a filename to be openned */
#define MOTDPANEL_TYPE_FILE 3 /**< Treat msg as a filename to be opened */
enum DialogType
{
@ -88,6 +88,26 @@ enum EngineVersion
Engine_Blade, /**< Blade Symphony */
Engine_Insurgency, /**< Insurgency (2013 Retail version)*/
Engine_Contagion, /**< Contagion */
Engine_BlackMesa, /**< Black Mesa Multiplayer */
};
enum FindMapResult
{
// A direct match for this name was found
FindMap_Found,
// No match for this map name could be found.
FindMap_NotFound,
// A fuzzy match for this map name was found.
// Ex: cp_dust -> cp_dustbowl, c1m1 -> c1m1_hotel
// Only supported for maps that the engine knows about. (This excludes workshop maps on Orangebox).
FindMap_FuzzyMatch,
// A non-canonical match for this map name was found.
// Ex: workshop/1234 -> workshop/cp_qualified_name.ugc1234
// Only supported on "Orangebox" games with workshop support.
FindMap_NonCanonical,
// No currently available match for this map name could be found, but it may be possible to load
// Only supported on "Orangebox" games with workshop support.
FindMap_PossiblyAvailable
};
#define INVALID_ENT_REFERENCE 0xFFFFFFFF
@ -97,17 +117,15 @@ enum EngineVersion
*
* @param format String format.
* @param ... Format arguments.
* @noreturn
*/
native LogToGame(const String:format[], any:...);
native void LogToGame(const char[] format, any ...);
/**
* Sets the seed value for the global Half-Life 2 Random Stream.
*
* @param seed Seed value.
* @noreturn
*/
native SetRandomSeed(seed);
native void SetRandomSeed(int seed);
/**
* Returns a random floating point number from the Half-Life 2 Random Stream.
@ -116,7 +134,7 @@ native SetRandomSeed(seed);
* @param fMax Maximum random bound.
* @return A random number between (inclusive) fMin and fMax.
*/
native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0);
native float GetRandomFloat(float fMin=0.0, float fMax=1.0);
/**
* Returns a random number from the Half-Life 2 Random Stream.
@ -125,7 +143,7 @@ native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0);
* @param nmax Maximum random bound.
* @return A random number between (inclusive) nmin and nmax.
*/
native GetRandomInt(nmin, nmax);
native int GetRandomInt(int nmin, int nmax);
/**
* Returns whether a map is valid or not.
@ -133,35 +151,65 @@ native GetRandomInt(nmin, nmax);
* @param map Map name, excluding .bsp extension.
* @return True if valid, false otherwise.
*/
native bool:IsMapValid(const String:map[]);
native bool IsMapValid(const char[] map);
/**
* Returns whether a full or partial map name is found or can be resolved
*
* @param map Map name (usually same as map path relative to maps/ dir,
* excluding .bsp extension).
* @param foundmap Resolved map name. If the return is FindMap_FuzzyMatch
* or FindMap_NonCanonical the buffer will be the full path.
* @param maxlen Maximum length to write to map var.
* @return Result of the find operation. Not all result types are supported on all games.
*/
native FindMapResult FindMap(const char[] map, char[] foundmap, int maxlen);
/**
* Get the display name of a workshop map.
*
* Note: You do not need to call FindMap first. This native will call FindMap internally.
*
* @param map Map name (usually same as map path relative to maps/ dir,
* excluding .bsp extension).
* @param displayName Map's display name, i.e. cp_mymapname or de_mymapname.
* If FindMap returns FindMap_PossiblyAvailable or FindMap_NotFound,
* the map cannot be resolved and this native will return false,
* but displayName will be a copy of map.
* @param maxlen Maximum length to write to displayName var.
* @return true if FindMap returns FindMap_Found, FindMap_FuzzyMatch, or
* FindMap_NonCanonical.
* false if FindMap returns FindMap_PossiblyAvailable or FindMap_NotFound.
*/
native bool GetMapDisplayName(const char[] map, char[] displayName, int maxlen);
/**
* Returns whether the server is dedicated.
*
* @return True if dedicated, false otherwise.
*/
native bool:IsDedicatedServer();
native bool IsDedicatedServer();
/**
* Returns a high-precision time value for profiling the engine.
*
* @return A floating point time value.
*/
native Float:GetEngineTime();
native float GetEngineTime();
/**
* Returns the game time based on the game tick.
*
* @return Game tick time.
*/
native Float:GetGameTime();
native float GetGameTime();
/**
* Returns the game's internal tick count.
*
* @return Game tick count.
*/
native GetGameTickCount();
native int GetGameTickCount();
/**
* Returns the game description from the mod.
@ -172,17 +220,16 @@ native GetGameTickCount();
* ignoring any potential hooks from plugins.
* @return Number of bytes written to the buffer (UTF-8 safe).
*/
native GetGameDescription(String:buffer[], maxlength, bool:original=false);
native int GetGameDescription(char[] buffer, int maxlength, bool original=false);
/**
* Returns the name of the game's directory.
*
* @param buffer Buffer to store the directory name.
* @param maxlength Maximum size of the buffer.
*
* return Number of bytes written to the buffer (UTF-8 safe).
* @return Number of bytes written to the buffer (UTF-8 safe).
*/
native GetGameFolderName(String:buffer[], maxlength);
native int GetGameFolderName(char[] buffer, int maxlength);
/**
* Returns the current map name.
@ -191,7 +238,7 @@ native GetGameFolderName(String:buffer[], maxlength);
* @param maxlength Maximum length of buffer.
* @return Number of bytes written (UTF-8 safe).
*/
native GetCurrentMap(String:buffer[], maxlength);
native int GetCurrentMap(char[] buffer, int maxlength);
/**
* Precaches a given model.
@ -200,7 +247,7 @@ native GetCurrentMap(String:buffer[], maxlength);
* @param preload If preload is true the file will be precached before level startup.
* @return Returns the model index, 0 for error.
*/
native PrecacheModel(const String:model[], bool:preload=false);
native int PrecacheModel(const char[] model, bool preload=false);
/**
* Precaches a given sentence file.
@ -209,7 +256,7 @@ native PrecacheModel(const String:model[], bool:preload=false);
* @param preload If preload is true the file will be precached before level startup.
* @return Returns a sentence file index.
*/
native PrecacheSentenceFile(const String:file[], bool:preload=false);
native int PrecacheSentenceFile(const char[] file, bool preload=false);
/**
* Precaches a given decal.
@ -218,7 +265,7 @@ native PrecacheSentenceFile(const String:file[], bool:preload=false);
* @param preload If preload is true the file will be precached before level startup.
* @return Returns a decal index.
*/
native PrecacheDecal(const String:decal[], bool:preload=false);
native int PrecacheDecal(const char[] decal, bool preload=false);
/**
* Precaches a given generic file.
@ -227,7 +274,7 @@ native PrecacheDecal(const String:decal[], bool:preload=false);
* @param preload If preload is true the file will be precached before level startup.
* @return Returns a generic file index.
*/
native PrecacheGeneric(const String:generic[], bool:preload=false);
native int PrecacheGeneric(const char[] generic, bool preload=false);
/**
* Returns if a given model is precached.
@ -235,7 +282,7 @@ native PrecacheGeneric(const String:generic[], bool:preload=false);
* @param model Name of the model to check.
* @return True if precached, false otherwise.
*/
native bool:IsModelPrecached(const String:model[]);
native bool IsModelPrecached(const char[] model);
/**
* Returns if a given decal is precached.
@ -243,7 +290,7 @@ native bool:IsModelPrecached(const String:model[]);
* @param decal Name of the decal to check.
* @return True if precached, false otherwise.
*/
native bool:IsDecalPrecached(const String:decal[]);
native bool IsDecalPrecached(const char[] decal);
/**
* Returns if a given generic file is precached.
@ -251,7 +298,7 @@ native bool:IsDecalPrecached(const String:decal[]);
* @param generic Name of the generic file to check.
* @return True if precached, false otherwise.
*/
native bool:IsGenericPrecached(const String:generic[]);
native bool IsGenericPrecached(const char[] generic);
/**
* Precaches a given sound.
@ -260,7 +307,7 @@ native bool:IsGenericPrecached(const String:generic[]);
* @param preload If preload is true the file will be precached before level startup.
* @return True if successfully precached, false otherwise.
*/
native bool:PrecacheSound(const String:sound[], bool:preload=false);
native bool PrecacheSound(const char[] sound, bool preload=false);
/**
* Returns if a given sound is precached.
@ -268,7 +315,7 @@ native bool:PrecacheSound(const String:sound[], bool:preload=false);
* @param sound Name of the sound to check.
* @return True if precached, false otherwise.
*/
native bool:IsSoundPrecached(const String:sound[]);
native bool IsSoundPrecached(const char[] sound);
/**
* Creates different types of ingame messages.
@ -276,10 +323,9 @@ native bool:IsSoundPrecached(const String:sound[]);
* @param client Index of the client.
* @param kv KeyValues handle to set the menu keys and options. (Check iserverplugin.h for more information).
* @param type Message type to display ingame.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native CreateDialog(client, Handle:kv, DialogType:type);
native void CreateDialog(int client, Handle kv, DialogType type);
/**
* Guesses the SDK version a mod was compiled against. If nothing
@ -291,7 +337,7 @@ native CreateDialog(client, Handle:kv, DialogType:type);
* @return SOURCE_SDK version code.
*/
#pragma deprecated See GetEngineVersion()
native GuessSDKVersion();
native int GuessSDKVersion();
/**
* Gets the engine version that the currently-loaded SM core was compiled against.
@ -301,7 +347,7 @@ native GuessSDKVersion();
*
* @return An EngineVersion value.
*/
native EngineVersion:GetEngineVersion();
native EngineVersion GetEngineVersion();
/**
* Prints a message to a specific client in the chat area.
@ -309,23 +355,21 @@ native EngineVersion:GetEngineVersion();
* @param client Client index.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error If the client is not connected an error will be thrown.
*/
native PrintToChat(client, const String:format[], any:...);
native void PrintToChat(int client, const char[] format, any ...);
/**
* Prints a message to all clients in the chat area.
*
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
*/
stock PrintToChatAll(const String:format[], any:...)
stock void PrintToChatAll(const char[] format, any ...)
{
decl String:buffer[192];
char buffer[254];
for (new i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
@ -342,23 +386,21 @@ stock PrintToChatAll(const String:format[], any:...)
* @param client Client index.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error If the client is not connected an error will be thrown.
*/
native PrintCenterText(client, const String:format[], any:...);
native void PrintCenterText(int client, const char[] format, any ...);
/**
* Prints a message to all clients in the center of the screen.
*
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
*/
stock PrintCenterTextAll(const String:format[], any:...)
stock void PrintCenterTextAll(const char[] format, any ...)
{
decl String:buffer[192];
char buffer[254];
for (new i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
@ -375,23 +417,21 @@ stock PrintCenterTextAll(const String:format[], any:...)
* @param client Client index.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error If the client is not connected an error will be thrown.
*/
native PrintHintText(client, const String:format[], any:...);
native void PrintHintText(int client, const char[] format, any ...);
/**
* Prints a message to all clients with a hint box.
*
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
*/
stock PrintHintTextToAll(const String:format[], any:...)
stock void PrintHintTextToAll(const char[] format, any ...)
{
decl String:buffer[192];
char buffer[254];
for (new i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
@ -411,10 +451,9 @@ stock PrintHintTextToAll(const String:format[], any:...)
* @param Kv KeyValues handle with all the data for the panel setup (Depends
* on the panel type and may be unused).
* @param show True to show the panel, or false to remove it from the client screen.
* @noreturn
* @error If the client is not connected an error will be thrown.
*/
native ShowVGUIPanel(client, const String:name[], Handle:Kv=INVALID_HANDLE, bool:show=true);
native void ShowVGUIPanel(int client, const char[] name, Handle Kv=INVALID_HANDLE, bool show=true);
/**
* Creates a HUD synchronization object. This object is used to automatically assign and
@ -449,7 +488,7 @@ native ShowVGUIPanel(client, const String:name[], Handle:Kv=INVALID_HANDLE, bool
* If HUD text is not supported on this mod, then
* INVALID_HANDLE is returned.
*/
native Handle:CreateHudSynchronizer();
native Handle CreateHudSynchronizer();
/**
* Sets the HUD parameters for drawing text. These parameters are stored
@ -473,10 +512,9 @@ native Handle:CreateHudSynchronizer();
* @param fxTime Duration of chosen effect (may not apply to all effects).
* @param fadeIn Number of seconds to spend fading in.
* @param fadeOut Number of seconds to spend fading out.
* @noreturn
*/
native SetHudTextParams(Float:x, Float:y, Float:holdTime, r, g, b, a, effect = 0,
Float:fxTime=6.0, Float:fadeIn=0.1, Float:fadeOut=0.2);
native void SetHudTextParams(float x, float y, float holdTime, int r, int g, int b, int a, int effect = 0,
float fxTime=6.0, float fadeIn=0.1, float fadeOut=0.2);
/**
* Sets the HUD parameters for drawing text. These parameters are stored
@ -496,11 +534,10 @@ native SetHudTextParams(Float:x, Float:y, Float:holdTime, r, g, b, a, effect = 0
* @param fxTime Duration of chosen effect (may not apply to all effects).
* @param fadeIn Number of seconds to spend fading in.
* @param fadeOut Number of seconds to spend fading out.
* @noreturn
*/
native SetHudTextParamsEx(Float:x, Float:y, Float:holdTime, color1[4],
color2[4]={255,255,255,0}, effect = 0, Float:fxTime=6.0,
Float:fadeIn=0.1, Float:fadeOut=0.2);
native void SetHudTextParamsEx(float x, float y, float holdTime, int color1[4],
int color2[4]={255,255,255,0}, int effect = 0, float fxTime=6.0,
float fadeIn=0.1, float fadeOut=0.2);
/**
* Shows a synchronized HUD message to a client.
@ -515,7 +552,7 @@ native SetHudTextParamsEx(Float:x, Float:y, Float:holdTime, color1[4],
* This function fails if the mod does not support it.
* @error Client not in-game, or sync object not valid.
*/
native ShowSyncHudText(client, Handle:sync, const String:message[], any:...);
native int ShowSyncHudText(int client, Handle sync, const char[] message, any ...);
/**
* Clears the text on a synchronized HUD channel.
@ -531,10 +568,9 @@ native ShowSyncHudText(client, Handle:sync, const String:message[], any:...);
*
* @param client Client index to send the message to.
* @param sync Synchronization object.
* @noreturn
* @error Client not in-game, or sync object not valid.
*/
native ClearSyncHud(client, Handle:sync);
native void ClearSyncHud(int client, Handle sync);
/**
* Shows a HUD message to a client on the given channel.
@ -553,7 +589,7 @@ native ClearSyncHud(client, Handle:sync);
* Any other return value is the channel number that was
* used to render the text.
*/
native ShowHudText(client, channel, const String:message[], any:...);
native int ShowHudText(int client, int channel, const char[] message, any ...);
/**
* Shows a MOTD panel to a specific client.
@ -563,10 +599,9 @@ native ShowHudText(client, channel, const String:message[], any:...);
* @param msg Contents of the panel, it can be treated as an url, filename or plain text
* depending on the type parameter (WARNING: msg has to be 192 bytes maximum!)
* @param type Determines the way to treat the message body of the panel.
* @noreturn
* @error If the client is not connected an error will be thrown.
*/
stock ShowMOTDPanel(client, const String:title[], const String:msg[], type=MOTDPANEL_TYPE_INDEX)
stock void ShowMOTDPanel(int client, const char[] title, const char[] msg, int type=MOTDPANEL_TYPE_INDEX)
{
char num[3];
IntToString(type, num, sizeof(num));
@ -586,9 +621,8 @@ stock ShowMOTDPanel(client, const String:title[], const String:msg[], type=MOTDP
* @param time Duration to hold the panel on the client's screen.
* @param ip Destination IP.
* @param password Password to connect to the destination IP. The client will be able to see this.
* @noreturn
*/
stock DisplayAskConnectBox(client, Float:time, const String:ip[], const String:password[] = "")
stock void DisplayAskConnectBox(int client, float time, const char[] ip, const char[] password = "")
{
char destination[288];
FormatEx(destination, sizeof(destination), "%s/%s", ip, password);
@ -606,7 +640,7 @@ stock DisplayAskConnectBox(client, Float:time, const String:ip[], const String:p
* @param entity Entity index.
* @return Entity reference.
*/
native EntIndexToEntRef(entity);
native int EntIndexToEntRef(int entity);
/**
* Retrieves the entity index from a reference.
@ -614,7 +648,7 @@ native EntIndexToEntRef(entity);
* @param ref Entity reference.
* @return Entity index.
*/
native EntRefToEntIndex(ref);
native int EntRefToEntIndex(int ref);
/**
* Converts a reference into a backwards compatible version.
@ -622,7 +656,7 @@ native EntRefToEntIndex(ref);
* @param ref Entity reference.
* @return Bcompat reference.
*/
native MakeCompatEntRef(ref);
native int MakeCompatEntRef(int ref);
enum ClientRangeType
@ -642,3 +676,23 @@ enum ClientRangeType
*/
native int GetClientsInRange(float origin[3], ClientRangeType rangeType, int[] clients, int size);
/**
* Retrieves the server's authentication string (SteamID).
*
* Note: If called before server is connected to Steam, auth id
* will be invalid ([I:0:1], 1, etc.)
*
* @param authType Auth id type and format to use.
* (Only AuthId_Steam3 and AuthId_SteamID64 are supported)
* @param auth Buffer to store the server's auth id.
* @param maxlen Maximum length of string buffer (includes NULL terminator).
* @error Invalid AuthIdType given.
*/
native void GetServerAuthId(AuthIdType authType, char[] auth, int maxlen);
/**
* Returns the server's Steam account ID.
*
* @return Steam account ID or 0 if not available.
*/
native int GetServerSteamAccountId();

View File

@ -38,7 +38,7 @@
/**
* Preset Handle values.
*/
enum Handle: // Tag disables introducing "Handle" as a symbol.
enum Handle // Tag disables introducing "Handle" as a symbol.
{
INVALID_HANDLE = 0,
};
@ -54,7 +54,7 @@ enum Handle: // Tag disables introducing "Handle" as a symbol.
* @param hndl Handle to close.
* @error Invalid handles will cause a run time error.
*/
native CloseHandle(Handle:hndl);
native void CloseHandle(Handle hndl);
/**
* Clones a Handle. When passing handles in between plugins, caching handles
@ -73,16 +73,9 @@ native CloseHandle(Handle:hndl);
* @return Handle on success, INVALID_HANDLE if not cloneable.
* @error Invalid handles will cause a run time error.
*/
native Handle:CloneHandle(Handle:hndl, Handle:plugin=INVALID_HANDLE);
native Handle CloneHandle(Handle hndl, Handle plugin=INVALID_HANDLE);
/**
* Helper for object-oriented syntax.
*/
methodmap Handle __nullable__
{
public Close() = CloseHandle;
public ~Handle() = CloseHandle;
}
using __intrinsics__.Handle;
/**
* Do not use this function. Returns if a Handle and its contents
@ -101,4 +94,4 @@ methodmap Handle __nullable__
* @return True if handle is valid, false otherwise.
*/
#pragma deprecated Do not use this function.
native bool:IsValidHandle(Handle:hndl);
native bool IsValidHandle(Handle hndl);

View File

@ -43,12 +43,12 @@
* @param buffer Buffer for text.
* @param maxlength Maximum length of text.
*/
stock FormatUserLogText(client, String:buffer[], maxlength)
stock void FormatUserLogText(int client, char[] buffer, int maxlength)
{
decl String:auth[32];
decl String:name[40];
char auth[32];
char name[MAX_NAME_LENGTH];
new userid = GetClientUserId(client);
int userid = GetClientUserId(client);
if (!GetClientAuthString(client, auth, sizeof(auth)))
{
strcopy(auth, sizeof(auth), "UNKNOWN");
@ -69,12 +69,12 @@ stock FormatUserLogText(client, String:buffer[], maxlength)
* @param filename Filename of the plugin to search for.
* @return Handle to plugin if found, INVALID_HANDLE otherwise.
*/
stock Handle:FindPluginByFile(const String:filename[])
stock Handle FindPluginByFile(const char[] filename)
{
decl String:buffer[256];
char buffer[256];
new Handle:iter = GetPluginIterator();
new Handle:pl;
Handle iter = GetPluginIterator();
Handle pl;
while (MorePlugins(iter))
{
@ -107,7 +107,7 @@ stock int SearchForClients(const char[] pattern, int[] clients, int maxClients)
if (pattern[0] == '#') {
int input = StringToInt(pattern[1]);
if (!input) {
char name[65];
char name[MAX_NAME_LENGTH];
for (int i=1; i<=MaxClients; i++) {
if (!IsClientInGame(i))
continue;
@ -126,7 +126,7 @@ stock int SearchForClients(const char[] pattern, int[] clients, int maxClients)
}
}
char name[65];
char name[MAX_NAME_LENGTH];
for (int i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i))
@ -152,12 +152,13 @@ stock int SearchForClients(const char[] pattern, int[] clients, int maxClients)
* @param immunity Optional. Set to false to ignore target immunity.
* @return Index of target client, or -1 on error.
*/
stock FindTarget(client, const String:target[], bool:nobots = false, bool:immunity = true)
stock int FindTarget(int client, const char[] target, bool nobots = false, bool immunity = true)
{
decl String:target_name[MAX_TARGET_LENGTH];
decl target_list[1], target_count, bool:tn_is_ml;
char target_name[MAX_TARGET_LENGTH];
int target_list[1], target_count;
bool tn_is_ml;
new flags = COMMAND_FILTER_NO_MULTI;
int flags = COMMAND_FILTER_NO_MULTI;
if (nobots)
{
flags |= COMMAND_FILTER_NO_BOTS;
@ -202,10 +203,10 @@ stock FindTarget(client, const String:target[], bool:nobots = false, bool:immuni
* @return Number of maps loaded or 0 if in error.
*/
#pragma deprecated Use ReadMapList() instead.
stock LoadMaps(Handle:array, &fileTime = 0, Handle:fileCvar = INVALID_HANDLE)
stock int LoadMaps(Handle array, int &fileTime = 0, Handle fileCvar = INVALID_HANDLE)
{
decl String:mapPath[256], String:mapFile[64];
new bool:fileFound = false;
char mapPath[256], mapFile[64];
bool fileFound = false;
if (fileCvar != INVALID_HANDLE)
{
@ -216,7 +217,7 @@ stock FindTarget(client, const String:target[], bool:nobots = false, bool:immuni
if (!fileFound)
{
new Handle:mapCycleFile = FindConVar("mapcyclefile");
Handle mapCycleFile = FindConVar("mapcyclefile");
GetConVarString(mapCycleFile, mapPath, sizeof(mapPath));
fileFound = FileExists(mapPath);
}
@ -231,7 +232,7 @@ stock FindTarget(client, const String:target[], bool:nobots = false, bool:immuni
// If the file hasn't changed, there's no reason to reload
// all of the maps.
new newTime = GetFileTime(mapPath, FileTime_LastChange);
int newTime = GetFileTime(mapPath, FileTime_LastChange);
if (fileTime == newTime)
{
return GetArraySize(array);

View File

@ -107,7 +107,7 @@ methodmap KeyValues < Handle
//
// @param key Name of the key, or NULL_STRING.
// @param value Large integer value (0=High bits, 1=Low bits)
public native void SetUInt64(const char[] key, const value[2]);
public native void SetUInt64(const char[] key, const int value[2]);
// Sets a floating point value of a KeyValues key.
//
@ -167,9 +167,9 @@ methodmap KeyValues < Handle
// @param g Green value, set by reference.
// @param b Blue value, set by reference.
// @param a Alpha value, set by reference.
public native void GetColor(const char[] key, &r, &g, &b, &a);
public native void GetColor(const char[] key, int &r, int &g, int &b, int &a);
// Retrives a set of color values from a KeyValues key.
// Retrieves a set of color values from a KeyValues key.
//
// @param key Name of the key, or NULL_STRING.
// @param color Red, green, blue, and alpha channels.
@ -359,7 +359,7 @@ native void KvSetNum(Handle kv, const char[] key, int value);
* @param value Large integer value (0=High bits, 1=Low bits)
* @error Invalid Handle.
*/
native void KvSetUInt64(Handle kv, const char[] key, const value[2]);
native void KvSetUInt64(Handle kv, const char[] key, const int value[2]);
/**
* Sets a floating point value of a KeyValues key.

22
env/include/lang.inc vendored
View File

@ -42,9 +42,8 @@
* If no extension is specified, .txt is assumed.
*
* @param file Translation file.
* @noreturn
*/
native LoadTranslations(const String:file[]);
native void LoadTranslations(const char[] file);
/**
* Sets the global language target. This is useful for creating functions
@ -53,9 +52,8 @@ native LoadTranslations(const String:file[]);
* not during this function call.
*
* @param client Client index or LANG_SERVER.
* @noreturn
*/
native SetGlobalTransTarget(client);
native void SetGlobalTransTarget(int client);
/**
* Retrieves the language number of a client.
@ -64,21 +62,21 @@ native SetGlobalTransTarget(client);
* @return Language number client is using.
* @error Invalid client index or client not connected.
*/
native GetClientLanguage(client);
native int GetClientLanguage(int client);
/**
* Retrieves the server's language.
*
* @return Language number server is using.
*/
native GetServerLanguage();
native int GetServerLanguage();
/**
* Returns the number of languages known in languages.cfg.
*
* @return Language count.
*/
native GetLanguageCount();
native int GetLanguageCount();
/**
* Retrieves info about a given language number.
@ -88,20 +86,18 @@ native GetLanguageCount();
* @param codeLen Maximum length of the language code buffer.
* @param name Language name buffer.
* @param nameLen Maximum length of the language name buffer.
* @noreturn
* @error Invalid language number.
*/
native GetLanguageInfo(language, String:code[]="", codeLen=0, String:name[]="", nameLen=0);
native void GetLanguageInfo(int language, char[] code="", int codeLen=0, char[] name="", int nameLen=0);
/**
* Sets the language number of a client.
*
* @param client Client index.
* @param language Language number.
* @noreturn
* @error Invalid client index or client not connected.
*/
native SetClientLanguage(client, language);
native void SetClientLanguage(int client, int language);
/**
* Retrieves the language number from a language code.
@ -109,7 +105,7 @@ native SetClientLanguage(client, language);
* @param code Language code (2-3 characters usually).
* @return Language number. -1 if not found.
*/
native GetLanguageByCode(const String:code[]);
native int GetLanguageByCode(const char[] code);
/**
* Retrieves the language number from a language name.
@ -117,4 +113,4 @@ native GetLanguageByCode(const String:code[]);
* @param name Language name (case insensitive).
* @return Language number. -1 if not found.
*/
native GetLanguageByName(const String:name[]);
native int GetLanguageByName(const char[] name);

View File

@ -41,9 +41,8 @@
*
* @param format String format.
* @param ... Format arguments.
* @noreturn
*/
native LogMessage(const String:format[], any:...);
native void LogMessage(const char[] format, any ...);
/**
* Logs a message to any file. The log message will be in the normal
@ -52,10 +51,9 @@ native LogMessage(const String:format[], any:...);
* @param file File to write the log message in.
* @param format String format.
* @param ... Format arguments.
* @noreturn
* @error File could not be opened/written.
*/
native LogToFile(const String:file[], const String:format[], any:...);
native void LogToFile(const char[] file, const char[] format, any ...);
/**
* Same as LogToFile(), except no plugin logtag is prepended.
@ -63,10 +61,9 @@ native LogToFile(const String:file[], const String:format[], any:...);
* @param file File to write the log message in.
* @param format String format.
* @param ... Format arguments.
* @noreturn
* @error File could not be opened/written.
*/
native LogToFileEx(const String:file[], const String:format[], any:...);
native void LogToFileEx(const char[] file, const char[] format, any ...);
/**
* Logs an action from a command or event whereby interception and routing may
@ -77,18 +74,16 @@ native LogToFileEx(const String:file[], const String:format[], any:...);
* @param target Client being targetted, or -1 if not applicable.
* @param message Message format.
* @param ... Message formatting parameters.
* @noreturn
*/
native LogAction(client, target, const String:message[], any:...);
native void LogAction(int client, int target, const char[] message, any ...);
/**
* Logs a plugin error message to the SourceMod logs.
*
* @param format String format.
* @param ... Format arguments.
* @noreturn
*/
native LogError(const String:format[], any:...);
native void LogError(const char[] format, any ...);
/**
* Called when an action is going to be logged.
@ -99,16 +94,16 @@ native LogError(const String:format[], any:...);
* @param client Client the action is from; 0 for server, -1 if not applicable.
* @param target Client the action is targetting, or -1 if not applicable.
* @param message Message that is being logged.
* @return Plugin_Continue will cause Core to defaulty log the message.
* @return Plugin_Continue will perform the default logging behavior.
* Plugin_Handled will stop Core from logging the message.
* Plugin_Stop is the same as Handled, but prevents any other
* plugins from handling the message.
*/
forward Action:OnLogAction(Handle:source,
Identity:ident,
client,
target,
const String:message[]);
forward Action OnLogAction(Handle source,
Identity ident,
int client,
int target,
const char[] message);
/**
* Called when a game log message is received.
@ -129,14 +124,12 @@ typedef GameLogHook = function Action (const char[] message);
* Adds a game log hook.
*
* @param hook Hook function.
* @noreturn
*/
native AddGameLogHook(GameLogHook:hook);
native void AddGameLogHook(GameLogHook hook);
/**
* Removes a game log hook.
*
* @param hook Hook function.
* @noreturn
*/
native RemoveGameLogHook(GameLogHook:hook);
native void RemoveGameLogHook(GameLogHook hook);

View File

@ -1,3 +1,34 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2014 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 _mapchooser_included_
#endinput
#endif
@ -8,7 +39,7 @@ enum NominateResult
Nominate_Added, /** The map was added to the nominate list */
Nominate_Replaced, /** A clients existing nomination was replaced */
Nominate_AlreadyInVote, /** Specified map was already in the vote */
Nominate_InvalidMap, /** Mapname specifed wasn't a valid map */
Nominate_InvalidMap, /** Mapname specified wasn't a valid map */
Nominate_VoteFull, /** This will only occur if force was set to false */
};
@ -24,10 +55,10 @@ 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 nominater. 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 String:map[], bool:force, owner);
native NominateResult NominateMap(const char[] map, bool force, int owner);
/**
* Attempt to remove a map from the mapchooser map list.
@ -35,39 +66,37 @@ native NominateResult:NominateMap(const String:map[], bool:force, owner);
* @param map Map to remove.
* @return True if the nomination was found and removed, or false if the nomination was not found.
*/
native bool:RemoveNominationByMap(const String:map[]);
native bool RemoveNominationByMap(const char[] map);
/**
* Attempt to remove a map from the mapchooser map list.
*
* @param owner Client index of the nominater.
* @param owner Client index of the nominator.
* @return True if the nomination was found and removed, or false if the nomination was not found.
*/
native bool:RemoveNominationByOwner(owner);
native bool RemoveNominationByOwner(int owner);
/**
* Gets the current list of excluded maps.
*
* @param array An ADT array handle to add the map strings to.
* @noreturn
*/
native GetExcludeMapList(Handle:array);
native void GetExcludeMapList(ArrayList array);
/**
* Gets the current list of nominated maps.
*
* @param maparray An ADT array handle to add the map strings to.
* @param ownerarray An optional ADT array handle to add the nominator client indexes to.
* @noreturn
*/
native GetNominatedMapList(Handle:maparray, Handle:ownerarray = INVALID_HANDLE);
native void GetNominatedMapList(ArrayList maparray, ArrayList ownerarray = null);
/**
* Checks if MapChooser will allow a vote
*
* @return True if a vote can be held, or false if mapchooser is already holding a vote.
*/
native bool:CanMapChooserStartVote();
native bool CanMapChooserStartVote();
/**
* Initiates a MapChooser map vote
@ -78,21 +107,21 @@ native bool:CanMapChooserStartVote();
* @param when MapChange consant of when the resulting mapchange should occur.
* @param inputarray ADT array list of maps to add to the vote.
*/
native InitiateMapChooserVote(MapChange:when, Handle:inputarray=INVALID_HANDLE);
native void InitiateMapChooserVote(MapChange when, ArrayList inputarray=null);
/**
* Checks if MapChooser's end of map vote has completed.
*
* @return True if complete, false otherwise.
*/
native bool:HasEndOfMapVoteFinished();
native bool HasEndOfMapVoteFinished();
/**
* Checks if MapChooser is set to run an end of map vote.
*
* @return True if enabled, false otherwise.
*/
native bool:EndOfMapVoteEnabled();
native bool EndOfMapVoteEnabled();
/**
* Called when mapchooser removes a nomination from its list.
@ -105,8 +134,7 @@ forward void OnNominationRemoved(const char[] map, int owner);
*/
forward void OnMapVoteStarted();
public SharedPlugin:__pl_mapchooser =
public SharedPlugin __pl_mapchooser =
{
name = "mapchooser",
file = "mapchooser.smx",
@ -117,7 +145,7 @@ public SharedPlugin:__pl_mapchooser =
#endif
};
public __pl_mapchooser_SetNTVOptional()
public void __pl_mapchooser_SetNTVOptional()
{
MarkNativeAsOptional("NominateMap");
MarkNativeAsOptional("RemoveNominationByMap");
@ -129,4 +157,3 @@ public __pl_mapchooser_SetNTVOptional()
MarkNativeAsOptional("HasEndOfMapVoteFinished");
MarkNativeAsOptional("EndOfMapVoteEnabled");
}

19
env/include/menus.inc vendored
View File

@ -72,7 +72,7 @@ enum MenuAction
/** Default menu actions */
#define MENU_ACTIONS_DEFAULT MenuAction_Select|MenuAction_Cancel|MenuAction_End
/** All menu actions */
#define MENU_ACTIONS_ALL MenuAction:0xFFFFFFFF
#define MENU_ACTIONS_ALL view_as<MenuAction>(0xFFFFFFFF)
#define MENU_NO_PAGINATION 0 /**< Menu should not be paginated (10 items max) */
#define MENU_TIME_FOREVER 0 /**< Menu should be displayed as long as possible */
@ -176,7 +176,7 @@ methodmap Panel < Handle
// No numbering or newlines are needed.
// @param style ITEMDRAW style flags.
// @return A slot position, or 0 if item was a rawline or could not be drawn.
public native void DrawItem(const char[] text, style=ITEMDRAW_DEFAULT);
public native int DrawItem(const char[] text, int style=ITEMDRAW_DEFAULT);
// Draws a raw line of text on a panel, without any markup other than a
// newline.
@ -379,7 +379,7 @@ methodmap Menu < Handle
// Get or set the menu's pagination.
//
// If pgination is MENU_NO_PAGINATION, and the exit button flag is set,
// If pagination is MENU_NO_PAGINATION, and the exit button flag is set,
// then the exit button flag is removed. It can be re-applied if desired.
property int Pagination {
public native get();
@ -784,10 +784,10 @@ native bool VoteMenu(Handle menu, int[] clients, int numClients, int time, int f
*/
stock bool VoteMenuToAll(Handle menu, int time, int flags=0)
{
new total;
decl players[MaxClients];
int total;
int[] players = new int[MaxClients];
for (new i=1; i<=MaxClients; i++)
for (int i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
{
@ -970,7 +970,7 @@ native void SetPanelTitle(Handle panel, const char[] text, bool onlyIfEmpty=fals
* @return A slot position, or 0 if item was a rawline or could not be drawn.
* @error Invalid Handle.
*/
native int DrawPanelItem(Handle panel, const char[] text, style=ITEMDRAW_DEFAULT);
native int DrawPanelItem(Handle panel, const char[] text, int style=ITEMDRAW_DEFAULT);
/**
* Draws a raw line of text on a panel, without any markup other than a newline.
@ -992,7 +992,7 @@ native bool DrawPanelText(Handle panel, const char[] text);
* @return True if item is drawable, false otherwise.
* @error Invalid Handle.
*/
native bool CanPanelDrawFlags(Handle panel, style);
native bool CanPanelDrawFlags(Handle panel, int style);
/**
* Sets the selectable key map of a panel. This is not supported by
@ -1096,7 +1096,7 @@ native bool InternalShowMenu(int client, const char[] str, int time, int keys=-1
* @param winningVotes Number of votes received by the winning option.
* @param totalVotes Number of total votes received.
*/
stock void GetMenuVoteInfo(param2, &winningVotes, &totalVotes)
stock void GetMenuVoteInfo(int param2, int &winningVotes, int &totalVotes)
{
winningVotes = param2 & 0xFFFF;
totalVotes = param2 >> 16;
@ -1119,4 +1119,3 @@ stock bool IsNewVoteAllowed()
return true;
}

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2014 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -42,7 +42,7 @@
* @param map Next map to set.
* @return True if the nextmap was set, false if map was invalid.
*/
native bool:SetNextMap(const String:map[]);
native bool SetNextMap(const char[] map);
/**
* Returns SourceMod's internal nextmap.
@ -51,23 +51,22 @@ native bool:SetNextMap(const String:map[]);
* @param maxlen Maximum length of the map buffer.
* @return True if a Map was found and copied, false if no nextmap is set (map will be unchanged).
*/
native bool:GetNextMap(String:map[], maxlen);
native bool GetNextMap(char[] map, int maxlen);
/**
* Changes the current map and records the reason for the change with maphistory
*
* @param map Map to change to.
* @param reason Reason for change.
* @noreturn
*/
native ForceChangeLevel(const String:map[], const String:reason[]);
native void ForceChangeLevel(const char[] map, const char[] reason);
/**
* Gets the current number of maps in the map history
*
* @return Number of maps.
*/
native GetMapHistorySize();
native int GetMapHistorySize();
/**
* Retrieves a map from the map history list.
@ -78,7 +77,6 @@ native GetMapHistorySize();
* @param reason Buffer to store the change reason.
* @param reasonLen Length of the reason buffer.
* @param startTime Time the map started.
* @noreturn
* @error Invalid item number.
*/
native GetMapHistory(item, String:map[], mapLen, String:reason[], reasonLen, &startTime);
native void GetMapHistory(int item, char[] map, int mapLen, char[] reason, int reasonLen, int &startTime);

View File

@ -45,25 +45,23 @@
*
* @return Handle to the profiler object.
*/
native Handle:CreateProfiler();
native Handle CreateProfiler();
/**
* Starts profiling.
*
* @param prof Profiling object.
* @noreturn
* @error Invalid Handle.
*/
native StartProfiling(Handle:prof);
native void StartProfiling(Handle prof);
/**
* Stops profiling.
*
* @param prof Profiling object.
* @noreturn
* @error Invalid Handle or profiling was never started.
*/
native StopProfiling(Handle:prof);
native void StopProfiling(Handle prof);
/**
* Returns the amount of high-precision time in seconds
@ -74,7 +72,7 @@ native StopProfiling(Handle:prof);
* @return Time elapsed in seconds.
* @error Invalid Handle.
*/
native Float:GetProfilerTime(Handle:prof);
native float GetProfilerTime(Handle prof);
/**
* Mark the start of a profiling event.
@ -82,19 +80,18 @@ native Float:GetProfilerTime(Handle:prof);
* @param group Budget group. This can be "all" for a default, or a short
* description like "Timers" or "Events".
* @param name A name to attribute to this profiling event.
* @noreturn
*/
native EnterProfilingEvent(const String:group[], const String:name[]);
native void EnterProfilingEvent(const char[] group, const char[] name);
/**
* Mark the end of the last profiling event. This must be called in the same
* stack frame as StartProfilingEvent(). Not doing so, or throwing errors,
* will make the resulting profile very wrong.
*/
native LeaveProfilingEvent();
native void LeaveProfilingEvent();
/**
* Returns true if the global profiler is enabled; false otherwise. It is
* not necessary to call this before Enter/LeaveProfilingEvent.
*/
native bool:IsProfilingActive();
native bool IsProfilingActive();

View File

@ -306,7 +306,7 @@ native bool PbReadBool(Handle pb, const char[] field, int index = PB_FIELD_NOT_R
* @param index Index into repeated field.
* @error Invalid or incorrect Handle, non-existent field, or incorrect field type.
*/
native void PbReadString(Handle pb, const char[] field, String:buffer[], maxlength, int index = PB_FIELD_NOT_REPEATED);
native void PbReadString(Handle pb, const char[] field, char[] buffer, int maxlength, int index = PB_FIELD_NOT_REPEATED);
/**
* Reads an RGBA color value from a protobuf message.
@ -317,7 +317,7 @@ native void PbReadString(Handle pb, const char[] field, String:buffer[], maxleng
* @param index Index into repeated field.
* @error Invalid or incorrect Handle, non-existent field, or incorrect field type.
*/
native void PbReadColor(Handle pb, const char[] field, buffer[4], int index = PB_FIELD_NOT_REPEATED);
native void PbReadColor(Handle pb, const char[] field, int buffer[4], int index = PB_FIELD_NOT_REPEATED);
/**
* Reads an XYZ angle value from a protobuf message.

48
env/include/regex.inc vendored
View File

@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
@ -92,6 +92,43 @@ enum RegexError
REGEX_ERROR_BADLENGTH = -32,
};
// Regular expression objects are used to match or decompose strings based on
// patterns.
methodmap Regex < Handle
{
// Compile a regular expression.
//
// @param pattern The regular expression pattern.
// @param flags General flags for the regular expression.
// @param error Error message encountered, if applicable.
// @param maxLen Maximum string length of the error buffer.
// @param errcode Regex type error code encountered, if applicable.
public native Regex(const char[] pattern, int flags = 0, char[] error="", int maxLen = 0, RegexError &errcode = REGEX_ERROR_NONE);
// 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.
//
// @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);
// 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.
//
// @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 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
public native bool GetSubString(int str_id, char[] buffer, int maxlen);
};
/**
* Precompile a regular expression. Use this if you intend on using the
* same expression multiple times. Pass the regex handle returned here to
@ -132,13 +169,6 @@ native int MatchRegex(Handle regex, const char[] str, RegexError &ret = REGEX_ER
*/
native bool GetRegexSubString(Handle regex, int str_id, char[] buffer, int maxlen);
methodmap Regex < Handle
{
public Regex() = CompileRegex;
public Match() = MatchRegex;
public GetSubString() = GetRegexSubString;
};
/**
* Matches a string against a regular expression pattern.
*
@ -172,7 +202,7 @@ stock int SimpleRegexMatch(const char[] str, const char[] pattern, int flags = 0
/**
* Do not edit below this line!
*/
public Extension:__ext_regex =
public Extension __ext_regex =
{
name = "Regex Extension",
file = "regex.ext",

View File

@ -121,6 +121,7 @@ enum SDKHookType
SDKHook_BlockedPost,
SDKHook_OnTakeDamageAlive,
SDKHook_OnTakeDamageAlivePost,
SDKHook_CanBeAutobalanced,
};
/*
@ -129,6 +130,8 @@ enum SDKHookType
SDKHook_Blocked,
SDKHook_BlockedPost,
SDKHook_CanBeAutobalanced,
SDKHook_EndTouch,
SDKHook_EndTouchPost,
@ -291,6 +294,9 @@ typeset SDKHookCB
// Reload post
function void (int weapon, bool bSuccessful);
// CanBeAutobalanced
function bool (int client, bool origRet);
};
@ -299,17 +305,15 @@ typeset SDKHookCB
*
* @param entity Entity index
* @param classname Class name
* @noreturn
*/
forward OnEntityCreated(entity, const String:classname[]);
forward void OnEntityCreated(int entity, const char[] classname);
/**
* @brief When an entity is destroyed
*
* @param entity Entity index
* @noreturn
*/
forward OnEntityDestroyed(entity);
forward void OnEntityDestroyed(int entity);
/**
* @brief When the game description is retrieved
@ -317,18 +321,18 @@ forward OnEntityDestroyed(entity);
* @note Not supported on ep2v.
*
* @param gameDesc Game description
* @noreturn
* @return Plugin_Changed if gameDesc has been edited, else no change.
*/
forward Action:OnGetGameDescription(String:gameDesc[64]);
forward Action OnGetGameDescription(char gameDesc[64]);
/**
* @brief When the level is initialized
*
* @param mapName Name of the map
* @param mapEntities Entities of the map
* @noreturn
* @return Plugin_Changed if mapEntities has been edited, else no change.
*/
forward Action:OnLevelInit(const String:mapName[], String:mapEntities[2097152]);
forward Action OnLevelInit(const char[] mapName, char mapEntities[2097152]);
/**
* @brief Hooks an entity
@ -336,9 +340,8 @@ forward Action:OnLevelInit(const String:mapName[], String:mapEntities[2097152]);
* @param entity Entity index
* @param type Type of function to hook
* @param callback Function to call when hook is called
* @noreturn
*/
native SDKHook(entity, SDKHookType:type, SDKHookCB:callback);
native void SDKHook(int entity, SDKHookType type, SDKHookCB callback);
/**
* @brief Hooks an entity
@ -348,7 +351,7 @@ native SDKHook(entity, SDKHookType:type, SDKHookCB:callback);
* @param callback Function to call when hook is called
* @return bool Hook Successful
*/
native bool:SDKHookEx(entity, SDKHookType:type, SDKHookCB:callback);
native bool SDKHookEx(int entity, SDKHookType type, SDKHookCB callback);
/**
* @brief Unhooks an entity
@ -356,9 +359,8 @@ native bool:SDKHookEx(entity, SDKHookType:type, SDKHookCB:callback);
* @param entity Entity index
* @param type Type of function to unhook
* @param callback Callback function to unhook
* @noreturn
*/
native SDKUnhook(entity, SDKHookType:type, SDKHookCB:callback);
native void SDKUnhook(int entity, SDKHookType type, SDKHookCB callback);
/**
* @brief Applies damage to an entity
@ -373,9 +375,10 @@ native SDKUnhook(entity, SDKHookType:type, SDKHookCB:callback);
* @param weapon Weapon index (orangebox and later) or -1 for unspecified
* @param damageForce Velocity of damage force
* @param damagePosition Origin of damage
* @noreturn
*/
native SDKHooks_TakeDamage(entity, inflictor, attacker, Float:damage, damageType=DMG_GENERIC, weapon=-1, const Float:damageForce[3]=NULL_VECTOR, const Float:damagePosition[3]=NULL_VECTOR);
native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
float damage, int damageType=DMG_GENERIC, int weapon=-1,
const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR);
/**
* @brief Forces a client to drop the specified weapon
@ -384,15 +387,15 @@ native SDKHooks_TakeDamage(entity, inflictor, attacker, Float:damage, damageType
* @param weapon Weapon entity index.
* @param vecTarget Location to toss weapon to, or NULL_VECTOR for default.
* @param vecVelocity Velocity at which to toss weapon, or NULL_VECTOR for default.
* @noreturn
* @error Invalid client or weapon entity, weapon not owned by client.
*/
native SDKHooks_DropWeapon(client, weapon, const Float:vecTarget[3]=NULL_VECTOR, const Float:vecVelocity[3]=NULL_VECTOR);
native void SDKHooks_DropWeapon(int client, int weapon, const float vecTarget[3]=NULL_VECTOR,
const float vecVelocity[3]=NULL_VECTOR);
/**
* Do not edit below this line!
*/
public Extension:__ext_sdkhooks =
public Extension __ext_sdkhooks =
{
name = "SDKHooks",
file = "sdkhooks.ext",

View File

@ -107,17 +107,15 @@ enum SDKPassMethod
* Starts the preparation of an SDK call.
*
* @param type Type of function call this will be.
* @noreturn
*/
native StartPrepSDKCall(SDKCallType:type);
native void StartPrepSDKCall(SDKCallType type);
/**
* Sets the virtual index of the SDK call if it is virtual.
*
* @param vtblidx Virtual table index.
* @noreturn
*/
native PrepSDKCall_SetVirtual(vtblidx);
native void PrepSDKCall_SetVirtual(int vtblidx);
/**
* Finds an address in a library and sets it as the address to use for the SDK call.
@ -129,7 +127,7 @@ native PrepSDKCall_SetVirtual(vtblidx);
* @param bytes Number of bytes in the binary search string.
* @return True on success, false if nothing was found.
*/
native bool:PrepSDKCall_SetSignature(SDKLibrary:lib, const String:signature[], bytes);
native bool PrepSDKCall_SetSignature(SDKLibrary lib, const char[] signature, int bytes);
/**
* Uses the given function address for the SDK call.
@ -137,7 +135,7 @@ native bool:PrepSDKCall_SetSignature(SDKLibrary:lib, const String:signature[], b
* @param addr Address of function to use.
* @return True on success, false on failure.
*/
native bool:PrepSDKCall_SetAddress(Address:addr);
native bool PrepSDKCall_SetAddress(Address addr);
/**
* Finds an address or virtual function index in a GameConfig file and sets it as
@ -148,7 +146,7 @@ native bool:PrepSDKCall_SetAddress(Address:addr);
* @param name Name of the property to find.
* @return True on success, false if nothing was found.
*/
native bool:PrepSDKCall_SetFromConf(Handle:gameconf, SDKFuncConfSource:source, const String:name[]);
native bool PrepSDKCall_SetFromConf(Handle gameconf, SDKFuncConfSource source, const char[] name);
/**
* Sets the return information of an SDK call. Do not call this if there is no return data.
@ -159,9 +157,8 @@ native bool:PrepSDKCall_SetFromConf(Handle:gameconf, SDKFuncConfSource:source, c
* @param pass How the data is passed in C++.
* @param decflags Flags on decoding from the plugin to C++.
* @param encflags Flags on encoding from C++ to the plugin.
* @noreturn
*/
native PrepSDKCall_SetReturnInfo(SDKType:type, SDKPassMethod:pass, decflags=0, encflags=0);
native void PrepSDKCall_SetReturnInfo(SDKType type, SDKPassMethod pass, int decflags=0, int encflags=0);
/**
* Adds a parameter to the calling convention. This should be called in normal ascending order.
@ -170,16 +167,15 @@ native PrepSDKCall_SetReturnInfo(SDKType:type, SDKPassMethod:pass, decflags=0, e
* @param pass How the data is passed in C++.
* @param decflags Flags on decoding from the plugin to C++.
* @param encflags Flags on encoding from C++ to the plugin.
* @noreturn
*/
native PrepSDKCall_AddParameter(SDKType:type, SDKPassMethod:pass, decflags=0, encflags=0);
native void PrepSDKCall_AddParameter(SDKType type, SDKPassMethod pass, int decflags=0, int encflags=0);
/**
* Finalizes an SDK call preparation and returns the resultant Handle.
*
* @return A new SDKCall Handle on success, or INVALID_HANDLE on failure.
*/
native Handle:EndPrepSDKCall();
native Handle EndPrepSDKCall();
/**
* Calls an SDK function with the given parameters.
@ -201,21 +197,21 @@ native Handle:EndPrepSDKCall();
* @return Simple return value, if any.
* @error Invalid Handle or internal decoding error.
*/
native any:SDKCall(Handle:call, any:...);
native any SDKCall(Handle call, any ...);
/**
* Returns the entity index of the player resource/manager entity.
*
* @return Index of resource entity or -1 if not found.
*/
native GetPlayerResourceEntity();
native int GetPlayerResourceEntity();
#include <sdktools_stocks>
/**
* Do not edit below this line!
*/
public Extension:__ext_sdktools =
public Extension __ext_sdktools =
{
name = "SDKTools",
file = "sdktools.ext",

View File

@ -39,14 +39,12 @@
* Sets the client to an inactive state waiting for a new map
*
* @param client The client index
* @noreturn
*/
native InactivateClient(client);
native void InactivateClient(int client);
/**
* Reconnect a client without dropping the netchannel
*
* @param client The client index
* @noreturn
*/
native ReconnectClient(client);
native void ReconnectClient(int client);

View File

@ -42,28 +42,25 @@
*
* @param client Client index.
* @param entity Entity index.
* @noreturn
* @error Invalid client or entity, lack of mod support, or client not in
* game.
*/
native SetClientViewEntity(client, entity);
native void SetClientViewEntity(int client, int entity);
/**
* Sets a light style.
*
* @param style Light style (from 0 to MAX_LIGHTSTYLES-1)
* @param value Light value string (see world.cpp/light.cpp in dlls)
* @noreturn
* @error Light style index is out of range.
*/
native SetLightStyle(style, const String:value[]);
native void SetLightStyle(int style, const char[] value);
/**
* Returns the client's eye position.
*
* @param client Player's index.
* @param pos Destination vector to store the client's eye position.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native GetClientEyePosition(client, Float:pos[3]);
native void GetClientEyePosition(int client, float pos[3]);

View File

@ -38,7 +38,7 @@
/**
* Invokes a named input method on an entity.
*
* After completion (successful or not), the current global variant is re-initalized.
* After completion (successful or not), the current global variant is re-initialized.
*
* @param dest Destination entity index.
* @param input Input action.
@ -48,69 +48,61 @@
* @return True if successful otherwise false.
* @error Invalid entity index or no mod support.
*/
native bool:AcceptEntityInput(dest, const String:input[], activator=-1, caller=-1, outputid=0);
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.
* @noreturn
*/
native SetVariantBool(bool:val);
native void SetVariantBool(bool val);
/**
* Sets a string in the global variant object.
*
* @param str Input string.
* @noreturn
*/
native SetVariantString(const String:str[]);
native void SetVariantString(const char[] str);
/**
* Sets an integer value in the global variant object.
*
* @param val Input value.
* @noreturn
*/
native SetVariantInt(val);
native void SetVariantInt(int val);
/**
* Sets a floating point value in the global variant object.
*
* @param val Input value.
* @noreturn
*/
native SetVariantFloat(Float:val);
native void SetVariantFloat(float val);
/**
* Sets a 3D vector in the global variant object.
*
* @param vec Input vector.
* @noreturn
*/
native SetVariantVector3D(const Float:vec[3]);
native void SetVariantVector3D(const float vec[3]);
/**
* Sets a 3D position vector in the global variant object.
*
* @param vec Input position vector.
* @noreturn
*/
native SetVariantPosVector3D(const Float:vec[3]);
native void SetVariantPosVector3D(const float vec[3]);
/**
* Sets a color in the global variant object.
*
* @param color Input color.
* @noreturn
*/
native SetVariantColor(const color[4]);
native void SetVariantColor(const int color[4]);
/**
* Sets an entity in the global variant object.
*
* @param entity Entity index.
* @noreturn
* @error Invalid entity index.
*/
native SetVariantEntity(entity);
native void SetVariantEntity(int entity);

View File

@ -42,9 +42,15 @@
* @param caller Entity index of the caller.
* @param activator Entity index of the activator.
* @param delay Delay in seconds? before the event gets fired.
* @noreturn
* @return Anything other than Plugin_Continue will supress this event,
* returning Plugin_Continue will allow it to propagate the results
* of this output to any entity inputs.
*/
typedef EntityOutput = function void (const char[] output, int caller, int activator, float delay);
typeset EntityOutput
{
function void (const char[] output, int caller, int activator, float delay);
function Action (const char[] output, int caller, int activator, float delay);
};
/**
* Add an entity output hook on a entity classname
@ -52,10 +58,9 @@ typedef EntityOutput = function void (const char[] output, int caller, int activ
* @param classname The classname to hook.
* @param output The output name to hook.
* @param callback An EntityOutput function pointer.
* @noreturn
* @error Entity Outputs disabled.
*/
native HookEntityOutput(const String:classname[], const String:output[], EntityOutput:callback);
native void HookEntityOutput(const char[] classname, const char[] output, EntityOutput callback);
/**
* Remove an entity output hook.
@ -65,7 +70,7 @@ native HookEntityOutput(const String:classname[], const String:output[], EntityO
* @return True on success, false if no valid hook was found.
* @error Entity Outputs disabled.
*/
native bool:UnhookEntityOutput(const String:classname[], const String:output[], EntityOutput:callback);
native bool UnhookEntityOutput(const char[] classname, const char[] output, EntityOutput callback);
/**
* Add an entity output hook on a single entity instance
@ -74,10 +79,9 @@ native bool:UnhookEntityOutput(const String:classname[], const String:output[],
* @param output The output name to hook.
* @param callback An EntityOutput function pointer.
* @param once Only fire this hook once and then remove itself.
* @noreturn
* @error Entity Outputs disabled or Invalid Entity index.
*/
native HookSingleEntityOutput(entity, const String:output[], EntityOutput:callback , bool:once=false);
native void HookSingleEntityOutput(int entity, const char[] output, EntityOutput callback, bool once=false);
/**
* Remove a single entity output hook.
@ -88,5 +92,4 @@ native HookSingleEntityOutput(entity, const String:output[], EntityOutput:callba
* @return True on success, false if no valid hook was found.
* @error Entity Outputs disabled or Invalid Entity index.
*/
native bool:UnhookSingleEntityOutput(entity, const String:output[], EntityOutput:callback);
native bool UnhookSingleEntityOutput(int entity, const char[] output, EntityOutput callback);

View File

@ -44,7 +44,7 @@
* @error Invalid client or entity, lack of mod support, or client not in
* game.
*/
native bool:RemovePlayerItem(client, item);
native bool RemovePlayerItem(int client, int item);
/**
* Gives a named item to a player.
@ -55,7 +55,7 @@ native bool:RemovePlayerItem(client, item);
* @return Entity index on success, or -1 on failure.
* @error Invalid client or client not in game, or lack of mod support.
*/
native GivePlayerItem(client, const String:item[], iSubType=0);
native int GivePlayerItem(int client, const char[] item, int iSubType=0);
/**
* Returns the weapon in a player's slot.
@ -65,7 +65,7 @@ native GivePlayerItem(client, const String:item[], iSubType=0);
* @return Entity index on success, -1 if no weapon existed.
* @error Invalid client or client not in game, or lack of mod support.
*/
native GetPlayerWeaponSlot(client, slot);
native int GetPlayerWeaponSlot(int client, int slot);
/**
* Ignites an entity on fire.
@ -75,19 +75,17 @@ native GetPlayerWeaponSlot(client, slot);
* @param npc True to only affect NPCs.
* @param size Unknown.
* @param level Unknown.
* @noreturn
* @error Invalid entity or client not in game, or lack of mod support.
*/
native IgniteEntity(entity, Float:time, bool:npc=false, Float:size=0.0, bool:level=false);
native void IgniteEntity(int entity, float time, bool npc=false, float size=0.0, bool level=false);
/**
* Extinguishes an entity that is on fire.
*
* @param entity Entity index.
* @noreturn
* @error Invalid entity or client not in game, or lack of mod support.
*/
native ExtinguishEntity(entity);
native void ExtinguishEntity(int entity);
/**
* Teleports an entity.
@ -96,19 +94,17 @@ native ExtinguishEntity(entity);
* @param origin New origin, or NULL_VECTOR for no change.
* @param angles New angles, or NULL_VECTOR for no change.
* @param velocity New velocity, or NULL_VECTOR for no change.
* @noreturn
* @error Invalid entity or client not in game, or lack of mod support.
*/
native TeleportEntity(entity, const Float:origin[3], const Float:angles[3], const Float:velocity[3]);
native void TeleportEntity(int entity, const float origin[3], const float angles[3], const float velocity[3]);
/**
* Forces a player to commit suicide.
*
* @param client Client index.
* @noreturn
* @error Invalid client or client not in game, or lack of mod support.
*/
native ForcePlayerSuicide(client);
native void ForcePlayerSuicide(int client);
/**
* Slaps a player in a random direction.
@ -116,10 +112,9 @@ native ForcePlayerSuicide(client);
* @param client Client index.
* @param health Health to subtract.
* @param sound False to disable the sound effects.
* @noreturn
* @error Invalid client or client not in game, or lack of mod support.
*/
native SlapPlayer(client, health=5, bool:sound=true);
native void SlapPlayer(int client, int health=5, bool sound=true);
/**
* Searches for an entity by classname.
@ -130,7 +125,7 @@ native SlapPlayer(client, health=5, bool:sound=true);
* @return Entity index >= 0 if found, -1 otherwise.
* @error Lack of mod support.
*/
native FindEntityByClassname(startEnt, const String:classname[]);
native int FindEntityByClassname(int startEnt, const char[] classname);
/**
* Returns the client's eye angles.
@ -140,7 +135,7 @@ native FindEntityByClassname(startEnt, const String:classname[]);
* @return True on success, false on failure.
* @error Invalid client index, client not in game, or no mod support.
*/
native bool:GetClientEyeAngles(client, Float:ang[3]);
native bool GetClientEyeAngles(int client, float ang[3]);
/**
* Creates an entity by string name, but does not spawn it (see DispatchSpawn).
@ -152,7 +147,7 @@ native bool:GetClientEyeAngles(client, Float:ang[3]);
* @return Entity index on success, or -1 on failure.
* @error Invalid edict index, or no mod support.
*/
native CreateEntityByName(const String:classname[], ForceEdictIndex=-1);
native int CreateEntityByName(const char[] classname, int ForceEdictIndex=-1);
/**
* Spawns an entity into the game.
@ -161,7 +156,7 @@ native CreateEntityByName(const String:classname[], ForceEdictIndex=-1);
* @return True on success, false otherwise.
* @error Invalid entity index, or no mod support.
*/
native bool:DispatchSpawn(entity);
native bool DispatchSpawn(int entity);
/**
* Dispatches a KeyValue into given entity using a string value.
@ -172,7 +167,7 @@ native bool:DispatchSpawn(entity);
* @return True on success, false otherwise.
* @error Invalid entity index, or no mod support.
*/
native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[]);
native bool DispatchKeyValue(int entity, const char[] keyName, const char[] value);
/**
* Dispatches a KeyValue into given entity using a floating point value.
@ -183,7 +178,7 @@ native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[
* @return True on success, false otherwise.
* @error Invalid entity index, or no mod support.
*/
native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value);
native bool DispatchKeyValueFloat(int entity, const char[] keyName, float value);
/**
* Dispatches a KeyValue into given entity using a vector value.
@ -194,7 +189,7 @@ native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value);
* @return True on success, false otherwise.
* @error Invalid entity index, or no mod support.
*/
native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:vec[3]);
native bool DispatchKeyValueVector(int entity, const char[] keyName, const float vec[3]);
/**
* Returns the entity a client is aiming at.
@ -206,7 +201,7 @@ native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:v
* -2 if the function is not supported.
* @error Invalid client index or client not in game.
*/
native GetClientAimTarget(client, bool:only_clients=true);
native int GetClientAimTarget(int client, bool only_clients=true);
/**
* Returns the total number of teams in a game.
@ -214,7 +209,7 @@ native GetClientAimTarget(client, bool:only_clients=true);
*
* @return Total number of teams.
*/
native GetTeamCount();
native int GetTeamCount();
/**
* Retrieves the team name based on a team index.
@ -223,10 +218,9 @@ native GetTeamCount();
* @param index Team index.
* @param name Buffer to store string in.
* @param maxlength Maximum length of string buffer.
* @noreturn
* @error Invalid team index.
*/
native GetTeamName(index, String:name[], maxlength);
native void GetTeamName(int index, char[] name, int maxlength);
/**
* Returns the score of a team based on a team index.
@ -236,7 +230,7 @@ native GetTeamName(index, String:name[], maxlength);
* @return Score.
* @error Invalid team index.
*/
native GetTeamScore(index);
native int GetTeamScore(int index);
/**
* Sets the score of a team based on a team index.
@ -244,10 +238,9 @@ native GetTeamScore(index);
*
* @param index Team index.
* @param value New score value.
* @return Score.
* @error Invalid team index.
*/
native SetTeamScore(index, value);
native void SetTeamScore(int index, int value);
/**
* Retrieves the number of players in a certain team.
@ -257,17 +250,25 @@ native SetTeamScore(index, value);
* @return Number of players in the team.
* @error Invalid team index.
*/
native GetTeamClientCount(index);
native int GetTeamClientCount(int index);
/**
* Returns the entity index of a team.
*
* @param teamIndex Team index.
* @return Entity index of team.
* @error Invalid team index.
*/
native int GetTeamEntity(int teamIndex);
/**
* Sets the model to a given entity.
*
* @param entity Entity index.
* @param model Model name.
* @noreturn
* @error Invalid entity index, or no mod support.
*/
native SetEntityModel(entity, const String:model[]);
native void SetEntityModel(int entity, const char[] model);
/**
* Retrieves the decal file name associated with a given client.
@ -278,7 +279,7 @@ native SetEntityModel(entity, const String:model[]);
* @return True on success, otherwise false.
* @error Invalid client or client not in game.
*/
native bool:GetPlayerDecalFile(client, String:hex[], maxlength);
native bool GetPlayerDecalFile(int client, char[] hex, int maxlength);
/**
* Retrieves the jingle file name associated with a given client.
@ -289,48 +290,53 @@ native bool:GetPlayerDecalFile(client, String:hex[], maxlength);
* @return True on success, otherwise false.
* @error Invalid client or client not in game.
*/
native bool:GetPlayerJingleFile(client, String:hex[], maxlength);
native bool GetPlayerJingleFile(int client, char[] hex, int maxlength);
/**
* Returns the average server network traffic in bytes/sec.
*
* @param in Buffer to store the input traffic velocity.
* @param out Buffer to store the output traffic velocity.
* @noreturn
*/
native GetServerNetStats(&Float:inAmount, &Float:outAmout);
native void GetServerNetStats(float &inAmount, float &outAmout);
/**
* Equip's a player's weapon.
*
* @param client Client index.
* @param weapon CBaseCombatWeapon entity index.
* @noreturn
* @error Invalid client or entity, lack of mod support, or client not in
* game.
*/
native EquipPlayerWeapon(client, weapon);
native void EquipPlayerWeapon(int client, int weapon);
/**
* Activates an entity (CBaseAnimating::Activate)
*
* @param entity Entity index.
* @noreturn
* @error Invalid entity or lack of mod support.
*/
native ActivateEntity(entity);
native void ActivateEntity(int entity);
/**
* Sets values to client info buffer keys and notifies the engine of the change.
* The change does not get propogated to mods until the next frame.
* The change does not get propagated to mods until the next frame.
*
* @param client Player's index.
* @param key Key string.
* @param value Value string.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native SetClientInfo(client, const String:key[], const String:value[]);
native void SetClientInfo(int client, const char[] key, const char[] value);
/**
* Changes a client's name.
*
* @param client Player's index.
* @param name New name.
* @error Invalid client index, or client not connected.
*/
native void SetClientName(int client, const char[] name);
/**
* Gives ammo of a certain type to a player.
@ -343,4 +349,4 @@ native SetClientInfo(client, const String:key[], const String:value[]);
*
* @return Amount of ammo actually given.
*/
native GivePlayerAmmo(client, amount, ammotype, bool:suppressSound=false);
native int GivePlayerAmmo(int client, int amount, int ammotype, bool suppressSound=false);

View File

@ -82,7 +82,7 @@ enum RoundState {
* @return Value at the given property offset.
* @error Not supported.
*/
native GameRules_GetProp(const String:prop[], size=4, element=0);
native int GameRules_GetProp(const char[] prop, int size=4, int element=0);
/**
* Sets an integer value for a property of the gamerules entity.
@ -93,11 +93,10 @@ native GameRules_GetProp(const String:prop[], size=4, element=0);
* This value is auto-detected, and the size parameter is
* only used as a fallback in case detection fails.
* @param element Element # (starting from 0) if property is an array.
* @param changeState If true, change will be sent over the network.
* @param changeState This parameter is ignored.
* @error Not supported.
* @noreturn
*/
native GameRules_SetProp(const String:prop[], any:value, size=4, element=0, bool:changeState=false);
native void GameRules_SetProp(const char[] prop, any value, int size=4, int element=0, bool changeState=false);
/**
* Retrieves a float value from a property of the gamerules entity.
@ -107,7 +106,7 @@ native GameRules_SetProp(const String:prop[], any:value, size=4, element=0, bool
* @return Value at the given property offset.
* @error Not supported.
*/
native Float:GameRules_GetPropFloat(const String:prop[], element=0);
native float GameRules_GetPropFloat(const char[] prop, int element=0);
/**
* Sets a float value for a property of the gamerules entity.
@ -115,11 +114,10 @@ native Float:GameRules_GetPropFloat(const String:prop[], element=0);
* @param prop Property name.
* @param value Value to set.
* @param element Element # (starting from 0) if property is an array.
* @param changeState If true, change will be sent over the network.
* @noreturn
* @param changeState This parameter is ignored.
* @error Not supported.
*/
native GameRules_SetPropFloat(const String:prop[], Float:value, element=0, bool:changeState=false);
native void GameRules_SetPropFloat(const char[] prop, float value, int element=0, bool changeState=false);
/**
* Retrieves a entity index from a property of the gamerules entity.
@ -131,7 +129,7 @@ native GameRules_SetPropFloat(const String:prop[], Float:value, element=0, bool:
* then -1 is returned.
* @error Not supported.
*/
native GameRules_GetPropEnt(const String:prop[], element=0);
native int GameRules_GetPropEnt(const char[] prop, int element=0);
/**
* Sets an entity index for a property of the gamerules entity.
@ -139,11 +137,10 @@ native GameRules_GetPropEnt(const String:prop[], element=0);
* @param prop Property name.
* @param other Entity index to set, or -1 to unset.
* @param element Element # (starting from 0) if property is an array.
* @param changeState If true, change will be sent over the network.
* @noreturn
* @param changeState This parameter is ignored.
* @error Not supported.
*/
native GameRules_SetPropEnt(const String:prop[], other, element=0, bool:changeState=false);
native void GameRules_SetPropEnt(const char[] prop, int other, int element=0, bool changeState=false);
/**
* Retrieves a vector of floats from the gamerules entity, given a named network property.
@ -151,10 +148,9 @@ native GameRules_SetPropEnt(const String:prop[], other, element=0, bool:changeSt
* @param prop Property name.
* @param vec Vector buffer to store data in.
* @param element Element # (starting from 0) if property is an array.
* @noreturn
* @error Not supported.
*/
native GameRules_GetPropVector(const String:prop[], Float:vec[3], element=0);
native void GameRules_GetPropVector(const char[] prop, float vec[3], int element=0);
/**
* Sets a vector of floats in the gamerules entity, given a named network property.
@ -162,11 +158,10 @@ native GameRules_GetPropVector(const String:prop[], Float:vec[3], element=0);
* @param prop Property name.
* @param vec Vector to set.
* @param element Element # (starting from 0) if property is an array.
* @param changeState If true, change will be sent over the network.
* @noreturn
* @param changeState This parameter is ignored.
* @error Not supported.
*/
native GameRules_SetPropVector(const String:prop[], const Float:vec[3], element=0, bool:changeState=false);
native void GameRules_SetPropVector(const char[] prop, const float vec[3], int element=0, bool changeState=false);
/**
* Gets a gamerules property as a string.
@ -177,18 +172,18 @@ native GameRules_SetPropVector(const String:prop[], const Float:vec[3], element=
* @return Number of non-null bytes written.
* @error Not supported.
*/
native GameRules_GetPropString(const String:prop[], String:buffer[], maxlen);
native int GameRules_GetPropString(const char[] prop, char[] buffer, int maxlen);
/**
* Sets a gamerules property as a string.
*
* @param prop Property to use.
* @param buffer String to set.
* @param changeState If true, change will be sent over the network.
* @param changeState This parameter is ignored.
* @return Number of non-null bytes written.
* @error Not supported.
*/
native GameRules_SetPropString(const String:prop[], const String:buffer[], bool:changeState=false);
native int GameRules_SetPropString(const char[] prop, const char[] buffer, bool changeState=false);
/**
* Gets the current round state.
@ -196,7 +191,7 @@ native GameRules_SetPropString(const String:prop[], const String:buffer[], bool:
* @return Round state.
* @error Game doesn't support round state.
*/
stock RoundState:GameRules_GetRoundState()
stock RoundState GameRules_GetRoundState()
{
return RoundState:GameRules_GetProp("m_iRoundState");
return view_as<RoundState>(GameRules_GetProp("m_iRoundState"));
}

View File

@ -53,7 +53,27 @@
* @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 avaliable, use FeatureType_Capability and
* @note To see if all 11 params are available, use FeatureType_Capability and
* FEATURECAP_PLAYERRUNCMD_11PARAMS.
*/
forward Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon, &subtype, &cmdnum, &tickcount, &seed, mouse[2]);
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.
*
* @param client Client index.
* @param sFile Requested file path.
*
* @return Plugin_Handled to block the transfer, Plugin_Continue to let it proceed.
*/
forward Action OnFileSend(int client, const char[] sFile);
/**
* @brief Called when a client sends a file to the server.
*
* @param client Client index.
* @param sFile Requested file path.
*
* @return Plugin_Handled to block the transfer, Plugin_Continue to let it proceed.
*/
forward Action OnFileReceive(int client, const char[] sFile);

View File

@ -92,7 +92,7 @@ enum
SNDLEVEL_RUSTLE = 20, /**< Rustling leaves */
SNDLEVEL_WHISPER = 25, /**< Whispering */
SNDLEVEL_LIBRARY = 30, /**< In a library */
SNDLEVEL_FRIDGE = 45, /**< Refridgerator */
SNDLEVEL_FRIDGE = 45, /**< Refrigerator */
SNDLEVEL_HOME = 50, /**< Average home (3.9 attn) */
SNDLEVEL_CONVO = 60, /**< Normal conversation (2.0 attn) */
SNDLEVEL_DRYER = 60, /**< Clothes dryer */
@ -125,9 +125,8 @@ enum
* Prefetches a sound.
*
* @param name Sound file name relative to the "sounds" folder.
* @noreturn
*/
native PrefetchSound(const String:name[]);
native void PrefetchSound(const char[] name);
/**
* This function is not known to work, and may crash. You should
@ -137,7 +136,7 @@ native PrefetchSound(const String:name[]);
* @return Duration in seconds.
*/
#pragma deprecated Does not work, may crash.
native Float:GetSoundDuration(const String:name[]);
native float GetSoundDuration(const char[] name);
/**
* Emits an ambient sound.
@ -150,16 +149,15 @@ native Float:GetSoundDuration(const String:name[]);
* @param vol Volume (from 0.0 to 1.0).
* @param pitch Pitch (from 0 to 255).
* @param delay Play delay.
* @noreturn
*/
native EmitAmbientSound(const String:name[],
const Float:pos[3],
entity = SOUND_FROM_WORLD,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:vol = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
Float:delay = 0.0);
native void EmitAmbientSound(const char[] name,
const float pos[3],
int entity = SOUND_FROM_WORLD,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float vol = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
float delay = 0.0);
/**
* Fades a client's volume level toward silence or a given percentage.
@ -169,10 +167,9 @@ native EmitAmbientSound(const String:name[],
* @param outtime Fade out time, in seconds.
* @param holdtime Hold time, in seconds.
* @param intime Fade in time, in seconds.
* @noreturn
* @error Invalid client index or client not in game.
*/
native FadeClientVolume(client, Float:percent, Float:outtime, Float:holdtime, Float:intime);
native void FadeClientVolume(int client, float percent, float outtime, float holdtime, float intime);
/**
* Stops a sound.
@ -180,9 +177,8 @@ native FadeClientVolume(client, Float:percent, Float:outtime, Float:holdtime, Fl
* @param entity Entity index.
* @param channel Channel number.
* @param name Sound file name relative to the "sounds" folder.
* @noreturn
*/
native StopSound(entity, channel, const String:name[]);
native void StopSound(int entity, int channel, const char[] name);
/**
* Emits a sound to a list of clients.
@ -202,31 +198,71 @@ native StopSound(entity, channel, const String:name[]);
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @param ... Optional list of Float[3] arrays to specify additional origins.
* @noreturn
* @error Invalid client index.
*/
native EmitSound(const clients[],
numClients,
const String:sample[],
entity = SOUND_FROM_PLAYER,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0,
any:...);
native void EmitSound(const int[] clients,
int numClients,
const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0,
any ...);
/**
* Emits a sound or game sound to a list of clients using the latest version of the engine sound interface.
* This native is only available in engines that are greater than or equal to Portal 2.
*
* @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 entity Entity to emit from.
* @param channel Channel to emit with.
* @param level Sound level.
* @param seed Sound seed.
* @param flags Sound flags.
* @param volume Sound volume.
* @param pitch Sound pitch.
* @param speakerentity Unknown.
* @param origin Sound origin.
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @param ... Optional list of Float[3] arrays to specify additional origins.
* @error Invalid client index.
*/
native void EmitSoundEntry(const int[] clients,
int numClients,
const char[] soundEntry,
const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int seed = 0,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0,
any ...);
/**
* Emits a sentence to a list of clients.
*
* @param clients Array of client indexes.
* @param numClients Number of clients in the array.
* @param sentence Sentence index (from PrecacheSenteFile).
* @param sentence Sentence index (from PrecacheSentenceFile).
* @param entity Entity to emit from.
* @param channel Channel to emit with.
* @param level Sound level.
@ -239,33 +275,32 @@ native EmitSound(const clients[],
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @param ... Optional list of Float[3] arrays to specify additional origins.
* @noreturn
* @error Invalid client index.
*/
native EmitSentence(const clients[],
numClients,
sentence,
entity,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0,
any:...);
native void EmitSentence(const int[] clients,
int numClients,
int sentence,
int entity,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0,
any ...);
/**
*Calculates gain of sound on given distance with given sound level in decibel
* Calculates gain of sound on given distance with given sound level in decibel
*
* @param soundlevel decibel of sound, like SNDLEVEL_NORMAL or integer value
* @param distance distance of sound to calculate, not meter or feet, but Source Engine`s normal Coordinate unit
* @return gain of sound. you can multiply this with original sound`s volume to calculate volume on given distance
*/
native Float:GetDistGainFromSoundLevel(soundlevel, Float:distance);
native float GetDistGainFromSoundLevel(int soundlevel, float distance);
/**
* Called when an ambient sound is about to be emitted to one or more clients.
@ -294,69 +329,69 @@ typedef AmbientSHook = function Action (
float &delay
);
/**
* Called when a sound is going to be emitted to one or more clients.
* NOTICE: all params can be overwritten to modify the default behaviour.
*
* @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 entity Entity emitting the sound.
* @param channel Channel emitting the sound.
* @param volume Sound volume.
* @param level Sound level.
* @param pitch Sound pitch.
* @param flags Sound flags.
* @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
* Plugin_Changed when any parameter has been modified.
*/
typedef NormalSHook = function Action (
int clients[64],
int &numClients,
char sample[PLATFORM_MAX_PATH],
int &entity,
int &channel,
float &volume,
int &level,
int &pitch,
int &flags
);
typeset NormalSHook
{
// Called when a sound is going to be emitted to one or more clients.
// NOTICE: all params can be overwritten to modify the default behavior.
//
// @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 entity Entity emitting the sound.
// @param channel Channel emitting the sound.
// @param volume Sound volume.
// @param level Sound level.
// @param pitch Sound pitch.
// @param flags Sound flags.
// @param soundEntry Game sound entry name. (Used in engines newer than Portal 2)
// @param seed Sound seed. (Used in engines newer than Portal 2)
// @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
// Plugin_Changed when any parameter has been modified.
function Action (int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH],
int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
char soundEntry[PLATFORM_MAX_PATH], int &seed);
// Deprecated. Use other prototype.
function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
char soundEntry[PLATFORM_MAX_PATH], int &seed);
// Deprecated. Use other prototype.
function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
int &entity, int &channel, float &volume, int &level, int &pitch, int &flags);
};
/**
* Hooks all played ambient sounds.
*
* @param hook Function to use as a hook.
* @noreturn
* @error Invalid function hook.
*/
native AddAmbientSoundHook(AmbientSHook:hook);
native void AddAmbientSoundHook(AmbientSHook hook);
/**
* Hooks all played normal sounds.
*
* @param hook Function to use as a hook.
* @noreturn
* @error Invalid function hook.
*/
native AddNormalSoundHook(NormalSHook:hook);
native void AddNormalSoundHook(NormalSHook hook);
/**
* Unhooks all played ambient sounds.
*
* @param hook Function used for the hook.
* @noreturn
* @error Invalid function hook.
*/
native RemoveAmbientSoundHook(AmbientSHook:hook);
native void RemoveAmbientSoundHook(AmbientSHook hook);
/**
* Unhooks all played normal sounds.
*
* @param hook Function used for the hook.
* @noreturn
* @error Invalid function hook.
*/
native RemoveNormalSoundHook(NormalSHook:hook);
native void RemoveNormalSoundHook(NormalSHook hook);
/**
* Wrapper to emit sound to one client.
@ -374,24 +409,23 @@ native RemoveNormalSoundHook(NormalSHook:hook);
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock EmitSoundToClient(client,
const String:sample[],
entity = SOUND_FROM_PLAYER,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock void EmitSoundToClient(int client,
const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[1];
int clients[1];
clients[0] = client;
/* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */
entity = (entity == SOUND_FROM_PLAYER) ? client : entity;
@ -415,26 +449,25 @@ stock EmitSoundToClient(client,
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock EmitSoundToAll(const String:sample[],
entity = SOUND_FROM_PLAYER,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock void EmitSoundToAll(const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[MaxClients];
new total = 0;
int[] clients = new int[MaxClients];
int total = 0;
for (new i=1; i<=MaxClients; i++)
for (int i=1; i<=MaxClients; i++)
{
if (IsClientInGame(i))
{
@ -459,7 +492,7 @@ stock EmitSoundToAll(const String:sample[],
* @param attn Attenuation value.
* @return Integer sound level.
*/
stock ATTN_TO_SNDLEVEL(Float:attn)
stock int ATTN_TO_SNDLEVEL(float attn)
{
if (attn > 0.0)
{
@ -488,14 +521,14 @@ stock ATTN_TO_SNDLEVEL(Float:attn)
* @return True if the sound was successfully retrieved, false if it
* was not found
*/
native bool:GetGameSoundParams(const String:gameSound[],
&channel,
&soundLevel,
&Float:volume,
&pitch,
String:sample[],
maxlength,
entity=SOUND_FROM_PLAYER);
native bool GetGameSoundParams(const char[] gameSound,
int &channel,
int &soundLevel,
float &volume,
int &pitch,
char[] sample,
int maxlength,
int entity=SOUND_FROM_PLAYER);
/**
* Emits a game sound to a list of clients.
@ -519,22 +552,22 @@ native bool:GetGameSoundParams(const String:gameSound[],
* @return True if the sound was played successfully, false if it failed
* @error Invalid client index.
*/
stock bool:EmitGameSound(const clients[],
numClients,
const String:gameSound[],
entity = SOUND_FROM_PLAYER,
flags = SND_NOFLAGS,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock bool EmitGameSound(const int[] clients,
int numClients,
const char[] gameSound,
int entity = SOUND_FROM_PLAYER,
int flags = SND_NOFLAGS,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new channel;
new level;
new Float:volume;
new pitch;
new String:sample[PLATFORM_MAX_PATH];
int channel;
int level;
float volume;
int pitch;
char sample[PLATFORM_MAX_PATH];
if (GetGameSoundParams(gameSound, channel, level, volume, pitch, sample, sizeof(sample), entity))
{
@ -561,19 +594,18 @@ stock bool:EmitGameSound(const clients[],
* @param entity Entity index to associate sound with.
* @param flags Sound flags.
* @param delay Play delay.
* @noreturn
*/
stock bool:EmitAmbientGameSound(const String:gameSound[],
const Float:pos[3],
entity = SOUND_FROM_WORLD,
flags = SND_NOFLAGS,
Float:delay = 0.0)
stock bool EmitAmbientGameSound(const char[] gameSound,
const float pos[3],
int entity = SOUND_FROM_WORLD,
int flags = SND_NOFLAGS,
float delay = 0.0)
{
new channel; // This is never actually used for Ambients, but it's a mandatory field to GetGameSoundParams
new level;
new Float:volume;
new pitch;
new String:sample[PLATFORM_MAX_PATH];
int channel; // This is never actually used for Ambients, but it's a mandatory field to GetGameSoundParams
int level;
float volume;
int pitch;
char sample[PLATFORM_MAX_PATH];
if (GetGameSoundParams(gameSound, channel, level, volume, pitch, sample, sizeof(sample), entity))
{
@ -604,20 +636,19 @@ stock bool:EmitAmbientGameSound(const String:gameSound[],
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock bool:EmitGameSoundToClient(client,
const String:gameSound[],
entity = SOUND_FROM_PLAYER,
flags = SND_NOFLAGS,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock bool EmitGameSoundToClient(int client,
const char[] gameSound,
int entity = SOUND_FROM_PLAYER,
int flags = SND_NOFLAGS,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[1];
int clients[1];
clients[0] = client;
/* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */
entity = (entity == SOUND_FROM_PLAYER) ? client : entity;
@ -642,22 +673,21 @@ stock bool:EmitGameSoundToClient(client,
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock bool:EmitGameSoundToAll(const String:gameSound[],
entity = SOUND_FROM_PLAYER,
flags = SND_NOFLAGS,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock bool EmitGameSoundToAll(const char[] gameSound,
int entity = SOUND_FROM_PLAYER,
int flags = SND_NOFLAGS,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[MaxClients];
new total = 0;
int[] clients = new int[MaxClients];
int total = 0;
for (new i=1; i<=MaxClients; i++)
for (int i=1; i<=MaxClients; i++)
{
if (IsClientInGame(i))
{
@ -692,4 +722,4 @@ stock bool:EmitGameSoundToAll(const String:gameSound[],
* @return True if the game sound was found, false if sound did not exist
* or had no files
*/
native bool:PrecacheScriptSound(const String:soundname[]);
native bool PrecacheScriptSound(const char[] soundname);

View File

@ -47,14 +47,14 @@
* -1 if no team matched.
* -2 if more than one team matched.
*/
stock FindTeamByName(const String:name[])
stock int FindTeamByName(const char[] name)
{
new name_len = strlen(name);
new num_teams = GetTeamCount();
decl String:team_name[32];
new found_team = -1;
int name_len = strlen(name);
int num_teams = GetTeamCount();
char team_name[32];
int found_team = -1;
for (new i = 0; i < num_teams; i++)
for (int i = 0; i < num_teams; i++)
{
GetTeamName(i, team_name, sizeof(team_name));
@ -73,4 +73,3 @@ stock FindTeamByName(const String:name[])
return found_team;
}

View File

@ -44,14 +44,14 @@
* @param name Name of string table to find.
* @return A string table index number if found, INVALID_STRING_TABLE otherwise.
*/
native FindStringTable(const String:name[]);
native int FindStringTable(const char[] name);
/**
* Returns the number of string tables that currently exist.
*
* @return Number of string tables that currently exist.
*/
native GetNumStringTables();
native int GetNumStringTables();
/**
* Returns the number of strings that currently exist in a given string table.
@ -60,7 +60,7 @@ native GetNumStringTables();
* @return Number of strings that currently exist.
* @error Invalid string table index.
*/
native GetStringTableNumStrings(tableidx);
native int GetStringTableNumStrings(int tableidx);
/**
* Returns the maximum number of strings that are allowed in a given string table.
@ -69,7 +69,7 @@ native GetStringTableNumStrings(tableidx);
* @return Maximum number of strings allowed.
* @error Invalid string table index.
*/
native GetStringTableMaxStrings(tableidx);
native int GetStringTableMaxStrings(int tableidx);
/**
* Retrieves the name of a string table.
@ -80,7 +80,7 @@ native GetStringTableMaxStrings(tableidx);
* @return Number of bytes written to the buffer (UTF-8 safe).
* @error Invalid string table index.
*/
native GetStringTableName(tableidx, String:name[], maxlength);
native int GetStringTableName(int tableidx, char[] name, int maxlength);
/**
* Searches for the index of a given string in a string table.
@ -90,7 +90,7 @@ native GetStringTableName(tableidx, String:name[], maxlength);
* @return String index if found, INVALID_STRING_INDEX otherwise.
* @error Invalid string table index.
*/
native FindStringIndex(tableidx, const String:str[]);
native int FindStringIndex(int tableidx, const char[] str);
/**
* Retrieves the string at a given index of a string table.
@ -102,7 +102,7 @@ native FindStringIndex(tableidx, const String:str[]);
* @return Number of bytes written to the buffer (UTF-8 safe).
* @error Invalid string table index or string index.
*/
native ReadStringTable(tableidx, stringidx, String:str[], maxlength);
native int ReadStringTable(int tableidx, int stringidx, char[] str, int maxlength);
/**
* Returns the length of the user data associated with a given string index.
@ -112,7 +112,7 @@ native ReadStringTable(tableidx, stringidx, String:str[], maxlength);
* @return Length of user data. This will be 0 if there is no user data.
* @error Invalid string table index or string index.
*/
native GetStringTableDataLength(tableidx, stringidx);
native int GetStringTableDataLength(int tableidx, int stringidx);
/**
* Retrieves the user data associated with a given string index.
@ -124,7 +124,7 @@ native GetStringTableDataLength(tableidx, stringidx);
* @return Number of bytes written to the buffer (UTF-8 safe).
* @error Invalid string table index or string index.
*/
native GetStringTableData(tableidx, stringidx, String:userdata[], maxlength);
native int GetStringTableData(int tableidx, int stringidx, char[] userdata, int maxlength);
/**
* Sets the user data associated with a given string index.
@ -136,7 +136,7 @@ native GetStringTableData(tableidx, stringidx, String:userdata[], maxlength);
* @return Number of bytes written to the buffer (UTF-8 safe).
* @error Invalid string table index or string index.
*/
native SetStringTableData(tableidx, stringidx, const String:userdata[], length);
native int SetStringTableData(int tableidx, int stringidx, const char[] userdata, int length);
/**
* Adds a string to a given string table.
@ -148,7 +148,7 @@ native SetStringTableData(tableidx, stringidx, const String:userdata[], length);
* If set to -1, then user data will be not be altered if the specified string
* already exists in the string table.
*/
native AddToStringTable(tableidx, const String:str[], const String:userdata[]="", length=-1);
native void AddToStringTable(int tableidx, const char[] str, const char[] userdata="", int length=-1);
/**
* Locks or unlocks the network string tables.
@ -157,7 +157,7 @@ native AddToStringTable(tableidx, const String:str[], const String:userdata[]=""
* True means the tables should be locked for writing; false means unlocked.
* @return Previous lock state.
*/
native bool:LockStringTables(bool:lock);
native bool LockStringTables(bool lock);
/**
* Adds a file to the downloadables network string table.
@ -165,16 +165,16 @@ native bool:LockStringTables(bool:lock);
*
* @param filename File that will be added to downloadables table.
*/
stock AddFileToDownloadsTable(const String:filename[])
stock void AddFileToDownloadsTable(const char[] filename)
{
static table = INVALID_STRING_TABLE;
static int table = INVALID_STRING_TABLE;
if (table == INVALID_STRING_TABLE)
{
table = FindStringTable("downloadables");
}
new bool:save = LockStringTables(false);
bool save = LockStringTables(false);
AddToStringTable(table, filename);
LockStringTables(save);
}

View File

@ -51,29 +51,26 @@ typedef TEHook = function Action (const char[] te_name, const int[] Players, int
*
* @param te_name TE name to hook.
* @param hook Function to use as a hook.
* @noreturn
* @error Temp Entity name not available or invalid function hook.
*/
native AddTempEntHook(const String:te_name[], TEHook:hook);
native void AddTempEntHook(const char[] te_name, TEHook hook);
/**
* Removes a temp entity hook.
*
* @param te_name TE name to unhook.
* @param hook Function used for the hook.
* @noreturn
* @error Temp Entity name not available or invalid function hook.
*/
native RemoveTempEntHook(const String:te_name[], TEHook:hook);
native void RemoveTempEntHook(const char[] te_name, TEHook hook);
/**
* Starts a temp entity transmission.
*
* @param te_name TE name.
* @noreturn
* @error Temp Entity name not available.
*/
native TE_Start(const String:te_name[]);
native void TE_Start(const char[] te_name);
/**
* Checks if a certain TE property exists.
@ -81,17 +78,16 @@ native TE_Start(const String:te_name[]);
* @param prop Property to use.
* @return True if the property exists, otherwise false.
*/
native bool:TE_IsValidProp(const String:prop[]);
native bool TE_IsValidProp(const char[] prop);
/**
* Sets an integer value in the current temp entity.
*
* @param prop Property to use.
* @param value Integer value to set.
* @noreturn
* @error Property not found.
*/
native TE_WriteNum(const String:prop[], value);
native void TE_WriteNum(const char[] prop, int value);
/**
* Reads an integer value in the current temp entity.
@ -100,56 +96,52 @@ native TE_WriteNum(const String:prop[], value);
* @return Property value.
* @error Property not found.
*/
native TE_ReadNum(const String:prop[]);
native int TE_ReadNum(const char[] prop);
/**
* Sets a floating point number in the current temp entity.
*
* @param prop Property to use.
* @param value Floating point number to set.
* @noreturn
* @error Property not found.
*/
native TE_WriteFloat(const String:prop[], Float:value);
native void TE_WriteFloat(const char[] prop, float value);
/**
* Reads a floating point number in the current temp entity.
*
* @param prop Property to use.
* @noreturn Property value.
* @return Property value.
* @error Property not found.
*/
native Float:TE_ReadFloat(const String:prop[]);
native float TE_ReadFloat(const char[] prop);
/**
* Sets a vector in the current temp entity.
*
* @param prop Property to use.
* @param vector Vector to set.
* @noreturn
* @error Property not found.
*/
native TE_WriteVector(const String:prop[], const Float:vector[3]);
native void TE_WriteVector(const char[] prop, const float vector[3]);
/**
* Reads a vector in the current temp entity.
*
* @param prop Property to use.
* @param vector Vector to read.
* @noreturn
* @error Property not found.
*/
native TE_ReadVector(const String:prop[], Float:vector[3]);
native void TE_ReadVector(const char[] prop, float vector[3]);
/**
* Sets a QAngle in the current temp entity.
*
* @param prop Property to use.
* @param angles Angles to set.
* @return True on success, otherwise false.
* @error Property not found.
*/
native TE_WriteAngles(const String:prop[], const Float:angles[3]);
native void TE_WriteAngles(const char[] prop, const float angles[3]);
/**
* Sets an array of floats in the current temp entity.
@ -157,10 +149,9 @@ native TE_WriteAngles(const String:prop[], const Float:angles[3]);
* @param prop Property to use.
* @param array Array of values to copy.
* @param arraySize Number of values to copy.
* @return True on success, otherwise false.
* @error Property not found.
*/
native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize);
native void TE_WriteFloatArray(const char[] prop, const float[] array, int arraySize);
/**
* Sends the current temp entity to one or more clients.
@ -168,10 +159,9 @@ native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize);
* @param clients Array containing player indexes to broadcast to.
* @param numClients Number of players in the array.
* @param delay Delay in seconds to send the TE.
* @noreturn
* @error Invalid client index or client not in game.
*/
native TE_Send(const clients[], numClients, Float:delay=0.0);
native void TE_Send(const int[] clients, int numClients, float delay=0.0);
/**
* Sets an encoded entity index in the current temp entity.
@ -179,13 +169,12 @@ native TE_Send(const clients[], numClients, Float:delay=0.0);
*
* @param prop Property to use.
* @param value Value to set.
* @noreturn
* @error Property not found.
*/
stock TE_WriteEncodedEnt(const String:prop[], value)
stock void TE_WriteEncodedEnt(const char[] prop, int value)
{
new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12);
return TE_WriteNum(prop, encvalue);
int encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12);
TE_WriteNum(prop, encvalue);
}
/**
@ -193,20 +182,19 @@ stock TE_WriteEncodedEnt(const String:prop[], value)
* @note See TE_Start().
*
* @param delay Delay in seconds to send the TE.
* @noreturn
*/
stock TE_SendToAll(Float:delay=0.0)
stock void TE_SendToAll(float delay=0.0)
{
new total = 0;
new clients[MaxClients];
for (new i=1; i<=MaxClients; i++)
int total = 0;
int[] clients = new int[MaxClients];
for (int i=1; i<=MaxClients; i++)
{
if (IsClientInGame(i))
{
clients[total++] = i;
}
}
return TE_Send(clients, total, delay);
TE_Send(clients, total, delay);
}
/**
@ -215,14 +203,30 @@ stock TE_SendToAll(Float:delay=0.0)
*
* @param client Client to send to.
* @param delay Delay in seconds to send the TE.
* @noreturn
* @error Invalid client index or client not in game.
*/
stock TE_SendToClient(client, Float:delay=0.0)
stock void TE_SendToClient(int client, float delay=0.0)
{
new players[1];
int players[1];
players[0] = client;
return TE_Send(players, 1, delay);
TE_Send(players, 1, delay);
}
/**
* Sends the current TE to all clients that are in
* visible or audible range of the origin.
* @note See TE_Start().
* @note See GetClientsInRange()
*
* @param origin Coordinates from which to test range.
* @param rangeType Range type to use for filtering clients.
* @param delay Delay in seconds to send the TE.
*/
stock void TE_SendToAllInRange(float origin[3], ClientRangeType rangeType, float delay=0.0)
{
int[] clients = new int[MaxClients];
int total = GetClientsInRange(origin, rangeType, clients, MaxClients);
TE_Send(clients, total, delay);
}

View File

@ -83,9 +83,8 @@
* @param dir Direction of the sparks.
* @param Magnitude Sparks size.
* @param TrailLength Trail lenght of the sparks.
* @noreturn
*/
stock TE_SetupSparks(const Float:pos[3], const Float:dir[3], Magnitude, TrailLength)
stock void TE_SetupSparks(const float pos[3], const float dir[3], int Magnitude, int TrailLength)
{
TE_Start("Sparks");
TE_WriteVector("m_vecOrigin[0]", pos);
@ -101,9 +100,8 @@ stock TE_SetupSparks(const Float:pos[3], const Float:dir[3], Magnitude, TrailLen
* @param Model Precached model index.
* @param Scale Scale of the smoke.
* @param FrameRate Frame rate of the smoke.
* @noreturn
*/
stock TE_SetupSmoke(const Float:pos[3], Model, Float:Scale, FrameRate)
stock void TE_SetupSmoke(const float pos[3], int Model, float Scale, int FrameRate)
{
TE_Start("Smoke");
TE_WriteVector("m_vecOrigin", pos);
@ -119,9 +117,8 @@ stock TE_SetupSmoke(const Float:pos[3], Model, Float:Scale, FrameRate)
* @param dir Direction of the dust.
* @param Size Dust cloud size.
* @param Speed Dust cloud speed.
* @noreturn
*/
stock TE_SetupDust(const Float:pos[3], const Float:dir[3], Float:Size, Float:Speed)
stock void TE_SetupDust(const float pos[3], const float dir[3], float Size, float Speed)
{
TE_Start("Dust");
TE_WriteVector("m_vecOrigin[0]", pos);
@ -137,9 +134,8 @@ stock TE_SetupDust(const Float:pos[3], const Float:dir[3], Float:Size, Float:Spe
* @param angles Rotation angles of the muzzle flash.
* @param Scale Scale of the muzzle flash.
* @param Type Muzzle flash type to render (Mod specific).
* @noreturn
*/
stock TE_SetupMuzzleFlash(const Float:pos[3], const Float:angles[3], Float:Scale, Type)
stock void TE_SetupMuzzleFlash(const float pos[3], const float angles[3], float Scale, int Type)
{
TE_Start("MuzzleFlash");
TE_WriteVector("m_vecOrigin", pos);
@ -153,9 +149,8 @@ stock TE_SetupMuzzleFlash(const Float:pos[3], const Float:angles[3], Float:Scale
*
* @param pos Position of the metal sparks.
* @param dir Direction of the metal sparks.
* @noreturn
*/
stock TE_SetupMetalSparks(const Float:pos[3], const Float:dir[3])
stock void TE_SetupMetalSparks(const float pos[3], const float dir[3])
{
TE_Start("Metal Sparks");
TE_WriteVector("m_vecPos", pos);
@ -168,9 +163,8 @@ stock TE_SetupMetalSparks(const Float:pos[3], const Float:dir[3])
* @param pos Position of the energy splash.
* @param dir Direction of the energy splash.
* @param Explosive Makes the effect explosive.
* @noreturn
*/
stock TE_SetupEnergySplash(const Float:pos[3], const Float:dir[3], bool:Explosive)
stock void TE_SetupEnergySplash(const float pos[3], const float dir[3], bool Explosive)
{
TE_Start("Energy Splash");
TE_WriteVector("m_vecPos", pos);
@ -182,10 +176,9 @@ stock TE_SetupEnergySplash(const Float:pos[3], const Float:dir[3], bool:Explosiv
* Sets up an armor ricochet effect.
*
* @param pos Position of the armor ricochet.
* @param dir Directon of the armor ricochet.
* @noreturn
* @param dir Direction of the armor ricochet.
*/
stock TE_SetupArmorRicochet(const Float:pos[3], const Float:dir[3])
stock void TE_SetupArmorRicochet(const float pos[3], const float dir[3])
{
TE_Start("Armor Ricochet");
TE_WriteVector("m_vecPos", pos);
@ -200,9 +193,8 @@ stock TE_SetupArmorRicochet(const Float:pos[3], const Float:dir[3])
* @param Life Time duration of the sprite.
* @param Size Sprite size.
* @param Brightness Sprite brightness.
* @noreturn
*/
stock TE_SetupGlowSprite(const Float:pos[3], Model, Float:Life, Float:Size, Brightness)
stock void TE_SetupGlowSprite(const float pos[3], int Model, float Life, float Size, int Brightness)
{
TE_Start("GlowSprite");
TE_WriteVector("m_vecOrigin", pos);
@ -224,9 +216,8 @@ stock TE_SetupGlowSprite(const Float:pos[3], Model, Float:Life, Float:Size, Brig
* @param Magnitude Explosion size.
* @param normal Normal vector to the explosion.
* @param MaterialType Exploded material type.
* @noreturn
*/
stock TE_SetupExplosion(const Float:pos[3], Model, Float:Scale, Framerate, Flags, Radius, Magnitude, const Float:normal[3]={0.0, 0.0, 1.0}, MaterialType='C')
stock void TE_SetupExplosion(const float pos[3], int Model, float Scale, int Framerate, int Flags, int Radius, int Magnitude, const float normal[3]={0.0, 0.0, 1.0}, int MaterialType='C')
{
TE_Start("Explosion");
TE_WriteVector("m_vecOrigin[0]", pos);
@ -249,9 +240,8 @@ stock TE_SetupExplosion(const Float:pos[3], Model, Float:Scale, Framerate, Flags
* @param Size Sprite size.
* @param SprayModel Precached model index.
* @param BloodDropModel Precached model index.
* @noreturn
*/
stock TE_SetupBloodSprite(const Float:pos[3], const Float:dir[3], const color[4], Size, SprayModel, BloodDropModel)
stock void TE_SetupBloodSprite(const float pos[3], const float dir[3], const int color[4], int Size, int SprayModel, int BloodDropModel)
{
TE_Start("Blood Sprite");
TE_WriteVector("m_vecOrigin", pos);
@ -273,7 +263,7 @@ stock TE_SetupBloodSprite(const Float:pos[3], const Float:dir[3], const color[4]
* @param End_Radius Final ring radius.
* @param ModelIndex Precached model index.
* @param HaloIndex Precached model index.
* @param StartFrame Initital frame to render.
* @param StartFrame Initial frame to render.
* @param FrameRate Ring frame rate.
* @param Life Time duration of the ring.
* @param Width Beam width.
@ -281,10 +271,9 @@ stock TE_SetupBloodSprite(const Float:pos[3], const Float:dir[3], const color[4]
* @param Color Color array (r, g, b, a).
* @param Speed Speed of the beam.
* @param Flags Beam flags.
* @noreturn
*/
stock TE_SetupBeamRingPoint(const Float:center[3], Float:Start_Radius, Float:End_Radius, ModelIndex, HaloIndex, StartFrame,
FrameRate, Float:Life, Float:Width, Float:Amplitude, const Color[4], Speed, Flags)
stock void TE_SetupBeamRingPoint(const float center[3], float Start_Radius, float End_Radius, int ModelIndex, int HaloIndex, int StartFrame,
int FrameRate, float Life, float Width, float Amplitude, const int Color[4], int Speed, int Flags)
{
TE_Start("BeamRingPoint");
TE_WriteVector("m_vecCenter", center);
@ -314,7 +303,7 @@ stock TE_SetupBeamRingPoint(const Float:center[3], Float:Start_Radius, Float:End
* @param end End position of the beam.
* @param ModelIndex Precached model index.
* @param HaloIndex Precached model index.
* @param StartFrame Initital frame to render.
* @param StartFrame Initial frame to render.
* @param FrameRate Beam frame rate.
* @param Life Time duration of the beam.
* @param Width Initial beam width.
@ -323,10 +312,9 @@ stock TE_SetupBeamRingPoint(const Float:center[3], Float:Start_Radius, Float:End
* @param Amplitude Beam amplitude.
* @param Color Color array (r, g, b, a).
* @param Speed Speed of the beam.
* @noreturn
*/
stock TE_SetupBeamPoints(const Float:start[3], const Float:end[3], ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life,
Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
stock void TE_SetupBeamPoints(const float start[3], const float end[3], int ModelIndex, int HaloIndex, int StartFrame, int FrameRate, float Life,
float Width, float EndWidth, int FadeLength, float Amplitude, const int Color[4], int Speed)
{
TE_Start("BeamPoints");
TE_WriteVector("m_vecStartPoint", start);
@ -354,7 +342,7 @@ stock TE_SetupBeamPoints(const Float:start[3], const Float:end[3], ModelIndex, H
* @param EndEntity Entity index from where the beam ends.
* @param ModelIndex Precached model index.
* @param HaloIndex Precached model index.
* @param StartFrame Initital frame to render.
* @param StartFrame Initial frame to render.
* @param FrameRate Beam frame rate.
* @param Life Time duration of the beam.
* @param Width Initial beam width.
@ -363,10 +351,9 @@ stock TE_SetupBeamPoints(const Float:start[3], const Float:end[3], ModelIndex, H
* @param Amplitude Beam amplitude.
* @param Color Color array (r, g, b, a).
* @param Speed Speed of the beam.
* @noreturn
*/
stock TE_SetupBeamLaser(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life,
Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
stock void TE_SetupBeamLaser(int StartEntity, int EndEntity, int ModelIndex, int HaloIndex, int StartFrame, int FrameRate, float Life,
float Width, float EndWidth, int FadeLength, float Amplitude, const int Color[4], int Speed)
{
TE_Start("BeamLaser");
TE_WriteEncodedEnt("m_nStartEntity", StartEntity);
@ -394,7 +381,7 @@ stock TE_SetupBeamLaser(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFram
* @param EndEntity Entity index from where the ring ends.
* @param ModelIndex Precached model index.
* @param HaloIndex Precached model index.
* @param StartFrame Initital frame to render.
* @param StartFrame Initial frame to render.
* @param FrameRate Ring frame rate.
* @param Life Time duration of the ring.
* @param Width Beam width.
@ -402,9 +389,8 @@ stock TE_SetupBeamLaser(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFram
* @param Color Color array (r, g, b, a).
* @param Speed Speed of the beam.
* @param Flags Beam flags.
* @noreturn
*/
stock TE_SetupBeamRing(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life, Float:Width, Float:Amplitude, const Color[4], Speed, Flags)
stock void TE_SetupBeamRing(int StartEntity, int EndEntity, int ModelIndex, int HaloIndex, int StartFrame, int FrameRate, float Life, float Width, float Amplitude, const int Color[4], int Speed, int Flags)
{
TE_Start("BeamRing");
TE_WriteEncodedEnt("m_nStartEntity", StartEntity);
@ -437,9 +423,8 @@ stock TE_SetupBeamRing(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame
* @param EndWidth Final beam width.
* @param FadeLength Beam fade time duration.
* @param Color Color array (r, g, b, a).
* @noreturn
*/
stock TE_SetupBeamFollow(EntIndex, ModelIndex, HaloIndex, Float:Life, Float:Width, Float:EndWidth, FadeLength, const Color[4])
stock void TE_SetupBeamFollow(int EntIndex, int ModelIndex, int HaloIndex, float Life, float Width, float EndWidth, int FadeLength, const int Color[4])
{
TE_Start("BeamFollow");
TE_WriteEncodedEnt("m_iEntIndex", EntIndex);

View File

@ -71,7 +71,7 @@
* @endsection
*/
#define CONTENTS_ORIGIN 0x1000000 /**< removed before bsping an entity. */
#define CONTENTS_ORIGIN 0x1000000 /**< removed before bsp-ing an entity. */
#define CONTENTS_MONSTER 0x2000000 /**< should never be on a brush, only in game. */
#define CONTENTS_DEBRIS 0x4000000
#define CONTENTS_DETAIL 0x8000000 /**< brushes to be added after vis leafs. */
@ -139,7 +139,7 @@ typeset TraceEntityFilter
* @param entindex Entity index found at the given position (by reference).
* @return Contents mask.
*/
native TR_GetPointContents(const Float:pos[3], &entindex=-1);
native int TR_GetPointContents(const float pos[3], int &entindex=-1);
/**
* Get the point contents testing only the given entity index.
@ -148,7 +148,7 @@ native TR_GetPointContents(const Float:pos[3], &entindex=-1);
* @param pos World position.
* @return Contents mask.
*/
native TR_GetPointContentsEnt(entindex, const Float:pos[3]);
native int TR_GetPointContentsEnt(int entindex, const float pos[3]);
/**
* Starts up a new trace ray using a global trace result.
@ -158,12 +158,11 @@ native TR_GetPointContentsEnt(entindex, const Float:pos[3]);
* ending point, or the direction angle.
* @param flags Trace flags.
* @param rtype Method to calculate the ray direction.
* @noreturn
*/
native TR_TraceRay(const Float:pos[3],
const Float:vec[3],
flags,
RayType:rtype);
native void TR_TraceRay(const float pos[3],
const float vec[3],
int flags,
RayType rtype);
/**
* Starts up a new trace hull using a global trace result.
@ -173,13 +172,12 @@ native TR_TraceRay(const Float:pos[3],
* @param mins Hull minimum size.
* @param maxs Hull maximum size.
* @param flags Trace flags.
* @noreturn
*/
native TR_TraceHull(const Float:pos[3],
const Float:vec[3],
const Float:mins[3],
const Float:maxs[3],
flags);
native void TR_TraceHull(const float pos[3],
const float vec[3],
const float mins[3],
const float maxs[3],
int flags);
/**
* Starts up a new trace ray using a global trace result and a customized
@ -196,14 +194,13 @@ native TR_TraceHull(const Float:pos[3],
* @param filter Function to use as a filter.
* @param data Arbitrary data value to pass through to the filter
* function.
* @noreturn
*/
native TR_TraceRayFilter(const Float:pos[3],
const Float:vec[3],
flags,
RayType:rtype,
TraceEntityFilter:filter,
any:data=0);
native void TR_TraceRayFilter(const float pos[3],
const float vec[3],
int flags,
RayType rtype,
TraceEntityFilter filter,
any data=0);
/**
* Starts up a new trace hull using a global trace result and a customized
@ -221,15 +218,14 @@ native TR_TraceRayFilter(const Float:pos[3],
* @param filter Function to use as a filter.
* @param data Arbitrary data value to pass through to the filter
* function.
* @noreturn
*/
native TR_TraceHullFilter(const Float:pos[3],
const Float:vec[3],
const Float:mins[3],
const Float:maxs[3],
flags,
TraceEntityFilter:filter,
any:data=0);
native void TR_TraceHullFilter(const float pos[3],
const float vec[3],
const float mins[3],
const float maxs[3],
int flags,
TraceEntityFilter filter,
any data=0);
/**
* Starts up a new trace ray using a new trace result.
@ -241,10 +237,10 @@ native TR_TraceHullFilter(const Float:pos[3],
* @param rtype Method to calculate the ray direction.
* @return Ray trace handle, which must be closed via CloseHandle().
*/
native Handle:TR_TraceRayEx(const Float:pos[3],
const Float:vec[3],
flags,
RayType:rtype);
native Handle TR_TraceRayEx(const float pos[3],
const float vec[3],
int flags,
RayType rtype);
/**
* Starts up a new trace hull using a new trace result.
@ -256,11 +252,11 @@ native Handle:TR_TraceRayEx(const Float:pos[3],
* @param flags Trace flags.
* @return Ray trace handle, which must be closed via CloseHandle().
*/
native Handle:TR_TraceHullEx(const Float:pos[3],
const Float:vec[3],
const Float:mins[3],
const Float:maxs[3],
flags);
native Handle TR_TraceHullEx(const float pos[3],
const float vec[3],
const float mins[3],
const float maxs[3],
int flags);
/**
* Starts up a new trace ray using a new trace result and a customized
@ -278,12 +274,12 @@ native Handle:TR_TraceHullEx(const Float:pos[3],
* @param data Arbitrary data value to pass through to the filter function.
* @return Ray trace handle, which must be closed via CloseHandle().
*/
native Handle:TR_TraceRayFilterEx(const Float:pos[3],
const Float:vec[3],
flags,
RayType:rtype,
TraceEntityFilter:filter,
any:data=0);
native Handle TR_TraceRayFilterEx(const float pos[3],
const float vec[3],
int flags,
RayType rtype,
TraceEntityFilter filter,
any data=0);
/**
* Starts up a new trace hull using a new trace result and a customized
@ -301,13 +297,13 @@ native Handle:TR_TraceRayFilterEx(const Float:pos[3],
* @param data Arbitrary data value to pass through to the filter function.
* @return Ray trace handle, which must be closed via CloseHandle().
*/
native Handle:TR_TraceHullFilterEx(const Float:pos[3],
const Float:vec[3],
const Float:mins[3],
const Float:maxs[3],
flags,
TraceEntityFilter:filter,
any:data=0);
native Handle TR_TraceHullFilterEx(const float pos[3],
const float vec[3],
const float mins[3],
const float maxs[3],
int flags,
TraceEntityFilter filter,
any data=0);
/**
* Returns the time fraction from a trace result (1.0 means no collision).
@ -316,17 +312,16 @@ native Handle:TR_TraceHullFilterEx(const Float:pos[3],
* @return Time fraction value of the trace.
* @error Invalid Handle.
*/
native Float:TR_GetFraction(Handle:hndl=INVALID_HANDLE);
native float TR_GetFraction(Handle hndl=INVALID_HANDLE);
/**
* Returns the collision position of a trace result.
*
* @param pos Vector buffer to store data in.
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
* @noreturn
* @error Invalid Handle.
*/
native TR_GetEndPosition(Float:pos[3], Handle:hndl=INVALID_HANDLE);
native void TR_GetEndPosition(float pos[3], Handle hndl=INVALID_HANDLE);
/**
* Returns the entity index that collided with the trace.
@ -335,7 +330,7 @@ native TR_GetEndPosition(Float:pos[3], Handle:hndl=INVALID_HANDLE);
* @return Entity index or -1 for no collision.
* @error Invalid Handle.
*/
native TR_GetEntityIndex(Handle:hndl=INVALID_HANDLE);
native int TR_GetEntityIndex(Handle hndl=INVALID_HANDLE);
/**
* Returns if there was any kind of collision along the trace ray.
@ -344,7 +339,7 @@ native TR_GetEntityIndex(Handle:hndl=INVALID_HANDLE);
* @return True if any collision found, otherwise false.
* @error Invalid Handle.
*/
native bool:TR_DidHit(Handle:hndl=INVALID_HANDLE);
native bool TR_DidHit(Handle hndl=INVALID_HANDLE);
/**
* Returns in which body hit group the trace collided if any.
@ -353,17 +348,16 @@ native bool:TR_DidHit(Handle:hndl=INVALID_HANDLE);
* @return Body hit group.
* @error Invalid Handle.
*/
native TR_GetHitGroup(Handle:hndl=INVALID_HANDLE);
native int TR_GetHitGroup(Handle hndl=INVALID_HANDLE);
/**
* Find the normal vector to the collison plane of a trace.
* Find the normal vector to the collision plane of a trace.
*
* @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
* @param normal Vector buffer to store the vector normal to the collision plane
* @noreturn
* @error Invalid Handle
*/
native TR_GetPlaneNormal(Handle:hndl, Float:normal[3]);
native void TR_GetPlaneNormal(Handle hndl, float normal[3]);
/**
* Tests a point to see if it's outside any playable area
@ -371,4 +365,4 @@ native TR_GetPlaneNormal(Handle:hndl, Float:normal[3]);
* @param pos Vector buffer to store data in.
* @return True if outside world, otherwise false.
*/
native TR_PointOutsideWorld(Float:pos[3]);
native bool TR_PointOutsideWorld(float pos[3]);

View File

@ -61,9 +61,8 @@ enum ListenOverride
*
* @param client The client index
* @param flags The voice flags
* @noreturn
*/
native SetClientListeningFlags(client, flags);
native void SetClientListeningFlags(int client, int flags);
/**
* Retrieve the client current listening flags.
@ -71,7 +70,7 @@ native SetClientListeningFlags(client, flags);
* @param client The client index
* @return The current voice flags
*/
native GetClientListeningFlags(client);
native int GetClientListeningFlags(int client);
/**
* Set the receiver ability to listen to the sender.
@ -82,7 +81,7 @@ native GetClientListeningFlags(client);
* @return True if successful otherwise false.
*/
#pragma deprecated Use SetListenOverride() instead
native bool:SetClientListening(iReceiver, iSender, bool:bListen);
native bool SetClientListening(int iReceiver, int iSender, bool bListen);
/**
* Retrieves if the receiver can listen to the sender.
@ -92,7 +91,7 @@ native bool:SetClientListening(iReceiver, iSender, bool:bListen);
* @return True if successful otherwise false.
*/
#pragma deprecated GetListenOverride() instead
native bool:GetClientListening(iReceiver, iSender);
native bool GetClientListening(int iReceiver, int iSender);
/**
* Override the receiver's ability to listen to the sender.
@ -102,7 +101,7 @@ native bool:GetClientListening(iReceiver, iSender);
* @param override The override of the receiver's ability to listen to the sender.
* @return True if successful otherwise false.
*/
native bool:SetListenOverride(iReceiver, iSender, ListenOverride:override);
native bool SetListenOverride(int iReceiver, int iSender, ListenOverride override);
/**
* Retrieves the override of the receiver's ability to listen to the sender.
@ -111,7 +110,7 @@ native bool:SetListenOverride(iReceiver, iSender, ListenOverride:override);
* @param iSender The sender index.
* @return The override value.
*/
native ListenOverride:GetListenOverride(iReceiver, iSender);
native ListenOverride GetListenOverride(int iReceiver, int iSender);
/**
* Retrieves if the muter has muted the mutee.
@ -120,5 +119,4 @@ native ListenOverride:GetListenOverride(iReceiver, iSender);
* @param iMutee The mutee index.
* @return True if muter has muted mutee, false otherwise.
*/
native bool:IsClientMuted(iMuter, iMutee);
native bool IsClientMuted(int iMuter, int iMutee);

View File

@ -62,9 +62,8 @@ enum SortType
* @param array Array of integers to sort in-place.
* @param array_size Size of the array.
* @param order Sorting order to use.
* @noreturn
*/
native SortIntegers(array[], array_size, SortOrder:order = Sort_Ascending);
native void SortIntegers(int[] array, int array_size, SortOrder order = Sort_Ascending);
/**
* Sorts an array of float point numbers.
@ -72,9 +71,8 @@ native SortIntegers(array[], array_size, SortOrder:order = Sort_Ascending);
* @param array Array of floating point numbers to sort in-place.
* @param array_size Size of the array.
* @param order Sorting order to use.
* @noreturn
*/
native SortFloats(Float:array[], array_size, SortOrder:order = Sort_Ascending);
native void SortFloats(float[] array, int array_size, SortOrder order = Sort_Ascending);
/**
* Sorts an array of strings.
@ -82,9 +80,8 @@ native SortFloats(Float:array[], array_size, SortOrder:order = Sort_Ascending);
* @param array Array of strings to sort in-place.
* @param array_size Size of the array.
* @param order Sorting order to use.
* @noreturn
*/
native SortStrings(String:array[][], array_size, SortOrder:order = Sort_Ascending);
native void SortStrings(char[][] array, int array_size, SortOrder order = Sort_Ascending);
/**
* Sort comparison function for 1D array elements.
@ -107,9 +104,8 @@ typedef SortFunc1D = function int (int elem1, int elem2, const int[] array, Hand
* @param array_size Size of the array to sort.
* @param sortfunc Sort function.
* @param hndl Optional Handle to pass through the comparison calls.
* @noreturn
*/
native SortCustom1D(array[], array_size, SortFunc1D:sortfunc, Handle:hndl=INVALID_HANDLE);
native void SortCustom1D(int[] array, int array_size, SortFunc1D sortfunc, Handle hndl=INVALID_HANDLE);
/**
* Sort comparison function for 2D array elements (sub-arrays).
@ -136,9 +132,8 @@ typeset SortFunc2D
* @param array_size Size of the major array to sort (first index, outermost).
* @param sortfunc Sort comparison function to use.
* @param hndl Optional Handle to pass through the comparison calls.
* @noreturn
*/
native SortCustom2D(array[][], array_size, SortFunc2D:sortfunc, Handle:hndl=INVALID_HANDLE);
native void SortCustom2D(any[][] array, int array_size, SortFunc2D sortfunc, Handle hndl=INVALID_HANDLE);
/**
* Sort an ADT Array. Specify the type as Integer, Float, or String.
@ -146,9 +141,8 @@ native SortCustom2D(array[][], array_size, SortFunc2D:sortfunc, Handle:hndl=INVA
* @param array Array Handle to sort
* @param order Sort order to use, same as other sorts.
* @param type Data type stored in the ADT Array
* @noreturn
*/
native SortADTArray(Handle:array, SortOrder:order, SortType:type);
native void SortADTArray(Handle array, SortOrder order, SortType type);
/**
* Sort comparison function for ADT Array elements. Function provides you with
@ -169,8 +163,7 @@ typedef SortFuncADTArray = function int (int index1, int index2, Handle array, H
* Custom sorts an ADT Array. You must pass in a comparison function.
*
* @param array Array Handle to sort
* @param sortfunc Sort comparision function to use
* @param sortfunc Sort comparison function to use
* @param hndl Optional Handle to pass through the comparison calls.
* @noreturn
*/
native SortADTArrayCustom(Handle:array, SortFuncADTArray:sortfunc, Handle:hndl=INVALID_HANDLE);
native void SortADTArrayCustom(Handle array, SortFuncADTArray sortfunc, Handle hndl=INVALID_HANDLE);

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@
* @param str String to check.
* @return Number of valid character bytes in the string.
*/
native strlen(const String:str[]);
native int strlen(const char[] str);
/**
* Tests whether a string is found inside another string.
@ -60,7 +60,7 @@ native strlen(const String:str[]);
* @return -1 on failure (no match found). Any other value
* indicates a position in the string where the match starts.
*/
native StrContains(const String:str[], const String:substr[], bool:caseSensitive=true);
native int StrContains(const char[] str, const char[] substr, bool caseSensitive=true);
/**
* Compares two strings lexographically.
@ -73,7 +73,7 @@ native StrContains(const String:str[], const String:substr[], bool:caseSensitive
* 0 if str1 == str2
* 1 if str1 > str2
*/
native strcmp(const String:str1[], const String:str2[], bool:caseSensitive=true);
native int strcmp(const char[] str1, const char[] str2, bool caseSensitive=true);
/**
* Compares two strings parts lexographically.
@ -87,14 +87,14 @@ native strcmp(const String:str1[], const String:str2[], bool:caseSensitive=true)
* 0 if str1 == str2
* 1 if str1 > str2
*/
native strncmp(const String:str1[], const String:str2[], num, bool:caseSensitive=true);
native int strncmp(const char[] str1, const char[] str2, int num, bool caseSensitive=true);
/**
* Backwards compatible stock - StrCompare is now strcmp
* @deprecated Renamed to strcmp
*/
#pragma deprecated Use strcmp() instead
stock StrCompare(const String:str1[], const String:str2[], bool:caseSensitive=true)
stock int StrCompare(const char[] str1, const char[] str2, bool caseSensitive=true)
{
return strcmp(str1, str2, caseSensitive);
}
@ -108,7 +108,7 @@ stock StrCompare(const String:str1[], const String:str2[], bool:caseSensitive=tr
* If false, comparison is case insensitive.
* @return True if equal, false otherwise.
*/
stock bool:StrEqual(const String:str1[], const String:str2[], bool:caseSensitive=true)
stock bool StrEqual(const char[] str1, const char[] str2, bool caseSensitive=true)
{
return (strcmp(str1, str2, caseSensitive) == 0);
}
@ -123,14 +123,14 @@ stock bool:StrEqual(const String:str1[], const String:str2[], bool:caseSensitive
* @param source Source string buffer to copy from.
* @return Number of cells written.
*/
native strcopy(String:dest[], destLen, const String:source[]);
native int strcopy(char[] dest, int destLen, const char[] source);
/**
* Backwards compatibility stock - use strcopy
* @deprecated Renamed to strcopy
*/
#pragma deprecated Use strcopy() instead
stock StrCopy(String:dest[], destLen, const String:source[])
stock int StrCopy(char[] dest, int destLen, const char[] source)
{
return strcopy(dest, destLen, source);
}
@ -144,7 +144,7 @@ stock StrCopy(String:dest[], destLen, const String:source[])
* @param ... Variable number of format parameters.
* @return Number of cells written.
*/
native Format(String:buffer[], maxlength, const String:format[], any:...);
native int Format(char[] buffer, int maxlength, const char[] format, any ...);
/**
* Formats a string according to the SourceMod format rules (see documentation).
@ -158,7 +158,7 @@ native Format(String:buffer[], maxlength, const String:format[], any:...);
* @param ... Variable number of format parameters.
* @return Number of cells written.
*/
native FormatEx(String:buffer[], maxlength, const String:format[], any:...);
native int FormatEx(char[] buffer, int maxlength, const char[] format, any ...);
/**
* Formats a string according to the SourceMod format rules (see documentation).
@ -173,7 +173,7 @@ native FormatEx(String:buffer[], maxlength, const String:format[], any:...);
* Note: Arguments start at 1.
* @return Number of bytes written.
*/
native VFormat(String:buffer[], maxlength, const String:format[], varpos);
native int VFormat(char[] buffer, int maxlength, const char[] format, int varpos);
/**
* Converts a string to an integer.
@ -182,7 +182,7 @@ native VFormat(String:buffer[], maxlength, const String:format[], varpos);
* @param nBase Numerical base to use. 10 is default.
* @return Integer conversion of string, or 0 on failure.
*/
native StringToInt(const String:str[], nBase=10);
native int StringToInt(const char[] str, int nBase=10);
/**
* Converts a string to an integer with some more options.
@ -192,7 +192,7 @@ native StringToInt(const String:str[], nBase=10);
* @param nBase Numerical base to use. 10 is default.
* @return Number of characters consumed.
*/
native StringToIntEx(const String:str[], &result, nBase=10);
native int StringToIntEx(const char[] str, int &result, int nBase=10);
/**
* Converts an integer to a string.
@ -202,24 +202,24 @@ native StringToIntEx(const String:str[], &result, nBase=10);
* @param maxlength Maximum length of string buffer.
* @return Number of cells written to buffer.
*/
native IntToString(num, String:str[], maxlength);
native int IntToString(int num, char[] str, int maxlength);
/**
* Converts a string to a floating point number.
*
* @param str String to convert to a foat.
* @param str String to convert to a float.
* @return Floating point result, or 0.0 on error.
*/
native Float:StringToFloat(const String:str[]);
native float StringToFloat(const char[] str);
/**
* Converts a string to a floating point number with some more options.
*
* @param str String to convert to a foat.
* @param str String to convert to a float.
* @param result Variable to store result in.
* @return Number of characters consumed.
*/
native StringToFloatEx(const String:str[], &Float:result);
native int StringToFloatEx(const char[] str, float &result);
/**
* Converts a floating point number to a string.
@ -229,7 +229,7 @@ native StringToFloatEx(const String:str[], &Float:result);
* @param maxlength Maximum length of string buffer.
* @return Number of cells written to buffer.
*/
native FloatToString(Float:num, String:str[], maxlength);
native int FloatToString(float num, char[] str, int maxlength);
/**
* Finds the first "argument" in a string; either a set of space
@ -243,14 +243,14 @@ native FloatToString(Float:num, String:str[], maxlength);
* @param argLen Maximum length of argument buffer.
* @return Index to next piece of string, or -1 if none.
*/
native BreakString(const String:source[], String:arg[], argLen);
native int BreakString(const char[] source, char[] arg, int argLen);
/**
* Backwards compatibility stock - use BreakString
* @deprecated Renamed to BreakString.
*/
#pragma deprecated Use BreakString() instead
stock StrBreak(const String:source[], String:arg[], argLen)
stock int StrBreak(const char[] source, char[] arg, int argLen)
{
return BreakString(source, arg, argLen);
}
@ -261,7 +261,7 @@ stock StrBreak(const String:source[], String:arg[], argLen)
* @param str The string to trim.
* @return Number of bytes written (UTF-8 safe).
*/
native TrimString(String:str[]);
native int TrimString(char[] str);
/**
* Returns text in a string up until a certain character sequence is reached.
@ -274,7 +274,7 @@ native TrimString(String:str[]);
* marking the first index after the searched text. The
* index is always relative to the start of the input string.
*/
native SplitString(const String:source[], const String:split[], String:part[], partLen);
native int SplitString(const char[] source, const char[] split, char[] part, int partLen);
/**
* Given a string, replaces all occurrences of a search string with a
@ -287,7 +287,7 @@ native SplitString(const String:source[], const String:split[], String:part[], p
* @param caseSensitive If true (default), search is case sensitive.
* @return Number of replacements that were performed.
*/
native ReplaceString(String:text[], maxlength, const String:search[], const String:replace[], bool:caseSensitive=true);
native int ReplaceString(char[] text, int maxlength, const char[] search, const char[] replace, bool caseSensitive=true);
/**
* Given a string, replaces the first occurrence of a search string with a
@ -306,7 +306,7 @@ native ReplaceString(String:text[], maxlength, const String:search[], const Stri
* the last replacement ended, or -1 if no replacements were
* made.
*/
native ReplaceStringEx(String:text[], maxlength, const String:search[], const String:replace[], searchLen=-1, replaceLen=-1, bool:caseSensitive=true);
native int ReplaceStringEx(char[] text, int maxlength, const char[] search, const char[] replace, int searchLen=-1, int replaceLen=-1, bool caseSensitive=true);
/**
* Returns the number of bytes a character is using. This is
@ -316,7 +316,7 @@ native ReplaceStringEx(String:text[], maxlength, const String:search[], const St
* @param source Source input string.
* @return Number of bytes the current character uses.
*/
native GetCharBytes(const String:source[]);
native int GetCharBytes(const char[] source);
/**
* Returns whether a character is an ASCII alphabet character.
@ -326,7 +326,7 @@ native GetCharBytes(const String:source[]);
* @param chr Character to test.
* @return True if character is alphabetical, otherwise false.
*/
native bool:IsCharAlpha(chr);
native bool IsCharAlpha(int chr);
/**
* Returns whether a character is numeric.
@ -336,7 +336,7 @@ native bool:IsCharAlpha(chr);
* @param chr Character to test.
* @return True if character is numeric, otherwise false.
*/
native bool:IsCharNumeric(chr);
native bool IsCharNumeric(int chr);
/**
* Returns whether a character is whitespace.
@ -346,7 +346,7 @@ native bool:IsCharNumeric(chr);
* @param chr Character to test.
* @return True if character is whitespace, otherwise false.
*/
native bool:IsCharSpace(chr);
native bool IsCharSpace(int chr);
/**
* Returns if a character is multi-byte or not.
@ -355,7 +355,7 @@ native bool:IsCharSpace(chr);
* @return 0 for a normal 7-bit ASCII character,
* otherwise number of bytes in multi-byte character.
*/
native IsCharMB(chr);
native int IsCharMB(int chr);
/**
* Returns whether an alphabetic character is uppercase.
@ -365,7 +365,7 @@ native IsCharMB(chr);
* @param chr Character to test.
* @return True if character is uppercase, otherwise false.
*/
native bool:IsCharUpper(chr);
native bool IsCharUpper(int chr);
/**
* Returns whether an alphabetic character is lowercase.
@ -375,7 +375,7 @@ native bool:IsCharUpper(chr);
* @param chr Character to test.
* @return True if character is lowercase, otherwise false.
*/
native bool:IsCharLower(chr);
native bool IsCharLower(int chr);
/**
* Strips a quote pair off a string if it exists. That is, the following
@ -389,16 +389,16 @@ native bool:IsCharLower(chr);
* @return True if string was modified, false if there was no
* set of quotes.
*/
native bool:StripQuotes(String:text[]);
native bool StripQuotes(char[] text);
/**
* Returns an uppercase character to a lowercase character.
*
* @param chr Characer to convert.
* @param chr Character to convert.
* @return Lowercase character on success,
* no change on failure.
*/
stock CharToUpper(chr)
stock int CharToUpper(int chr)
{
if (IsCharLower(chr))
{
@ -410,11 +410,11 @@ stock CharToUpper(chr)
/**
* Returns a lowercase character to an uppercase character.
*
* @param chr Characer to convert.
* @param chr Character to convert.
* @return Uppercase character on success,
* no change on failure.
*/
stock CharToLower(chr)
stock int CharToLower(int chr)
{
if (IsCharUpper(chr))
{
@ -460,9 +460,9 @@ stock int FindCharInString(const char[] str, char c, bool reverse = false)
* @param source Source string to concatenate.
* @return Number of bytes written.
*/
stock StrCat(String:buffer[], maxlength, const String:source[])
stock int StrCat(char[] buffer, int maxlength, const char[] source)
{
new len = strlen(buffer);
int len = strlen(buffer);
if (len >= maxlength)
{
return 0;
@ -483,10 +483,10 @@ stock StrCat(String:buffer[], maxlength, const String:source[])
* delimiters after last piece.
* @return Number of strings retrieved.
*/
stock ExplodeString(const String:text[], const String:split[], String:buffers[][], maxStrings,
maxStringLength, bool:copyRemainder = false)
stock int ExplodeString(const char[] text, const char[] split, char[][] buffers, int maxStrings,
int maxStringLength, bool copyRemainder = false)
{
new reloc_idx, idx, total;
int reloc_idx, idx, total;
if (maxStrings < 1 || !split[0])
{
@ -522,11 +522,11 @@ stock ExplodeString(const String:text[], const String:split[], String:buffers[][
* @param maxLength Maximum length of the output buffer.
* @return Number of bytes written to the output buffer.
*/
stock ImplodeStrings(const String:strings[][], numStrings, const String:join[], String:buffer[], maxLength)
stock int ImplodeStrings(const char[][] strings, int numStrings, const char[] join, char[] buffer, int maxLength)
{
new total, length, part_length;
new join_length = strlen(join);
for (new i=0; i<numStrings; i++)
int total, length, part_length;
int join_length = strlen(join);
for (int i=0; i<numStrings; i++)
{
length = strcopy(buffer[total], maxLength-total, strings[i]);
total += length;

View File

@ -30,15 +30,15 @@
* Version: $Id$
*/
static TestNumber = 0;
static String:TestContext[255];
static int TestNumber = 0;
static char TestContext[255];
SetTestContext(const String:context[])
stock void SetTestContext(const char[] context)
{
strcopy(TestContext, sizeof(TestContext), context);
}
AssertEq(const String:text[], cell1, cell2)
stock void AssertEq(const char[] text, int cell1, int cell2)
{
TestNumber++;
if (cell1 == cell2) {
@ -49,7 +49,7 @@ AssertEq(const String:text[], cell1, cell2)
}
}
AssertFalse(const String:text[], bool:value)
stock void AssertFalse(const char[] text, bool value)
{
TestNumber++;
if (!value) {
@ -60,7 +60,7 @@ AssertFalse(const String:text[], bool:value)
}
}
AssertTrue(const String:text[], bool:value)
stock void AssertTrue(const char[] text, bool value)
{
TestNumber++;
if (value) {

View File

@ -45,7 +45,7 @@
/**
* Parse result directive.
*/
enum SMCResult:
enum SMCResult
{
SMCParse_Continue, /**< Continue parsing */
SMCParse_Halt, /**< Stop parsing here */
@ -55,7 +55,7 @@ enum SMCResult:
/**
* Parse error codes.
*/
enum SMCError:
enum SMCError
{
SMCError_Okay = 0, /**< No error */
SMCError_StreamOpen, /**< Stream failed to open */
@ -109,7 +109,6 @@ typedef SMC_EndSection = function SMCResult (SMCParser smc);
// @param smc The SMCParser.
// @param halted True if abnormally halted, false otherwise.
// @param failed True if parsing failed, false otherwise.
// @noreturn
typedef SMC_ParseEnd = function void (SMCParser smc, bool halted, bool failed);
// Callback for whenever a new line of text is about to be parsed.
@ -212,20 +211,18 @@ native bool SMC_GetErrorString(SMCError error, char[] buffer, int buf_max);
*
* @param smc Handle to an SMC Parse.
* @param func SMC_ParseStart function.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native SMC_SetParseStart(Handle smc, SMC_ParseStart func);
native void SMC_SetParseStart(Handle smc, SMC_ParseStart func);
/**
* Sets the SMC_ParseEnd of a parse handle.
*
* @param smc Handle to an SMC Parse.
* @param func SMC_ParseEnd function.
* @noreturn
* @error Invalid or corrupt Handle.
*/
native SMC_SetParseEnd(Handle smc, SMC_ParseEnd func);
native void SMC_SetParseEnd(Handle smc, SMC_ParseEnd func);
/**
* Sets the three main reader functions.

122
env/include/tf2.inc vendored
View File

@ -153,8 +153,9 @@ enum TFCond
TFCond_HalloweenTiny,
TFCond_HalloweenInHell,
TFCond_HalloweenGhostMode,
TFCond_DodgeChance = 79,
TFCond_MiniCritOnKill,
TFCond_DodgeChance, //79
TFCond_ObscuredSmoke = 79,
TFCond_Parachute,
TFCond_BlastJumping,
TFCond_HalloweenKart,
@ -162,7 +163,8 @@ enum TFCond
TFCond_BalloonHead,
TFCond_MeleeOnly,
TFCond_SwimmingCurse,
TFCond_HalloweenKartNoTurn,
TFCond_HalloweenKartNoTurn, //87
TFCond_FreezeInput = 87,
TFCond_HalloweenKartCage,
TFCond_HasRune,
TFCond_RuneStrength,
@ -173,26 +175,47 @@ enum TFCond
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,
};
const Float:TFCondDuration_Infinite = -1.0;
const float TFCondDuration_Infinite = -1.0;
enum TFHoliday
{
TFHoliday_Invalid = -1
};
public const TFHoliday:TFHoliday_Birthday;
public const TFHoliday:TFHoliday_Halloween;
public const TFHoliday:TFHoliday_Christmas;
public const TFHoliday:TFHoliday_EndOfTheLine;
public const TFHoliday:TFHoliday_ValentinesDay;
public const TFHoliday:TFHoliday_MeetThePyro;
public const TFHoliday:TFHoliday_SpyVsEngyWar;
public const TFHoliday:TFHoliday_FullMoon;
public const TFHoliday:TFHoliday_HalloweenOrFullMoon;
public const TFHoliday:TFHoliday_HalloweenOrFullMoonOrValentines;
public const TFHoliday:TFHoliday_AprilFools;
public const TFHoliday TFHoliday_Birthday;
public const TFHoliday TFHoliday_Halloween;
public const TFHoliday TFHoliday_Christmas;
public const TFHoliday TFHoliday_EndOfTheLine;
public const TFHoliday TFHoliday_CommunityUpdate;
public const TFHoliday TFHoliday_ValentinesDay;
public const TFHoliday TFHoliday_MeetThePyro;
public const TFHoliday TFHoliday_FullMoon;
public const TFHoliday TFHoliday_HalloweenOrFullMoon;
public const TFHoliday TFHoliday_HalloweenOrFullMoonOrValentines;
public const TFHoliday TFHoliday_AprilFools;
enum TFObjectType
{
@ -215,28 +238,25 @@ enum TFObjectMode
*
* @param client Player's index.
* @param attacker Attacker's index.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_IgnitePlayer(client, attacker);
native void TF2_IgnitePlayer(int client, int attacker);
/**
* Respawns a client
*
* @param client Player's index.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_RespawnPlayer(client);
native void TF2_RespawnPlayer(int client);
/**
* Regenerates a client's health and ammunition
*
* @param client Player's index.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_RegeneratePlayer(client);
native void TF2_RegeneratePlayer(int client);
/**
* Adds a condition to a player
@ -246,30 +266,27 @@ native TF2_RegeneratePlayer(client);
* @param duration Duration of condition (does not apply to all conditions).
* Pass TFCondDuration_Infinite to apply until manually removed.
* @param inflictor Condition inflictor's index (0 for no inflictor).
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_AddCondition(client, TFCond:condition, Float:duration=TFCondDuration_Infinite, inflictor=0);
native void TF2_AddCondition(int client, TFCond condition, float duration=TFCondDuration_Infinite, int inflictor=0);
/**
* Removes a condition from a player
*
* @param client Player's index.
* @param condition Integer identifier of condition to remove.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_RemoveCondition(client, TFCond:condition);
native void TF2_RemoveCondition(int client, TFCond condition);
/**
* Enables/disables PowerPlay mode on a player.
*
* @param client Player's index.
* @param enabled Whether to enable or disable PowerPlay on player.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_SetPlayerPowerPlay(client, bool:enabled);
native void TF2_SetPlayerPowerPlay(int client, bool enabled);
/**
* Disguises a client to the given model and team. Only has an effect on spies.
@ -280,19 +297,17 @@ native TF2_SetPlayerPowerPlay(client, bool:enabled);
* @param team Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
* @param classType TFClassType class to disguise the player as
* @param target Specific target player to disguise as (0 for any)
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:classType, target=0);
native void TF2_DisguisePlayer(int client, TFTeam team, TFClassType classType, int target=0);
/**
* Removes the current disguise from a client. Only has an effect on spies.
*
* @param client Player's index.
* @noreturn
* @error Invalid client index, client not in game, or no mod support.
*/
native TF2_RemovePlayerDisguise(client);
native void TF2_RemovePlayerDisguise(int client);
/**
* Stuns a client
@ -303,9 +318,8 @@ native TF2_RemovePlayerDisguise(client);
* Ignored if TF_STUNFLAG_SLOWDOWN is not set.
* @param stunflags Stun flags.
* @param attacker Attacker's index (0 is allowed for world).
* @noreturn
*/
native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
native void TF2_StunPlayer(int client, float duration, float slowdown=0.0, int stunflags, int attacker=0);
/**
* Induces the bleed effect on a client
@ -313,9 +327,8 @@ native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, att
* @param client Player's index.
* @param attacker Attacker's index.
* @param duration Duration of bleeding (in seconds).
* @noreturn
*/
native TF2_MakeBleed(client, attacker, Float:duration);
native void TF2_MakeBleed(int client, int attacker, float duration);
/**
* Retrieves the entity index of the CPlayerResource entity
@ -323,7 +336,7 @@ native TF2_MakeBleed(client, attacker, Float:duration);
* @return The current resource entity index.
*/
#pragma deprecated Use GetPlayerResourceEntity instead
native TF2_GetResourceEntity();
native int TF2_GetResourceEntity();
/**
* Finds the TFClassType for a given class name.
@ -331,7 +344,7 @@ native TF2_GetResourceEntity();
* @param classname A classname string such as "sniper" or "demoman"
* @return A TFClassType constant.
*/
native TFClassType:TF2_GetClass(const String:classname[]);
native TFClassType TF2_GetClass(const char[] classname);
/**
* Called on weapon fire to decide if the current shot should be critical.
@ -348,13 +361,13 @@ native TFClassType:TF2_GetClass(const String:classname[]);
* @param weaponname Classname of the weapon.
* @param result Buffer param for the result of the decision.
*/
forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
forward Action TF2_CalcIsAttackCritical(int client, int weapon, char[] weaponname, bool &result);
/**
* @deprecated No longer called. Use TF2_OnIsHolidayActive.
*/
#pragma deprecated No longer called. Use TF2_OnIsHolidayActive.
forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
forward Action TF2_OnGetHoliday(TFHoliday &holiday);
/**
* Called at various times when the game checks to see if the given holiday is active.
@ -365,7 +378,7 @@ forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
* @param result Buffer param for the result of the decision.
* @return Plugin_Continue for original calculation, higher value to use 'result'.
*/
forward Action:TF2_OnIsHolidayActive(TFHoliday:holiday, &bool:result);
forward Action TF2_OnIsHolidayActive(TFHoliday holiday, bool &result);
/**
* Returns whether or not a holiday is active
@ -373,7 +386,7 @@ forward Action:TF2_OnIsHolidayActive(TFHoliday:holiday, &bool:result);
* @param holiday Holiday being checked.
* @return Boolean of whether or not the holiday is active.
*/
native bool:TF2_IsHolidayActive(TFHoliday:holiday);
native bool TF2_IsHolidayActive(TFHoliday holiday);
/**
* Returns whether or not a client (Player) is in a duel.
@ -381,7 +394,7 @@ native bool:TF2_IsHolidayActive(TFHoliday:holiday);
* @param client Client Index.
* @return Boolean of whether or not the client/player is dueling.
*/
native bool:TF2_IsPlayerInDuel(client);
native bool TF2_IsPlayerInDuel(int client);
/**
* Removes an econ wearable (hat, misc, etc) from a player.
@ -389,42 +402,35 @@ native bool:TF2_IsPlayerInDuel(client);
*
* @param client Client index.
* @param wearable Index of the wearable entity.
* @noreturn
* @error Invalid client index, client not in game, invalid wearable entity, or no mod support.
*/
native TF2_RemoveWearable(client, wearable);
native void TF2_RemoveWearable(int client, int wearable);
/**
* Called after a condition is added to a player
*
* @param client Index of the client to which the conditon is being added.
* @param client Index of the client to which the condition is being added.
* @param condition Condition that is being added.
* @noreturn
*/
forward TF2_OnConditionAdded(client, TFCond:condition);
forward void TF2_OnConditionAdded(int client, TFCond condition);
/**
* Called after a condition is removed from a player
*
* @param client Index of the client to which the condition is being removed.
* @param condition Condition that is being removed.
* @noreturn
*/
forward TF2_OnConditionRemoved(client, TFCond:condition);
forward void TF2_OnConditionRemoved(int client, TFCond condition);
/**
* Called when the server enters the Waiting for Players round state
*
* @noreturn
*/
forward TF2_OnWaitingForPlayersStart();
forward void TF2_OnWaitingForPlayersStart();
/**
* Called when the server exits the Waiting for Players round state
*
* @noreturn
*/
forward TF2_OnWaitingForPlayersEnd();
forward void TF2_OnWaitingForPlayersEnd();
/**
* Called when a player attempts to use a teleporter to decide if the player should be allowed to teleport.
@ -437,12 +443,12 @@ forward TF2_OnWaitingForPlayersEnd();
* This is prepopulated with the game's original decision to let a player teleport.
* @return Plugin_Continue for original calculation, higher value to use 'result'.
*/
forward Action:TF2_OnPlayerTeleport(client, teleporter, &bool:result);
forward Action TF2_OnPlayerTeleport(int client, int teleporter, bool &result);
/**
* Do not edit below this line!
*/
public Extension:__ext_tf2 =
public Extension __ext_tf2 =
{
name = "TF2 Tools",
file = "game.tf2.ext",
@ -455,7 +461,7 @@ public Extension:__ext_tf2 =
};
#if !defined REQUIRE_EXTENSIONS
public __ext_tf2_SetNTVOptional()
public void __ext_tf2_SetNTVOptional()
{
MarkNativeAsOptional("TF2_IgnitePlayer");
MarkNativeAsOptional("TF2_RespawnPlayer");

View File

@ -144,6 +144,21 @@ enum {
TF_CUSTOM_MERASMUS_DECAPITATION,
TF_CUSTOM_CANNONBALL_PUSH,
TF_CUSTOM_TAUNT_ALLCLASS_GUITAR_RIFF,
TF_CUSTOM_THROWABLE,
TF_CUSTOM_THROWABLE_KILL,
TF_CUSTOM_SPELL_TELEPORT,
TF_CUSTOM_SPELL_SKELETON,
TF_CUSTOM_SPELL_MIRV,
TF_CUSTOM_SPELL_METEOR,
TF_CUSTOM_SPELL_LIGHTNING,
TF_CUSTOM_SPELL_FIREBALL,
TF_CUSTOM_SPELL_MONOCULUS,
TF_CUSTOM_SPELL_BLASTJUMP,
TF_CUSTOM_SPELL_BATS,
TF_CUSTOM_SPELL_TINY,
TF_CUSTOM_KART,
TF_CUSTOM_GIANT_HAMMER,
TF_CUSTOM_RUNE_REFLECT,
};
// Weapon codes as used in some events, such as player_death
@ -250,6 +265,9 @@ enum {
TF_WEAPON_SPELLBOOK_PROJECTILE,
TF_WEAPON_SNIPERRIFLE_CLASSIC,
TF_WEAPON_PARACHUTE,
TF_WEAPON_GRAPPLINGHOOK,
TF_WEAPON_PASSTIME_GUN,
TF_WEAPON_CHARGED_SMG,
};
// TF2 Weapon Loadout Slots
@ -296,7 +314,7 @@ enum TFResourceType
TFResource_PlayerClass
};
static const String:TFResourceNames[TFResourceType][] =
static const char TFResourceNames[TFResourceType][] =
{
"m_iPing",
"m_iScore",
@ -325,9 +343,21 @@ static const String:TFResourceNames[TFResourceType][] =
* @return Current TFTeam of client.
* @error Invalid client index.
*/
stock TFTeam:TF2_GetClientTeam(client)
stock TFTeam TF2_GetClientTeam(int client)
{
return TFTeam:GetClientTeam(client);
return view_as<TFTeam>(GetClientTeam(client));
}
/**
* Changes a client's current team.
*
* @param client Client index.
* @param team TFTeam team symbol.
* @error Invalid client index.
*/
stock void TF2_ChangeClientTeam(int client, TFTeam team)
{
ChangeClientTeam(client, view_as<int>(team));
}
/**
@ -337,9 +367,9 @@ stock TFTeam:TF2_GetClientTeam(client)
* @return Current TFClassType of player.
* @error Invalid client index.
*/
stock TFClassType:TF2_GetPlayerClass(client)
stock TFClassType TF2_GetPlayerClass(int client)
{
return TFClassType:GetEntProp(client, Prop_Send, "m_iClass");
return view_as<TFClassType>(GetEntProp(client, Prop_Send, "m_iClass"));
}
/**
@ -351,16 +381,15 @@ stock TFClassType:TF2_GetPlayerClass(client)
* @param classType TFClassType class symbol.
* @param weapons This parameter is ignored.
* @param persistent If true, changes the player's desired class so the change stays after death.
* @noreturn
* @error Invalid client index.
*/
stock TF2_SetPlayerClass(client, TFClassType:classType, bool:weapons=true, bool:persistent=true)
stock void TF2_SetPlayerClass(int client, TFClassType classType, bool weapons=true, bool persistent=true)
{
SetEntProp(client, Prop_Send, "m_iClass", _:classType);
SetEntProp(client, Prop_Send, "m_iClass", view_as<int>(classType));
if (persistent)
{
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:classType);
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", view_as<int>(classType));
}
}
@ -373,21 +402,21 @@ stock TF2_SetPlayerClass(client, TFClassType:classType, bool:weapons=true, bool:
* @error Invalid client index, client not in game or failed to find resource entity.
*/
#pragma deprecated Use GetPlayerResourceEntity and GetEntProp instead
stock TF2_GetPlayerResourceData(client, TFResourceType:type)
stock int TF2_GetPlayerResourceData(int client, TFResourceType type)
{
if (!IsClientConnected(client))
{
return -1;
}
new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
int offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
if (offset < 1)
{
return -1;
}
new entity = TF2_GetResourceEntity();
int entity = TF2_GetResourceEntity();
if (entity == -1)
{
@ -409,21 +438,21 @@ stock TF2_GetPlayerResourceData(client, TFResourceType:type)
* @error Invalid client index, client not in game or failed to find resource entity.
*/
#pragma deprecated Use GetPlayerResourceEntity and SetEntProp instead
stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value)
stock bool TF2_SetPlayerResourceData(int client, TFResourceType type, any value)
{
if (!IsClientConnected(client))
{
return false;
}
new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
int offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
if (offset < 1)
{
return false;
}
new entity = TF2_GetResourceEntity();
int entity = TF2_GetResourceEntity();
if (entity == -1)
{
@ -440,17 +469,16 @@ stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value)
*
* @param client Player's index.
* @param slot Slot index (0-5)
* @noreturn
* @error Invalid client, invalid slot or lack of mod support
*/
stock TF2_RemoveWeaponSlot(client, slot)
stock void TF2_RemoveWeaponSlot(int client, int slot)
{
new weaponIndex;
int weaponIndex;
while ((weaponIndex = GetPlayerWeaponSlot(client, slot)) != -1)
{
// bug #6206
// papering over a valve bug where a weapon's extra wearables aren't properly removed from the weapon's owner
new extraWearable = GetEntPropEnt(weaponIndex, Prop_Send, "m_hExtraWearable");
int extraWearable = GetEntPropEnt(weaponIndex, Prop_Send, "m_hExtraWearable");
if (extraWearable != -1)
{
TF2_RemoveWearable(client, extraWearable);
@ -471,11 +499,10 @@ stock TF2_RemoveWeaponSlot(client, slot)
* Removes all weapons from a client
*
* @param client Player's index.
* @noreturn
*/
stock TF2_RemoveAllWeapons(client)
stock void TF2_RemoveAllWeapons(int client)
{
for (new i = 0; i <= 5; i++)
for (int i = 0; i <= 5; i++)
{
TF2_RemoveWeaponSlot(client, i);
}
@ -488,7 +515,7 @@ stock TF2_RemoveAllWeapons(client)
* @return Player's condition bits
*/
#pragma deprecated Use TF2_IsPlayerInCondition instead.
stock TF2_GetPlayerConditionFlags(client)
stock int TF2_GetPlayerConditionFlags(int client)
{
return GetEntProp(client, Prop_Send, "m_nPlayerCond")|GetEntProp(client, Prop_Send, "_condition_bits");
}
@ -500,45 +527,51 @@ stock TF2_GetPlayerConditionFlags(client)
* @param cond TFCond constant
* @return True if set, false otherwise
*/
stock bool:TF2_IsPlayerInCondition(client, TFCond:cond)
stock bool TF2_IsPlayerInCondition(int client, TFCond cond)
{
// Conditions are stored across two netprops now, one for each 32-bit segment.
if (_:cond < 32)
// Conditions are stored across multiple netprops now, one for each 32-bit segment.
int iCond = view_as<int>(cond);
switch (iCond / 32)
{
new bit = 1 << _:cond;
if ((GetEntProp(client, Prop_Send, "m_nPlayerCond") & bit) == bit)
case 0:
{
return true;
}
int bit = 1 << iCond;
if ((GetEntProp(client, Prop_Send, "m_nPlayerCond") & bit) == bit)
{
return true;
}
if ((GetEntProp(client, Prop_Send, "_condition_bits") & bit) == bit)
{
return true;
if ((GetEntProp(client, Prop_Send, "_condition_bits") & bit) == bit)
{
return true;
}
}
}
else if (_:cond < 64)
{
new bit = (1 << (_:cond - 32));
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx") & bit) == bit)
case 1:
{
return true;
int bit = (1 << (iCond - 32));
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx") & bit) == bit)
{
return true;
}
}
}
else if (_:cond < 96)
{
new bit = (1 << (_:cond - 64));
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx2") & bit) == bit)
case 2:
{
return true;
int bit = (1 << (iCond - 64));
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx2") & bit) == bit)
{
return true;
}
}
}
else
{
new bit = (1 << (_:cond - 96));
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx3") & bit) == bit)
case 3:
{
return true;
int bit = (1 << (iCond - 96));
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx3") & bit) == bit)
{
return true;
}
}
default:
ThrowError("Invalid TFCond value %d", iCond);
}
return false;
@ -551,16 +584,16 @@ stock bool:TF2_IsPlayerInCondition(client, TFCond:cond)
* @return Current TFObjectType of entity.
* @error Invalid entity index.
*/
stock TFObjectType:TF2_GetObjectType(entity)
stock TFObjectType TF2_GetObjectType(int entity)
{
new offset = GetEntSendPropOffs(entity, "m_iObjectType");
int offset = GetEntSendPropOffs(entity, "m_iObjectType");
if (offset <= 0)
{
ThrowError("Entity index %d is not an object", entity);
}
return TFObjectType:GetEntData(entity, offset);
return view_as<TFObjectType>(GetEntData(entity, offset));
}
/**
@ -570,14 +603,14 @@ stock TFObjectType:TF2_GetObjectType(entity)
* @return Current TFObjectMode of entity.
* @error Invalid entity index.
*/
stock TFObjectMode:TF2_GetObjectMode(entity)
stock TFObjectMode TF2_GetObjectMode(int entity)
{
new offset = GetEntSendPropOffs(entity, "m_iObjectMode");
int offset = GetEntSendPropOffs(entity, "m_iObjectMode");
if (offset <= 0)
{
ThrowError("Entity index %d is not an object", entity);
}
return TFObjectMode:GetEntData(entity, offset);
return view_as<TFObjectMode>(GetEntData(entity, offset));
}

View File

@ -87,7 +87,7 @@ typeset Timer
* @return Handle to the timer object. You do not need to call CloseHandle().
* If the timer could not be created, INVALID_HANDLE will be returned.
*/
native Handle:CreateTimer(Float:interval, Timer:func, any:data=INVALID_HANDLE, flags=0);
native Handle CreateTimer(float interval, Timer func, any data=INVALID_HANDLE, int flags=0);
/**
* Kills a timer. Use this instead of CloseHandle() if you need more options.
@ -95,9 +95,9 @@ native Handle:CreateTimer(Float:interval, Timer:func, any:data=INVALID_HANDLE, f
* @param timer Timer Handle to kill.
* @param autoClose If autoClose is true, the data that was passed to CreateTimer() will
* be closed as a handle if TIMER_DATA_HNDL_CLOSE was not specified.
* @noreturn
* @error Invalid handles will cause a run time error.
*/
native KillTimer(Handle:timer, bool:autoClose=false);
native void KillTimer(Handle timer, bool autoClose=false);
/**
* Manually triggers a timer so its function will be called.
@ -105,9 +105,8 @@ native KillTimer(Handle:timer, bool:autoClose=false);
* @param timer Timer Handle to trigger.
* @param reset If reset is true, the elapsed time counter is reset
* so the full interval must pass again.
* @noreturn
*/
native TriggerTimer(Handle:timer, bool:reset=false);
native void TriggerTimer(Handle timer, bool reset=false);
/**
* Returns the simulated game time.
@ -120,7 +119,7 @@ native TriggerTimer(Handle:timer, bool:reset=false);
*
* @return Time based on the game tick count.
*/
native Float:GetTickedTime();
native float GetTickedTime();
/**
* Returns an estimate of the time left before the map ends. If the server
@ -131,7 +130,7 @@ native Float:GetTickedTime();
* value is less than 0, the time limit is infinite.
* @return True if the operation is supported, false otherwise.
*/
native bool:GetMapTimeLeft(&timeleft);
native bool GetMapTimeLeft(int &timeleft);
/**
* Retrieves the current map time limit. If the server has not processed any
@ -142,7 +141,7 @@ native bool:GetMapTimeLeft(&timeleft);
* limit, or 0 if there is no time limit set.
* @return True on success, false if operation is not supported.
*/
native bool:GetMapTimeLimit(&time);
native bool GetMapTimeLimit(int &time);
/**
* Extends the map time limit in a way that will notify all plugins.
@ -152,7 +151,7 @@ native bool:GetMapTimeLimit(&time);
* If 0, the map will be set to have no time limit.
* @return True on success, false if operation is not supported.
*/
native bool:ExtendMapTimeLimit(time);
native bool ExtendMapTimeLimit(int time);
/**
* Returns the number of seconds in between game server ticks.
@ -161,7 +160,7 @@ native bool:ExtendMapTimeLimit(time);
*
* @return Number of seconds in between ticks.
*/
native Float:GetTickInterval();
native float GetTickInterval();
/**
* Notification that the map's time left has changed via a change in the time
@ -188,7 +187,7 @@ forward void OnMapTimeLeftChanged();
*
* @return True if the server is ticking, false otherwise.
*/
native bool:IsServerProcessing();
native bool IsServerProcessing();
/**
* Creates a timer associated with a new datapack, and returns the datapack.
@ -202,10 +201,9 @@ native bool:IsServerProcessing();
* @param flags Timer flags.
* @return Handle to the timer object. You do not need to call CloseHandle().
*/
stock Handle:CreateDataTimer(Float:interval, Timer:func, &Handle:datapack, flags=0)
stock Handle CreateDataTimer(float interval, Timer func, Handle &datapack, int flags=0)
{
datapack = CreateDataPack();
datapack = new DataPack();
flags |= TIMER_DATA_HNDL_CLOSE;
return CreateTimer(interval, func, datapack, flags);
}

View File

@ -40,7 +40,7 @@
/**
* Actions a top menu will take on an topobj.
*/
enum TopMenuAction:
enum TopMenuAction
{
/**
* An option is being drawn for a menu (or for sorting purposes).
@ -92,7 +92,7 @@ enum TopMenuAction:
/**
* Top menu topobj types.
*/
enum TopMenuObjectType:
enum TopMenuObjectType
{
TopMenuObject_Category = 0, /**< Category (sub-menu branching from root) */
TopMenuObject_Item = 1 /**< Item on a sub-menu */
@ -101,7 +101,7 @@ enum TopMenuObjectType:
/**
* Top menu starting positions for display.
*/
enum TopMenuPosition:
enum TopMenuPosition
{
TopMenuPosition_Start = 0, /**< Start/root of the menu */
TopMenuPosition_LastRoot = 1, /**< Last position in the root menu */
@ -111,7 +111,7 @@ enum TopMenuPosition:
/**
* Top menu topobj tag for type checking.
*/
enum TopMenuObject:
enum TopMenuObject
{
INVALID_TOPMENUOBJECT = 0,
};
@ -125,10 +125,9 @@ enum TopMenuObject:
* @param param Extra parameter (if used).
* @param buffer Output buffer (if used).
* @param maxlength Output buffer (if used).
* @noreturn
*/
typedef TopMenuHandler = function void (
Handle topmenu,
TopMenu topmenu,
TopMenuAction action,
TopMenuObject topobj_id,
int param,
@ -246,7 +245,7 @@ methodmap TopMenu < Handle
// INVALID_TOPMENUOBJECT on failure.
public native TopMenuObject FindCategory(const char[] name);
// Set the menu title caching behaviour of the TopMenu. By default titles
// Set the menu title caching behavior of the TopMenu. By default titles
// are cached to reduce overhead. If you need dynamic menu titles which
// change each time the menu is displayed to a user, set this to false.
property bool CacheTitles {
@ -351,7 +350,6 @@ native int GetTopMenuObjName(Handle topmenu, TopMenuObject topobj, char[] buffer
*
* @param topmenu TopMenu Handle.
* @param topobj TopMenuObject ID.
* @noreturn
* @error Invalid TopMenu Handle.
*/
native void RemoveFromTopMenu(Handle topmenu, TopMenuObject topobj);
@ -390,14 +388,13 @@ native bool DisplayTopMenuCategory(Handle topmenu, TopMenuObject category, int c
native TopMenuObject FindTopMenuCategory(Handle topmenu, const char[] name);
/**
* Change the menu title caching behaviour of the TopMenu. By default the
* Change the menu title caching behavior of the TopMenu. By default the
* titles are cached to reduce overhead. If you need dynamic menu titles, which
* can change everytime the menu is displayed to a user, set this to false.
*
* @param topmenu TopMenu Handle.
* @param cache_titles Cache the menu titles and don't call the handler with
* TopMenuAction_DisplayTitle everytime the menu is drawn?
* @noreturn
* @error Invalid TopMenu Handle
*/
native void SetTopMenuTitleCaching(Handle topmenu, bool cache_titles);
@ -406,7 +403,7 @@ native void SetTopMenuTitleCaching(Handle topmenu, bool cache_titles);
/**
* Do not edit below this line!
*/
public Extension:__ext_topmenus =
public Extension __ext_topmenus =
{
name = "TopMenus",
file = "topmenus.ext",
@ -423,7 +420,7 @@ public Extension:__ext_topmenus =
};
#if !defined REQUIRE_EXTENSIONS
public __ext_topmenus_SetNTVOptional()
public void __ext_topmenus_SetNTVOptional()
{
MarkNativeAsOptional("CreateTopMenu");
MarkNativeAsOptional("LoadTopMenuConfig");

View File

@ -68,13 +68,13 @@ enum UserMessageType
*
* @return The supported usermessage type.
*/
native UserMessageType:GetUserMessageType();
native UserMessageType GetUserMessageType();
stock Protobuf UserMessageToProtobuf(Handle msg)
{
if (GetUserMessageType() != UM_Protobuf)
return null;
return Protobuf:msg;
return view_as<Protobuf>(msg);
}
// Make sure to only call this on writable buffers (eg from StartMessage).
@ -82,7 +82,7 @@ stock BfWrite UserMessageToBfWrite(Handle msg)
{
if (GetUserMessageType() == UM_Protobuf)
return null;
return BfWrite:msg;
return view_as<BfWrite>(msg);
}
// Make sure to only call this on readable buffers (eg from a message hook).
@ -90,7 +90,7 @@ stock BfWrite UserMessageToBfRead(Handle msg)
{
if (GetUserMessageType() == UM_Protobuf)
return null;
return BfRead:msg;
return view_as<BfRead>(msg);
}
/**
@ -99,7 +99,7 @@ stock BfWrite UserMessageToBfRead(Handle msg)
* @param msg String containing message name (case sensitive).
* @return A message index, or INVALID_MESSAGE_ID on failure.
*/
native UserMsg:GetUserMessageId(const String:msg[]);
native UserMsg GetUserMessageId(const char[] msg);
/**
* Retrieves the name of a message by ID.
@ -109,7 +109,7 @@ native UserMsg:GetUserMessageId(const String:msg[]);
* @param maxlength Maximum length of string buffer.
* @return True if message index is valid, false otherwise.
*/
native bool:GetUserMessageName(UserMsg:msg_id, String:msg[], maxlength);
native bool GetUserMessageName(UserMsg msg_id, char[] msg, int maxlength);
/**
* Starts a usermessage (network message).
@ -125,7 +125,7 @@ native bool:GetUserMessageName(UserMsg:msg_id, String:msg[], maxlength);
* @error Invalid message name, unable to start a message, invalid client,
* or client not connected.
*/
native Handle:StartMessage(String:msgname[], clients[], numClients, flags=0);
native Handle StartMessage(char[] msgname, int[] clients, int numClients, int flags=0);
/**
* Starts a usermessage (network message).
@ -141,14 +141,12 @@ native Handle:StartMessage(String:msgname[], clients[], numClients, flags=0);
* @error Invalid message name, unable to start a message, invalid client,
* or client not connected.
*/
native Handle:StartMessageEx(UserMsg:msg, clients[], numClients, flags=0);
native Handle StartMessageEx(UserMsg msg, int[] clients, int numClients, int flags=0);
/**
* Ends a previously started user message (network message).
*
* @noreturn
*/
native EndMessage();
native void EndMessage();
/**
* Hook function types for user messages.
@ -190,7 +188,6 @@ typeset MsgHook
*
* @param msg_id Message index.
* @param sent True if message was sent, false if blocked.
* @noreturn
*/
typedef MsgPostHook = function void (UserMsg msg_id, bool sent);
@ -203,10 +200,9 @@ typedef MsgPostHook = function void (UserMsg msg_id, bool sent);
* allowing the user to block the message. Otherwise,
* the hook is normal and ignores the return value.
* @param post Notification function.
* @noreturn
* @error Invalid message index.
*/
native HookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false, MsgPostHook:post=INVALID_FUNCTION);
native void HookUserMessage(UserMsg msg_id, MsgHook hook, bool intercept=false, MsgPostHook post=INVALID_FUNCTION);
/**
* Removes one usermessage hook.
@ -214,10 +210,9 @@ native HookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false, MsgPo
* @param msg_id Message index.
* @param hook Function used for the hook.
* @param intercept Specifies whether the hook was an intercept hook or not.
* @noreturn
* @error Invalid message index.
*/
native UnhookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false);
native void UnhookUserMessage(UserMsg msg_id, MsgHook hook, bool intercept=false);
/**
* Starts a usermessage (network message) that broadcasts to all clients.
@ -228,11 +223,11 @@ native 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(String:msgname[], flags=0)
stock Handle StartMessageAll(char[] msgname, int flags=0)
{
new total = 0;
new clients[MaxClients];
for (new i=1; i<=MaxClients; i++)
int total = 0;
int[] clients = new int[MaxClients];
for (int i=1; i<=MaxClients; i++)
{
if (IsClientConnected(i))
{
@ -252,9 +247,9 @@ stock Handle:StartMessageAll(String:msgname[], flags=0)
* @return A handle to a bf_write bit packing structure, or
* INVALID_HANDLE on failure.
*/
stock Handle:StartMessageOne(String:msgname[], client, flags=0)
stock Handle StartMessageOne(char[] msgname, int client, int flags=0)
{
new players[1];
int players[1];
players[0] = client;

View File

@ -42,7 +42,7 @@
* @param squared If true, the result will be squared (for optimization).
* @return Vector length (magnitude).
*/
native Float:GetVectorLength(const Float:vec[3], bool:squared=false);
native float GetVectorLength(const float vec[3], bool squared=false);
/**
* Calculates the distance between two vectors.
@ -52,7 +52,7 @@ native Float:GetVectorLength(const Float:vec[3], bool:squared=false);
* @param squared If true, the result will be squared (for optimization).
* @return Vector distance.
*/
native Float:GetVectorDistance(const Float:vec1[3], const Float:vec2[3], bool:squared=false);
native float GetVectorDistance(const float vec1[3], const float vec2[3], bool squared=false);
/**
* Calculates the dot product of two vectors.
@ -61,7 +61,7 @@ native Float:GetVectorDistance(const Float:vec1[3], const Float:vec2[3], bool:sq
* @param vec2 Second vector.
* @return Dot product of the two vectors.
*/
native Float:GetVectorDotProduct(const Float:vec1[3], const Float:vec2[3]);
native float GetVectorDotProduct(const float vec1[3], const float vec2[3]);
/**
* Computes the cross product of two vectors. Any input array can be the same
@ -70,9 +70,8 @@ native Float:GetVectorDotProduct(const Float:vec1[3], const Float:vec2[3]);
* @param vec1 First vector.
* @param vec2 Second vector.
* @param result Resultant vector.
* @noreturn
*/
native GetVectorCrossProduct(const Float:vec1[3], const Float:vec2[3], Float:result[3]);
native void GetVectorCrossProduct(const float vec1[3], const float vec2[3], float result[3]);
/**
* Normalizes a vector. The input array can be the same as the output array.
@ -81,7 +80,7 @@ native GetVectorCrossProduct(const Float:vec1[3], const Float:vec2[3], Float:res
* @param result Resultant vector.
* @return Vector length.
*/
native Float:NormalizeVector(const Float:vec[3], Float:result[3]);
native float NormalizeVector(const float vec[3], float result[3]);
/**
* Returns vectors in the direction of an angle.
@ -90,18 +89,16 @@ native Float:NormalizeVector(const Float:vec[3], Float:result[3]);
* @param fwd Forward vector buffer or NULL_VECTOR.
* @param right Right vector buffer or NULL_VECTOR.
* @param up Up vector buffer or NULL_VECTOR.
* @noreturn
*/
native GetAngleVectors(const Float:angle[3], Float:fwd[3], Float:right[3], Float:up[3]);
native void GetAngleVectors(const float angle[3], float fwd[3], float right[3], float up[3]);
/**
* Returns angles from a vector.
*
* @param vec Vector.
* @param angle Angle buffer.
* @noreturn
*/
native GetVectorAngles(const Float:vec[3], Float:angle[3]);
native void GetVectorAngles(const float vec[3], float angle[3]);
/**
* Returns direction vectors from a vector.
@ -109,9 +106,8 @@ native GetVectorAngles(const Float:vec[3], Float:angle[3]);
* @param vec Vector.
* @param right Right vector buffer or NULL_VECTOR.
* @param up Up vector buffer or NULL_VECTOR.
* @noreturn
*/
native GetVectorVectors(const Float:vec[3], Float:right[3], Float:up[3]);
native void GetVectorVectors(const float vec[3], float right[3], float up[3]);
/**
* Adds two vectors. It is safe to use either input buffer as an output
@ -120,9 +116,8 @@ native GetVectorVectors(const Float:vec[3], Float:right[3], Float:up[3]);
* @param vec1 First vector.
* @param vec2 Second vector.
* @param result Result buffer.
* @noreturn
*/
stock AddVectors(const Float:vec1[3], const Float:vec2[3], Float:result[3])
stock void AddVectors(const float vec1[3], const float vec2[3], float result[3])
{
result[0] = vec1[0] + vec2[0];
result[1] = vec1[1] + vec2[1];
@ -136,9 +131,8 @@ stock AddVectors(const Float:vec1[3], const Float:vec2[3], Float:result[3])
* @param vec1 First vector.
* @param vec2 Second vector to subtract from first.
* @param result Result buffer.
* @noreturn
*/
stock SubtractVectors(const Float:vec1[3], const Float:vec2[3], Float:result[3])
stock void SubtractVectors(const float vec1[3], const float vec2[3], float result[3])
{
result[0] = vec1[0] - vec2[0];
result[1] = vec1[1] - vec2[1];
@ -150,9 +144,8 @@ stock SubtractVectors(const Float:vec1[3], const Float:vec2[3], Float:result[3])
*
* @param vec Vector.
* @param scale Scale value.
* @noreturn
*/
stock ScaleVector(Float:vec[3], Float:scale)
stock void ScaleVector(float vec[3], float scale)
{
vec[0] *= scale;
vec[1] *= scale;
@ -163,9 +156,8 @@ stock ScaleVector(Float:vec[3], Float:scale)
* Negatives a vector.
*
* @param vec Vector.
* @noreturn
*/
stock NegateVector(Float:vec[3])
stock void NegateVector(float vec[3])
{
vec[0] = -vec[0];
vec[1] = -vec[1];
@ -178,9 +170,8 @@ stock NegateVector(Float:vec[3])
* @param pt1 First point (to be subtracted from the second).
* @param pt2 Second point.
* @param output Output vector buffer.
* @noreturn
*/
stock MakeVectorFromPoints(const Float:pt1[3], const Float:pt2[3], Float:output[3])
stock void MakeVectorFromPoints(const float pt1[3], const float pt2[3], float output[3])
{
output[0] = pt2[0] - pt1[0];
output[1] = pt2[1] - pt1[1];

View File

@ -42,8 +42,8 @@
#define SOURCEMOD_V_REV 0
#define SOURCEMOD_V_CSET "0"
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
#define SOURCEMOD_V_MINOR 7 /**< SourceMod Minor version */
#define SOURCEMOD_V_MINOR 8 /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE 0 /**< SourceMod Release version */
#define SOURCEMOD_VERSION "1.7.0-manual" /**< SourceMod version string (major.minor.release-tag) */
#define SOURCEMOD_VERSION "1.8.0-manual" /**< SourceMod version string (major.minor.release-tag) */
#endif

View File

@ -5,11 +5,11 @@
#define _auto_version_included
#define SOURCEMOD_V_TAG ""
#define SOURCEMOD_V_CSET "fd0aaf9"
#define SOURCEMOD_V_CSET "19b0d34"
#define SOURCEMOD_V_MAJOR 1
#define SOURCEMOD_V_MINOR 7
#define SOURCEMOD_V_MINOR 9
#define SOURCEMOD_V_RELEASE 0
#define SOURCEMOD_V_REV 5150
#define SOURCEMOD_V_REV 5970
#define SOURCEMOD_VERSION "1.7.0"
#define SOURCEMOD_VERSION "1.9.0.5970"

BIN
env/linux/bin/spcomp vendored Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
env/win32/bin/spcomp.exe vendored Normal file

Binary file not shown.