Updated includes and compilers to version 1.4.1. Added compiler for OS X.

This commit is contained in:
Richard Helgeby 2012-01-28 02:16:49 +01:00
parent ca50bc9f1b
commit 3ad9d6108b
37 changed files with 1462 additions and 317 deletions

View File

@ -1,11 +1,24 @@
# Script made by [SG-10]Cpt.Moore # Script made by [SG-10]Cpt.Moore
# Note that this script will convert line endings in source files to LF.
SOURCEDIR=src SOURCEDIR=src
SMINCLUDES=env/include SMINCLUDES=env/include
BUILDDIR=build BUILDDIR=build
SPCOMP=env/linux/bin/spcomp-1.4.0-3218 SPCOMP_LINUX=env/linux/bin/spcomp-1.4.1
SPCOMP_DARWIN=env/darwin/bin/spcomp-1.4.1
DOS2UNIX_LINUX=dos2unix -p
DOS2UNIX_DARWIN=env/darwin/bin/dos2unix -p
VERSIONDUMP=./updateversion.sh VERSIONDUMP=./updateversion.sh
OS = $(shell uname -s)
ifeq "$(OS)" "Darwin"
SPCOMP = $(SPCOMP_DARWIN)
DOS2UNIX = $(DOS2UNIX_DARWIN)
else
SPCOMP = $(SPCOMP_LINUX)
DOS2UNIX = $(DOS2UNIX_LINUX)
endif
vpath %.sp $(SOURCEDIR) vpath %.sp $(SOURCEDIR)
vpath %.inc $(SOURCEDIR)/zr vpath %.inc $(SOURCEDIR)/zr
vpath %.smx $(BUILDDIR) vpath %.smx $(BUILDDIR)
@ -19,8 +32,9 @@ prepare: prepare_newlines prepare_builddir
prepare_newlines: prepare_newlines:
@echo "Removing windows newlines" @echo "Removing windows newlines"
@find $(SOURCEDIR)/zr -name \*.inc -exec dos2unix -p '{}' \; @find $(SOURCEDIR) -name \*.inc -exec $(DOS2UNIX) '{}' \;
@find $(SOURCEDIR) -name \*.sp -exec dos2unix -p '{}' \; @find $(SOURCEDIR) -name \*.sp -exec $(DOS2UNIX) '{}' \;
@find $(SMINCLUDES) -name \*.inc -exec $(DOS2UNIX) '{}' \;
prepare_builddir: prepare_builddir:
@echo "Creating build directory" @echo "Creating build directory"
@ -28,9 +42,8 @@ prepare_builddir:
%.smx: %.sp %.smx: %.sp
$(VERSIONDUMP) $(VERSIONDUMP)
$(SPCOMP) -i$(SOURCEDIR) -i$(SOURCEDIR)/include -i$(SMINCLUDES) -o$(BUILDDIR)/$@ $< $(SPCOMP) -i$(SOURCEDIR) -i$(SMINCLUDES) -o$(BUILDDIR)/$@ $<
clean: clean:
@echo "Removing build directory" @echo "Removing build directory"
@rm -fr $(BUILDDIR) @rm -fr $(BUILDDIR)

View File

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

BIN
env/darwin/bin/dos2unix vendored Executable file

Binary file not shown.

1
env/darwin/bin/dos2unix.txt vendored Normal file
View File

@ -0,0 +1 @@
dos2unix source: http://www.thefreecountry.com/tofrodos/

BIN
env/darwin/bin/spcomp-1.4.1 vendored Executable file

Binary file not shown.

View File

@ -88,7 +88,7 @@ native ClearArray(Handle:array);
* @return New handle to the cloned array object * @return New handle to the cloned array object
* @error Invalid Handle * @error Invalid Handle
*/ */
native Handle:CloneArray(Handle:array); native Handle:CloneArray(Handle:array);
/** /**
* Resizes an array. If the size is smaller than the current size, * Resizes an array. If the size is smaller than the current size,

View File

@ -79,8 +79,7 @@ native bool:SetTrieArray(Handle:trie, const String:key[], const any:array[], num
* *
* @param trie Trie Handle. * @param trie Trie Handle.
* @param key Key string. * @param key Key string.
* @param array Array to store. * @param value String to store.
* @param num_items Number of items in the array.
* @param replace If false, operation will fail if the key is already set. * @param replace If false, operation will fail if the key is already set.
* @return True on success, false on failure. * @return True on success, false on failure.
* @error Invalid Handle. * @error Invalid Handle.

93
env/include/basecomm.inc vendored Normal file
View File

@ -0,0 +1,93 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2011 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 _basecomm_included
#endinput
#endif
#define _basecomm_included
/**
* Returns whether or not a client is gagged
*
* @param client Client index.
* @return True if client is gagged, false otherwise.
*/
native bool:BaseComm_IsClientGagged(client);
/**
* Returns whether or not a client is muted
*
* @param client Client index.
* @return True if client is muted, false otherwise.
*/
native bool:BaseComm_IsClientMuted(client);
/**
* Sets a client's gag state
*
* @param client Client index.
* @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);
/**
* Sets a client's mute state
*
* @param client Client index.
* @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);
/* DO NOT EDIT BELOW THIS LINE */
public SharedPlugin:__pl_basecomm =
{
name = "basecomm",
file = "basecomm.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_PLUGIN
public __pl_basecomm_SetNTVOptional()
{
MarkNativeAsOptional("BaseComm_IsClientGagged");
MarkNativeAsOptional("BaseComm_IsClientMuted");
MarkNativeAsOptional("BaseComm_SetClientGag");
MarkNativeAsOptional("BaseComm_SetClientMute");
}
#endif

View File

@ -1,7 +1,7 @@
/** /**
* vim: set ts=4 : * vim: set ts=4 :
* ============================================================================= * =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. * SourceMod (C)2004-2011 AlliedModders LLC. All rights reserved.
* ============================================================================= * =============================================================================
* *
* This file is part of the SourceMod/SourcePawn SDK. * This file is part of the SourceMod/SourcePawn SDK.
@ -131,6 +131,17 @@ native SetClientCookie(client, Handle:cookie, const String:value[]);
*/ */
native GetClientCookie(client, Handle:cookie, String:buffer[], maxlen); native GetClientCookie(client, Handle:cookie, String:buffer[], maxlen);
/**
* Sets the value of a Client preference cookie based on an authID string.
*
* @param authID String Auth/STEAM ID of player to set.
* @param 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[]);
/** /**
* Checks if a clients cookies have been loaded from the database. * Checks if a clients cookies have been loaded from the database.
* *
@ -241,7 +252,7 @@ native GetClientCookieTime(client, Handle:cookie);
/** /**
* Do not edit below this line! * Do not edit below this line!
*/ */
public Extension:__ext_clientprefs = public Extension:__ext_cprefs =
{ {
name = "Client Preferences", name = "Client Preferences",
file = "clientprefs.ext", file = "clientprefs.ext",
@ -252,3 +263,21 @@ public Extension:__ext_clientprefs =
required = 0, required = 0,
#endif #endif
}; };
#if !defined REQUIRE_EXTENSIONS
public __ext_cprefs_SetNTVOptional()
{
MarkNativeAsOptional("RegClientCookie");
MarkNativeAsOptional("FindClientCookie");
MarkNativeAsOptional("SetClientCookie");
MarkNativeAsOptional("GetClientCookie");
MarkNativeAsOptional("AreClientCookiesCached");
MarkNativeAsOptional("SetCookiePrefabMenu");
MarkNativeAsOptional("SetCookieMenuItem");
MarkNativeAsOptional("ShowCookieMenu");
MarkNativeAsOptional("GetCookieIterator");
MarkNativeAsOptional("ReadCookieIterator");
MarkNativeAsOptional("GetCookieAccess");
MarkNativeAsOptional("GetClientCookieTime");
}
#endif

View File

@ -53,7 +53,7 @@ enum NetFlow
* not be used in OnPluginStart(). * not be used in OnPluginStart().
*/ */
#define MAXPLAYERS 64 /**< Maximum number of players SourceMod supports */ #define MAXPLAYERS 65 /**< Maximum number of players SourceMod supports */
#define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */ #define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */
public const MaxClients; /**< Maximum number of players the server supports (dynamic) */ public const MaxClients; /**< Maximum number of players the server supports (dynamic) */
@ -314,6 +314,22 @@ native bool:IsClientAuthorized(client);
*/ */
native bool:IsFakeClient(client); native bool:IsFakeClient(client);
/**
* Returns if a certain player is the SourceTV bot.
*
* @param client Player index.
* @return True if player is the SourceTV bot, false otherwise.
*/
native bool:IsClientSourceTV(client);
/**
* Returns if a certain player is the Replay bot.
*
* @param client Player index.
* @return True if player is the Replay bot, false otherwise.
*/
native bool:IsClientReplay(client);
/** /**
* Returns if a certain player is an observer/spectator. * Returns if a certain player is an observer/spectator.
* *

View File

@ -132,3 +132,34 @@ stock ReplyToTargetError(client, reason)
} }
} }
} }
/**
* Adds clients to a multi-target filter.
*
* @param pattern Pattern name.
* @param clients Array to fill with unique, valid client indexes.
* @return True if pattern was recognized, false otherwise.
*/
functag public bool:MultiTargetFilter(const String:pattern[], Handle:clients);
/**
* Adds a multi-target filter function for ProcessTargetString().
*
* @param pattern Pattern to match (case sensitive).
* @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);
/**
* 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);

View File

@ -121,6 +121,23 @@ enum ConVarQueryResult
*/ */
native ServerCommand(const String:format[], any:...); native ServerCommand(const String:format[], any:...);
/**
* Executes a server command as if it were on the server console (or RCON)
* and stores the printed text into buffer.
*
* Warning: This calls ServerExecute internally and may have issues if
* certain commands are in the buffer, only use when you really need
* the response.
* Also, on L4D2 this will not print the command output to the server console.
*
* @param buffer String to store command result into.
* @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:...);
/** /**
* Inserts a server command at the beginning of the server command buffer. * Inserts a server command at the beginning of the server command buffer.
* *
@ -722,8 +739,8 @@ native bool:ReadCommandIterator(Handle:iter,
/** /**
* Returns whether a client has access to a given command string. The string * Returns whether a client has access to a given command string. The string
* can also be any override string, as overrides can be independent of * can be any override string, as overrides can be independent of
* commands. This important feature essentially allows you to create custom * commands. This feature essentially allows you to create custom
* flags using the override system. * flags using the override system.
* *
* @param client Client index. * @param client Client index.
@ -742,6 +759,28 @@ native bool:CheckCommandAccess(client,
flags, flags,
bool:override_only=false); bool:override_only=false);
/**
* Returns whether an admin has access to a given command string. The string
* can be any override string, as overrides can be independent of
* commands. This feature essentially allows you to create custom flags
* using the override system.
*
* @param id AdminId of the admin.
* @param command Command name. If the command is not found, the default
* flags are used.
* @param flags Flag string to use as a default, if the command or override
* is not found.
* @param override_only If true, SourceMod will not attempt to find a matching
* command, and it will only use the default flags specified.
* Otherwise, SourceMod will ignore the default flags if
* 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);
/** /**
* Returns true if the supplied character is valid in a ConVar name. * Returns true if the supplied character is valid in a ConVar name.
* *

View File

@ -45,6 +45,109 @@
#define CS_SLOT_GRENADE 3 /**< Grenade slot (will only return one grenade). */ #define CS_SLOT_GRENADE 3 /**< Grenade slot (will only return one grenade). */
#define CS_SLOT_C4 4 /**< C4 slot. */ #define CS_SLOT_C4 4 /**< C4 slot. */
enum CSRoundEndReason
{
CSRoundEnd_TargetBombed = 0, // Target Successfully Bombed!
CSRoundEnd_VIPEscaped, // The VIP has escaped!
CSRoundEnd_VIPKilled, // VIP has been assassinated!
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!
CSRoundEnd_BombDefused, // The bomb has been defused!
CSRoundEnd_CTWin, // Counter-Terrorists Win!
CSRoundEnd_TerroristWin, // Terrorists Win!
CSRoundEnd_Draw, // Round Draw!
CSRoundEnd_HostagesRescued, // All Hostages have been rescued!
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_GameStart // Game Commencing!
};
enum CSWeaponID
{
CSWeapon_NONE,
CSWeapon_P228,
CSWeapon_GLOCK,
CSWeapon_SCOUT,
CSWeapon_HEGRENADE,
CSWeapon_XM1014,
CSWeapon_C4,
CSWeapon_MAC10,
CSWeapon_AUG,
CSWeapon_SMOKEGRENADE,
CSWeapon_ELITE,
CSWeapon_FIVESEVEN,
CSWeapon_UMP45,
CSWeapon_SG550,
CSWeapon_GALIL,
CSWeapon_FAMAS,
CSWeapon_USP,
CSWeapon_AWP,
CSWeapon_MP5NAVY,
CSWeapon_M249,
CSWeapon_M3,
CSWeapon_M4A1,
CSWeapon_TMP,
CSWeapon_G3SG1,
CSWeapon_FLASHBANG,
CSWeapon_DEAGLE,
CSWeapon_SG552,
CSWeapon_AK47,
CSWeapon_KNIFE,
CSWeapon_P90,
CSWeapon_SHIELD,
CSWeapon_KEVLAR,
CSWeapon_ASSAULTSUIT,
CSWeapon_NIGHTVISION
};
/**
* Called when a player attempts to purchase an item.
* Return Plugin_Continue to allow the purchase or return a
* higher action to deny.
*
* @param client Client index
* @param weapon User input for weapon name
*/
forward Action:CS_OnBuyCommand(client, const String:weapon[]);
/**
* Called when CSWeaponDrop is called
* Return Plugin_Continue to allow the call or return a
* higher action to deny.
*
* @param client Client index
* @param weapon Weapon index
*/
forward Action:CS_OnCSWeaponDrop(client, weaponIndex);
/**
* Called when game retrieves a weapon's price for a player.
* Return Plugin_Continue to use default value or return a higher
* action to use a newly-set price.
*
* @note This can be called multiple times per weapon purchase
*
* @param client Client index
* @param weapon Weapon classname
* @param price Buffer param for the price of the weapon
*
* @note Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision.
*/
forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price);
/**
* Called when TerminateRound is called.
* Return Plugin_Continue to ignore, return Plugin_Changed to continue,
* using the given delay and reason, or return Plugin_Handled or a higher
* action to block TerminateRound from firing.
*
* @param delay Time (in seconds) until new round starts
* @param reason Reason for round end
*/
forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason);
/** /**
* Respawns a player. * Respawns a player.
* *
@ -64,6 +167,76 @@ native CS_RespawnPlayer(client);
*/ */
native CS_SwitchTeam(client, team); native CS_SwitchTeam(client, team);
/**
* Forces a player to drop or toss their weapon
*
* @param client Player's index.
* @param weaponIndex Index of weapon to drop.
* @param toss True to toss weapon (with velocity) or false to just drop weapon
* @param blockhook Set to true to stop the corresponding CS_OnCSWeaponDrop
*
* @noreturn
* @error Invalid client index, client not in game, or invalid weapon index.
*/
native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
/**
* Forces round to end with a reason
*
* @param delay Time (in seconds) to delay before new round starts
* @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);
/**
* Gets a weapon name from a weapon alias
*
* @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);
/**
* Gets a weapon's price
*
* @param client Client to check weapon price for.
* @param id Weapon id for the weapon to check
* @param defaultprice Set to true to get defaultprice.
* @return Returns price of the weapon (even if modified)
*
* @error Invalid client, failing to get weapon info, or failing to get price offset.
* @note c4, knife and shield will always return 0. vest, vest helmet and night vision will always return default price.
*/
native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false);
/**
* Gets a clients clan tag
* @param client Client index to get clan tag for.
* @param buffer Buffer to store clients clan tag in.
* @param size Size of the buffer.
* @return Number of non-null bytes written.
*
* @error Invalid client.
*/
native CS_GetClientClanTag(client, String:buffer[], 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[]);
/** /**
* Do not edit below this line! * Do not edit below this line!
*/ */
@ -84,5 +257,12 @@ public __ext_cstrike_SetNTVOptional()
{ {
MarkNativeAsOptional("CS_RespawnPlayer"); MarkNativeAsOptional("CS_RespawnPlayer");
MarkNativeAsOptional("CS_SwitchTeam"); MarkNativeAsOptional("CS_SwitchTeam");
MarkNativeAsOptional("CS_DropWeapon");
MarkNativeAsOptional("CS_TerminateRound");
MarkNativeAsOptional("CS_GetTranslatedWeaponAlias");
MarkNativeAsOptional("CS_GetWeaponPrice");
MarkNativeAsOptional("CS_GetClientClanTag");
MarkNativeAsOptional("CS_SetClientClanTag");
} }
#endif #endif

8
env/include/dbi.inc vendored
View File

@ -261,20 +261,20 @@ native SQL_GetAffectedRows(Handle:hndl);
/** /**
* Returns the last query's insertion id. * Returns the last query's insertion id.
* *
* @param hndl A database OR statement Handle. * @param hndl A database, query, OR statement Handle.
* @return Last query's insertion id. * @return Last query's insertion id.
* @error Invalid database or statement Handle. * @error Invalid database, query, or statement Handle.
*/ */
native SQL_GetInsertId(Handle:hndl); native SQL_GetInsertId(Handle:hndl);
/** /**
* Returns the error reported by the last query. * Returns the error reported by the last query.
* *
* @param hndl A database OR statement Handle. * @param hndl A database, query, OR statement Handle.
* @param error Error buffer. * @param error Error buffer.
* @param maxlength Maximum length of the buffer. * @param maxlength Maximum length of the buffer.
* @return True if there was an error, false otherwise. * @return True if there was an error, false otherwise.
* @error Invalid database or statement Handle. * @error Invalid database, query, or statement Handle.
*/ */
native bool:SQL_GetError(Handle:hndl, String:error[], maxlength); native bool:SQL_GetError(Handle:hndl, String:error[], maxlength);

View File

@ -1,7 +1,7 @@
/** /**
* vim: set ts=4 : * vim: set ts=4 :
* ============================================================================= * =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. * SourceMod (C)2004-2011 AlliedModders LLC. All rights reserved.
* ============================================================================= * =============================================================================
* *
* This file is part of the SourceMod/SourcePawn SDK. * This file is part of the SourceMod/SourcePawn SDK.
@ -246,7 +246,7 @@ native SetEntData(entity, offset, any:value, size=4, bool:changeState=false);
native Float:GetEntDataFloat(entity, offset); native Float:GetEntDataFloat(entity, offset);
/** /**
* Peeks into an entity's object data and sets the integer value at * Peeks into an entity's object data and sets the float value at
* the given offset. * the given offset.
* *
* @param entity Edict index. * @param entity Edict index.
@ -489,10 +489,11 @@ stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false)
* @param size Number of bytes to write (valid values are 1, 2, or 4). * @param size Number of bytes to write (valid values are 1, 2, or 4).
* This value is auto-detected, and the size parameter is * This value is auto-detected, and the size parameter is
* only used as a fallback in case detection fails. * only used as a fallback in case detection fails.
* @param element Element # (starting from 0) if property is an array.
* @return Value at the given property offset. * @return Value at the given property offset.
* @error Invalid entity or property not found. * @error Invalid entity or property not found.
*/ */
native GetEntProp(entity, PropType:type, const String:prop[], size=4); native GetEntProp(entity, PropType:type, const String:prop[], size=4, element=0);
/** /**
* Sets an integer value in an entity's property. * Sets an integer value in an entity's property.
@ -503,13 +504,15 @@ native GetEntProp(entity, PropType:type, const String:prop[], size=4);
* @param entity Entity/edict index. * @param entity Entity/edict index.
* @param type Property type. * @param type Property type.
* @param prop Property name. * @param prop Property name.
* @param value Value to set.
* @param size Number of bytes to write (valid values are 1, 2, or 4). * @param size Number of bytes to write (valid values are 1, 2, or 4).
* This value is auto-detected, and the size parameter is * This value is auto-detected, and the size parameter is
* only used as a fallback in case detection fails. * 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. * @error Invalid entity or offset out of reasonable bounds.
* @noreturn * @noreturn
*/ */
native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4); native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4, element=0);
/** /**
* Retrieves a float value from an entity's property. * Retrieves a float value from an entity's property.
@ -520,10 +523,11 @@ native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4)
* @param entity Entity/edict index. * @param entity Entity/edict index.
* @param type Property type. * @param type Property type.
* @param prop Property name. * @param prop Property name.
* @param element Element # (starting from 0) if property is an array.
* @return Value at the given property offset. * @return Value at the given property offset.
* @error Invalid entity or offset out of reasonable bounds. * @error Invalid entity or offset out of reasonable bounds.
*/ */
native Float:GetEntPropFloat(entity, PropType:type, const String:prop[]); native Float:GetEntPropFloat(entity, PropType:type, const String:prop[], element=0);
/** /**
* Sets a float value in an entity's property. * Sets a float value in an entity's property.
@ -535,10 +539,11 @@ native Float:GetEntPropFloat(entity, PropType:type, const String:prop[]);
* @param type Property type. * @param type Property type.
* @param prop Property name. * @param prop Property name.
* @param value Value to set. * @param value Value to set.
* @param element Element # (starting from 0) if property is an array.
* @noreturn * @noreturn
* @error Invalid entity or offset out of reasonable bounds. * @error Invalid entity or offset out of reasonable bounds.
*/ */
native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value); native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value, element=0);
/** /**
* Retrieves an entity index from an entity's property. * Retrieves an entity index from an entity's property.
@ -549,12 +554,13 @@ native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value);
* @param entity Entity/edict index. * @param entity Entity/edict index.
* @param type Property type. * @param type Property type.
* @param prop Property name. * @param prop Property name.
* @param element Element # (starting from 0) if property is an array.
* @return Entity index at the given property. * @return Entity index at the given property.
* If there is no entity, or the entity is not valid, * If there is no entity, or the entity is not valid,
* then -1 is returned. * then -1 is returned.
* @error Invalid entity or offset out of reasonable bounds. * @error Invalid entity or offset out of reasonable bounds.
*/ */
native GetEntPropEnt(entity, PropType:type, const String:prop[]); native GetEntPropEnt(entity, PropType:type, const String:prop[], element=0);
/** /**
* Sets an entity index in an entity's property. * Sets an entity index in an entity's property.
@ -566,10 +572,11 @@ native GetEntPropEnt(entity, PropType:type, const String:prop[]);
* @param type Property type. * @param type Property type.
* @param prop Property name. * @param prop Property name.
* @param other Entity index to set, or -1 to unset. * @param other Entity index to set, or -1 to unset.
* @param element Element # (starting from 0) if property is an array.
* @noreturn * @noreturn
* @error Invalid entity or offset out of reasonable bounds. * @error Invalid entity or offset out of reasonable bounds.
*/ */
native SetEntPropEnt(entity, PropType:type, const String:prop[], other); native SetEntPropEnt(entity, PropType:type, const String:prop[], other, element=0);
/** /**
* Retrieves a vector of floats from an entity, given a named network property. * Retrieves a vector of floats from an entity, given a named network property.
@ -581,11 +588,12 @@ native SetEntPropEnt(entity, PropType:type, const String:prop[], other);
* @param type Property type. * @param type Property type.
* @param prop Property name. * @param prop Property name.
* @param vec Vector buffer to store data in. * @param vec Vector buffer to store data in.
* @param element Element # (starting from 0) if property is an array.
* @noreturn * @noreturn
* @error Invalid entity, property not found, or property not * @error Invalid entity, property not found, or property not
* actually a vector data type. * actually a vector data type.
*/ */
native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3]); native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3], element=0);
/** /**
* Sets a vector of floats in an entity, given a named network property. * Sets a vector of floats in an entity, given a named network property.
@ -597,11 +605,12 @@ native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3]
* @param type Property type. * @param type Property type.
* @param prop Property name. * @param prop Property name.
* @param vec Vector to set. * @param vec Vector to set.
* @param element Element # (starting from 0) if property is an array.
* @noreturn * @noreturn
* @error Invalid entity, property not found, or property not * @error Invalid entity, property not found, or property not
* actually a vector data type. * actually a vector data type.
*/ */
native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:vec[3]); native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:vec[3], element=0);
/** /**
* Gets a network property as a string. * Gets a network property as a string.
@ -611,10 +620,11 @@ native SetEntPropVector(entity, PropType:type, const String:prop[], const Float:
* @param prop Property to use. * @param prop Property to use.
* @param buffer Destination string buffer. * @param buffer Destination string buffer.
* @param maxlen Maximum length of output string buffer. * @param maxlen Maximum length of output string buffer.
* @param element Element # (starting from 0) if property is an array.
* @return Number of non-null bytes written. * @return Number of non-null bytes written.
* @error Invalid entity, offset out of reasonable bounds, or property is not a valid string. * @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); native GetEntPropString(entity, PropType:type, const String:prop[], String:buffer[], maxlen, element=0);
/** /**
* Sets a network property as a string. * Sets a network property as a string.
@ -631,6 +641,17 @@ native GetEntPropString(entity, PropType:type, const String:prop[], String:buffe
*/ */
native SetEntPropString(entity, PropType:type, const String:prop[], const String:buffer[]); native SetEntPropString(entity, PropType:type, const String:prop[], const String:buffer[]);
/**
* Retrieves the count of values that an entity property's array can store.
*
* @param entity Entity/edict index.
* @param type Property type.
* @param prop Property name.
* @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[]);
/** /**
* Copies an array of cells from an entity at a given offset. * Copies an array of cells from an entity at a given offset.
* *
@ -669,3 +690,18 @@ stock SetEntDataArray(entity, offset, const array[], arraySize, dataSize=4, bool
SetEntData(entity, offset + i*dataSize, array[i], dataSize, changeState); SetEntData(entity, offset + i*dataSize, array[i], dataSize, changeState);
} }
} }
/**
* Retrieves the classname of an entity.
* This is like GetEdictClassname(), except it works for ALL
* entities, not just edicts.
*
* @param edict Index of the entity.
* @param clsname Buffer to store the classname.
* @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)
{
return !!GetEntPropString(entity, Prop_Data, "m_iClassname", clsname, maxlength);
}

View File

@ -123,7 +123,8 @@ enum RenderFx
#define IN_GRENADE1 (1 << 23) // grenade 1 #define IN_GRENADE1 (1 << 23) // grenade 1
#define IN_GRENADE2 (1 << 24) // grenade 2 #define IN_GRENADE2 (1 << 24) // grenade 2
// CBaseEntity::m_fFlags // Note: these are only for use with GetEntityFlags and SetEntityFlags
// and may not match the game's actual, internal m_fFlags values.
// PLAYER SPECIFIC FLAGS FIRST BECAUSE WE USE ONLY A FEW BITS OF NETWORK PRECISION // PLAYER SPECIFIC FLAGS FIRST BECAUSE WE USE ONLY A FEW BITS OF NETWORK PRECISION
#define FL_ONGROUND (1 << 0) // At rest / on the ground #define FL_ONGROUND (1 << 0) // At rest / on the ground
#define FL_DUCKING (1 << 1) // Player flag -- Player is fully crouched #define FL_DUCKING (1 << 1) // Player flag -- Player is fully crouched
@ -159,36 +160,36 @@ enum RenderFx
#define FL_DISSOLVING (1 << 28) // We're dissolving! #define FL_DISSOLVING (1 << 28) // We're dissolving!
#define FL_TRANSRAGDOLL (1 << 29) // In the process of turning into a client side ragdoll. #define FL_TRANSRAGDOLL (1 << 29) // In the process of turning into a client side ragdoll.
#define FL_UNBLOCKABLE_BY_PLAYER (1 << 30) // pusher that can't be blocked by the player #define FL_UNBLOCKABLE_BY_PLAYER (1 << 30) // pusher that can't be blocked by the player
// END m_fFlags #defines #define FL_FREEZING (1 << 31) // We're becoming frozen!
#define FL_EP2V_UNKNOWN1 (1 << 31) // Unknown
// END entity flag #defines
/** /**
* Get an entity's flags. * Get an entity's flags.
* *
* @note The game's actual flags are internally translated by SM
* to match the entity flags defined above as the actual values
* can differ per engine.
*
* @param entity Entity index. * @param entity Entity index.
* @return Entity's flags, see m_fFlag defines above * @return Entity's flags, see entity flag defines above.
* @error Invalid entity index, or lack of mod compliance. * @error Invalid entity index, or lack of mod compliance.
*/ */
stock GetEntityFlags(entity) native GetEntityFlags(entity);
{
static bool:gotconfig = false;
static String:datamap[32];
if (!gotconfig) /**
{ * Sets an entity's flags.
new Handle:gc = LoadGameConfigFile("core.games"); *
new bool:exists = GameConfGetKeyValue(gc, "m_fFlags", datamap, sizeof(datamap)); * @note The entity flags as defined above are internally translated by SM
CloseHandle(gc); * to match the current game's expected value for the flags as
* the actual values can differ per engine.
if (!exists) *
{ * @param entity Entity index.
strcopy(datamap, sizeof(datamap), "m_fFlags"); * @param flags Entity flags, see entity flag defines above.
} * @noreturn
* @error Invalid entity index, or lack of mod compliance.
gotconfig = true; */
} native SetEntityFlags(entity, flags);
return GetEntProp(entity, Prop_Data, datamap);
}
/** /**

View File

@ -40,9 +40,12 @@
#define SOURCE_SDK_DARKMESSIAH 15 /**< Modified version of original engine used by Dark Messiah (no SDK) */ #define SOURCE_SDK_DARKMESSIAH 15 /**< Modified version of original engine used by Dark Messiah (no SDK) */
#define SOURCE_SDK_EPISODE1 20 /**< SDK+Engine released after Episode 1 */ #define SOURCE_SDK_EPISODE1 20 /**< SDK+Engine released after Episode 1 */
#define SOURCE_SDK_EPISODE2 30 /**< SDK+Engine released after Episode 2/Orange Box */ #define SOURCE_SDK_EPISODE2 30 /**< SDK+Engine released after Episode 2/Orange Box */
#define SOURCE_SDK_BLOODYGOODTIME 32 /**< Modified version of ep2 engine used by Bloody Good Time (no SDK) */
#define SOURCE_SDK_EYE 33 /**< Modified version of ep2 engine used by E.Y.E Divine Cybermancy (no SDK) */
#define SOURCE_SDK_EPISODE2VALVE 35 /**< SDK+Engine released after Episode 2/Orange Box */ #define SOURCE_SDK_EPISODE2VALVE 35 /**< SDK+Engine released after Episode 2/Orange Box */
#define SOURCE_SDK_LEFT4DEAD 40 /**< Engine released after Left 4 Dead (no SDK yet) */ #define SOURCE_SDK_LEFT4DEAD 40 /**< Engine released after Left 4 Dead (no SDK yet) */
#define SOURCE_SDK_LEFT4DEAD2 50 /**< Engine released after Left 4 Dead 2 (no SDK yet) */ #define SOURCE_SDK_LEFT4DEAD2 50 /**< Engine released after Left 4 Dead 2 (no SDK yet) */
#define SOURCE_SDK_ALIENSWARM 60 /**< SDK+Engine released after Alien Swarm */
#define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */ #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_INDEX 1 /**< Msg is auto determined by the engine */

View File

@ -389,7 +389,7 @@ native KvNodesInStack(Handle:kv);
* NOTE: All KeyValues are processed from the current location not the root one. * NOTE: All KeyValues are processed from the current location not the root one.
* *
* @param origin Origin KeyValues Handle. * @param origin Origin KeyValues Handle.
* @param dest Destination KeyValues Handlee. * @param dest Destination KeyValues Handle.
* @noreturn * @noreturn
* @error Invalid Handle. * @error Invalid Handle.
*/ */

27
env/include/lang.inc vendored
View File

@ -63,7 +63,7 @@ native SetGlobalTransTarget(client);
* *
* @param client Client index. * @param client Client index.
* @return Language number client is using. * @return Language number client is using.
* @error Invalid client index or client not in game. * @error Invalid client index or client not connected.
*/ */
native GetClientLanguage(client); native GetClientLanguage(client);
@ -94,3 +94,28 @@ native GetLanguageCount();
*/ */
native GetLanguageInfo(language, String:code[]="", codeLen=0, String:name[]="", nameLen=0); native GetLanguageInfo(language, String:code[]="", codeLen=0, String:name[]="", 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);
/**
* Retrieves the language number from a language code.
*
* @param code Language code (2-3 characters usually).
* @return Language number. -1 if not found.
*/
native GetLanguageByCode(const String:code[]);
/**
* Retrieves the language number from a language name.
*
* @param name Language name (case insensitive).
* @return Language number. -1 if not found.
*/
native GetLanguageByName(const String:name[]);

View File

@ -29,14 +29,39 @@ enum MapChange
*/ */
native NominateResult:NominateMap(const String:map[], bool:force, owner); native NominateResult:NominateMap(const String:map[], bool:force, owner);
/**
* Attempt to remove a map from the mapchooser map list.
*
* @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[]);
/**
* Attempt to remove a map from the mapchooser map list.
*
* @param owner Client index of the nominater.
* @return True if the nomination was found and removed, or false if the nomination was not found.
*/
native bool:RemoveNominationByOwner(owner);
/** /**
* Gets the current list of excluded maps. * Gets the current list of excluded maps.
* *
* @param array An ADT array handle to add the map strings to. Needs to be * @param array An ADT array handle to add the map strings to.
* @noreturn * @noreturn
*/ */
native GetExcludeMapList(Handle:array); native GetExcludeMapList(Handle: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);
/** /**
* Checks if MapChooser will allow a vote * Checks if MapChooser will allow a vote
* *
@ -75,6 +100,11 @@ native bool:EndOfMapVoteEnabled();
*/ */
forward OnNominationRemoved(const String:map[], owner); forward OnNominationRemoved(const String:map[], owner);
/**
* Called when mapchooser starts a Map Vote.
*/
forward OnMapVoteStarted();
public SharedPlugin:__pl_mapchooser = public SharedPlugin:__pl_mapchooser =
{ {
@ -90,7 +120,10 @@ public SharedPlugin:__pl_mapchooser =
public __pl_mapchooser_SetNTVOptional() public __pl_mapchooser_SetNTVOptional()
{ {
MarkNativeAsOptional("NominateMap"); MarkNativeAsOptional("NominateMap");
MarkNativeAsOptional("RemoveNominationByMap");
MarkNativeAsOptional("RemoveNominationByOwner");
MarkNativeAsOptional("GetExcludeMapList"); MarkNativeAsOptional("GetExcludeMapList");
MarkNativeAsOptional("GetNominatedMapList");
MarkNativeAsOptional("CanMapChooserStartVote"); MarkNativeAsOptional("CanMapChooserStartVote");
MarkNativeAsOptional("InitiateMapChooserVote"); MarkNativeAsOptional("InitiateMapChooserVote");
MarkNativeAsOptional("HasEndOfMapVoteFinished"); MarkNativeAsOptional("HasEndOfMapVoteFinished");

View File

@ -88,6 +88,7 @@ enum MenuAction
#define MENUFLAG_BUTTON_EXIT (1<<0) /**< Menu has an "exit" button (default if paginated) */ #define MENUFLAG_BUTTON_EXIT (1<<0) /**< Menu has an "exit" button (default if paginated) */
#define MENUFLAG_BUTTON_EXITBACK (1<<1) /**< Menu has an "exit back" button */ #define MENUFLAG_BUTTON_EXITBACK (1<<1) /**< Menu has an "exit back" button */
#define MENUFLAG_NO_SOUND (1<<2) /**< Menu will not have any select sounds */ #define MENUFLAG_NO_SOUND (1<<2) /**< Menu will not have any select sounds */
#define MENUFLAG_BUTTON_NOVOTE (1<<3) /**< Menu has a "No Vote" button at slot 1 */
#define VOTEINFO_CLIENT_INDEX 0 /**< Client index */ #define VOTEINFO_CLIENT_INDEX 0 /**< Client index */
#define VOTEINFO_CLIENT_ITEM 1 /**< Item the client selected, or -1 for none */ #define VOTEINFO_CLIENT_ITEM 1 /**< Item the client selected, or -1 for none */

View File

@ -49,6 +49,8 @@
#include <sdktools_entinput> #include <sdktools_entinput>
#include <sdktools_entoutput> #include <sdktools_entoutput>
#include <sdktools_hooks> #include <sdktools_hooks>
#include <sdktools_gamerules>
#include <sdktools_client>
enum SDKCallType enum SDKCallType
{ {
@ -57,6 +59,7 @@ enum SDKCallType
SDKCall_Player, /**< CBasePlayer call */ SDKCall_Player, /**< CBasePlayer call */
SDKCall_GameRules, /**< CGameRules call */ SDKCall_GameRules, /**< CGameRules call */
SDKCall_EntityList, /**< CGlobalEntityList call */ SDKCall_EntityList, /**< CGlobalEntityList call */
SDKCall_Raw, /**< |this| pointer with an arbitrary address */
}; };
enum SDKLibrary enum SDKLibrary

52
env/include/sdktools_client.inc vendored Normal file
View File

@ -0,0 +1,52 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#if defined _sdktools_client_included
#endinput
#endif
#define _sdktools_client_included
/**
* Sets the client to an inactive state waiting for a new map
*
* @param client The client index
* @noreturn
*/
native InactivateClient(client);
/**
* Reconnect a client without dropping the netchannel
*
* @param client The client index
* @noreturn
*/
native ReconnectClient(client);

View File

@ -148,7 +148,7 @@ native bool:GetClientEyeAngles(client, Float:ang[3]);
* invalid or there is already an edict using that index, it will error out. * invalid or there is already an edict using that index, it will error out.
* *
* @param classname Entity classname. * @param classname Entity classname.
* @param ForceEdictIndex Edict index used by the created entity. * @param ForceEdictIndex Edict index used by the created entity (ignored on Orangebox and above).
* @return Entity index on success, or -1 on failure. * @return Entity index on success, or -1 on failure.
* @error Invalid edict index, or no mod support. * @error Invalid edict index, or no mod support.
*/ */

194
env/include/sdktools_gamerules.inc vendored Normal file
View File

@ -0,0 +1,194 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2011 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#if defined _sdktools_gamerules_included
#endinput
#endif
#define _sdktools_gamerules_included
enum RoundState {
// initialize the game, create teams
RoundState_Init,
//Before players have joined the game. Periodically checks to see if enough players are ready
//to start a game. Also reverts to this when there are no active players
RoundState_Pregame,
//The game is about to start, wait a bit and spawn everyone
RoundState_StartGame,
//All players are respawned, frozen in place
RoundState_Preround,
//Round is on, playing normally
RoundState_RoundRunning,
//Someone has won the round
RoundState_TeamWin,
//Noone has won, manually restart the game, reset scores
RoundState_Restart,
//Noone has won, restart the game
RoundState_Stalemate,
//Game is over, showing the scoreboard etc
RoundState_GameOver,
//Game is over, doing bonus round stuff
RoundState_Bonus,
};
/**
* Retrieves an integer value from a property of the gamerules entity.
*
* @param prop Property name.
* @param size Number of bytes to read (valid values are 1, 2, or 4).
* 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.
* @return Value at the given property offset.
* @error Not supported.
*/
native GameRules_GetProp(const String:prop[], size=4, element=0);
/**
* Sets an integer value for a property of the gamerules entity.
*
* @param prop Property name.
* @param value Value to set.
* @param size Number of bytes to write (valid values are 1, 2, or 4).
* 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.
* @error Not supported.
* @noreturn
*/
native GameRules_SetProp(const String:prop[], any:value, size=4, element=0, bool:changeState=false);
/**
* Retrieves a float value from a property of the gamerules entity.
*
* @param prop Property name.
* @param element Element # (starting from 0) if property is an array.
* @return Value at the given property offset.
* @error Not supported.
*/
native Float:GameRules_GetPropFloat(const String:prop[], element=0);
/**
* Sets a float value for a property of the gamerules entity.
*
* @param prop Property name.
* @param value Value to set.
* @param element Element # (starting from 0) if property is an array.
* @noreturn
* @error Not supported.
*/
native GameRules_SetPropFloat(const String:prop[], Float:value, element=0, bool:changeState=false);
/**
* Retrieves a entity index from a property of the gamerules entity.
*
* @param prop Property name.
* @param element Element # (starting from 0) if property is an array.
* @return Entity index at the given property.
* If there is no entity, or the entity is not valid,
* then -1 is returned.
* @error Not supported.
*/
native GameRules_GetPropEnt(const String:prop[], element=0);
/**
* Sets an entity index for a property of the gamerules entity.
*
* @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 Not supported.
*/
native GameRules_SetPropEnt(const String:prop[], other, element=0, bool:changeState=false);
/**
* Retrieves a vector of floats from the gamerules entity, given a named network property.
*
* @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);
/**
* Sets a vector of floats in the gamerules entity, given a named network property.
*
* @param prop Property name.
* @param vec Vector to set.
* @param element Element # (starting from 0) if property is an array.
* @noreturn
* @error Not supported.
*/
native GameRules_SetPropVector(const String:prop[], const Float:vec[3], element=0, bool:changeState=false);
/**
* Gets a gamerules property as a string.
*
* @param prop Property to use.
* @param buffer Destination string buffer.
* @param maxlen Maximum length of output string buffer.
* @return Number of non-null bytes written.
* @error Not supported.
*/
native GameRules_GetPropString(const String:prop[], String:buffer[], maxlen);
/**
* Sets a gamerules property as a string.
*
* @param prop Property to use.
* @param buffer String to set.
* @return Number of non-null bytes written.
* @error Not supported.
*/
native GameRules_SetPropString(const String:prop[], const String:buffer[], bool:changeState=false);
/**
* Gets the current round state.
*
* @return Round state.
* @error Game doesn't support round state.
*/
stock RoundState:GameRules_GetRoundState()
{
return RoundState:GameRules_GetProp("m_iRoundState");
}

View File

@ -258,6 +258,15 @@ native EmitSentence(const clients[],
Float:soundtime = 0.0, Float:soundtime = 0.0,
any:...); any:...);
/**
*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);
/** /**
* Called when an ambient sound is about to be emitted to one or more clients. * Called when an ambient sound is about to be emitted to one or more clients.
* *

View File

@ -386,6 +386,16 @@ native GameConfGetOffset(Handle:gc, const String:key[]);
*/ */
native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[], maxlen); native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[], maxlen);
/*
* Finds an address calculation in a GameConfig file,
* performs LoadFromAddress on it as appropriate, then returns the final address.
*
* @param gameconf GameConfig Handle, or INVALID_HANDLE to use sdktools.games.txt.
* @param name Name of the property to find.
* @return An address calculated on success, or 0 on failure.
*/
native Address:GameConfGetAddress(Handle:gameconf, const String:name[]);
/** /**
* Returns the operating system's "tick count," which is a number of * Returns the operating system's "tick count," which is a number of
* milliseconds since the operating system loaded. This can be used * milliseconds since the operating system loaded. This can be used
@ -630,6 +640,41 @@ native FeatureStatus:GetFeatureStatus(FeatureType:type, const String:name[]);
native RequireFeature(FeatureType:type, const String:name[], native RequireFeature(FeatureType:type, const String:name[],
const String:fmt[]="", any:...); const String:fmt[]="", any:...);
/**
* Represents how many bytes we can read from an address with one load
*/
enum NumberType
{
NumberType_Int8,
NumberType_Int16,
NumberType_Int32
};
enum Address
{
Address_Null = 0, //a typical invalid result when an address lookup fails
Address_MinimumValid = 0x10000 //addresses below this value are considered invalid to use for Load/Store
};
/**
* Load up to 4 bytes from a memory address.
*
* @param addr Address to a memory location.
* @param size How many bytes should be read.
* @return The value that is stored at that address.
*/
native LoadFromAddress(Address:addr, NumberType:size);
/**
* Store up to 4 bytes to a memory address.
*
* @param addr Address to a memory location.
* @param data Value to store at the address.
* @param size How many bytes should be written.
* @noreturn
*/
native StoreToAddress(Address:addr, data, NumberType:size);
#include <helpers> #include <helpers>
#include <entity> #include <entity>
#include <entity_prop_stocks> #include <entity_prop_stocks>

View File

@ -379,7 +379,7 @@ native bool:IsCharLower(chr);
/** /**
* Strips a quote pair off a string if it exists. That is, the following * Strips a quote pair off a string if it exists. That is, the following
* replace rule is applied once: $"(.*)"^ -> $\1^ * replace rule is applied once: ^"(.*)"$ -> ^\1$
* *
* Note that the leading and trailing quotes will only be removed if both * Note that the leading and trailing quotes will only be removed if both
* exist. Otherwise, the string is left unmodified. This function should * exist. Otherwise, the string is left unmodified. This function should
@ -490,13 +490,16 @@ stock StrCat(String:buffer[], maxlength, const String:source[])
* @param buffers An array of string buffers (2D array). * @param buffers An array of string buffers (2D array).
* @param maxStrings Number of string buffers (first dimension size). * @param maxStrings Number of string buffers (first dimension size).
* @param maxStringLength Maximum length of each string buffer. * @param maxStringLength Maximum length of each string buffer.
* @param copyRemainder False (default) discard excess pieces, true to ignore
* delimiters after last piece.
* @return Number of strings retrieved. * @return Number of strings retrieved.
*/ */
stock ExplodeString(const String:text[], const String:split[], String:buffers[][], maxStrings, maxStringLength) stock ExplodeString(const String:text[], const String:split[], String:buffers[][], maxStrings,
maxStringLength, bool:copyRemainder = false)
{ {
new reloc_idx, idx, total; new reloc_idx, idx, total;
if (maxStrings < 1 || split[0] == '\0') if (maxStrings < 1 || !split[0])
{ {
return 0; return 0;
} }
@ -504,20 +507,17 @@ stock ExplodeString(const String:text[], const String:split[], String:buffers[][
while ((idx = SplitString(text[reloc_idx], split, buffers[total], maxStringLength)) != -1) while ((idx = SplitString(text[reloc_idx], split, buffers[total], maxStringLength)) != -1)
{ {
reloc_idx += idx; reloc_idx += idx;
if (text[reloc_idx] == '\0') if (++total == maxStrings)
{ {
break; if (copyRemainder)
{
strcopy(buffers[total-1], maxStringLength, text[reloc_idx-idx]);
} }
if (++total >= maxStrings)
{
return total; return total;
} }
} }
if (text[reloc_idx] != '\0' && total <= maxStrings - 1)
{
strcopy(buffers[total++], maxStringLength, text[reloc_idx]); strcopy(buffers[total++], maxStringLength, text[reloc_idx]);
}
return total; return total;
} }

120
env/include/tf2.inc vendored
View File

@ -82,10 +82,12 @@ enum TFCond
TFCond_TeleportedGlow, TFCond_TeleportedGlow,
TFCond_Taunting, TFCond_Taunting,
TFCond_UberchargeFading, TFCond_UberchargeFading,
TFCond_Unknown1, TFCond_Unknown1, //9
TFCond_CloakFlicker = 9,
TFCond_Teleporting, TFCond_Teleporting,
TFCond_Kritzkrieged, TFCond_Kritzkrieged,
TFCond_Unknown2, TFCond_Unknown2, //12
TFCond_TmpDamageBonus = 12,
TFCond_DeadRingered, TFCond_DeadRingered,
TFCond_Bonked, TFCond_Bonked,
TFCond_Dazed, TFCond_Dazed,
@ -93,17 +95,51 @@ enum TFCond
TFCond_Charging, TFCond_Charging,
TFCond_DemoBuff, TFCond_DemoBuff,
TFCond_CritCola, TFCond_CritCola,
TFCond_InHealRadius,
TFCond_Healing, TFCond_Healing,
TFCond_OnFire, TFCond_OnFire,
TFCond_Overhealed, TFCond_Overhealed,
TFCond_Jarated TFCond_Jarated,
TFCond_Bleeding,
TFCond_DefenseBuffed,
TFCond_Milked,
TFCond_MegaHeal,
TFCond_RegenBuffed,
TFCond_MarkedForDeath,
TFCond_NoHealingDamageBuff,
TFCond_SpeedBuffAlly,
TFCond_HalloweenCritCandy,
TFCond_CritHype = 36,
TFCond_CritOnFirstBlood,
TFCond_CritOnWin,
TFCond_CritOnFlagCapture,
TFCond_CritOnKill,
TFCond_RestrictToMelee
}; };
enum TFHoliday enum TFHoliday
{ {
TFHoliday_None = 1, TFHoliday_Birthday = 1,
TFHoliday_Halloween, TFHoliday_Halloween,
TFHoliday_Birthday TFHoliday_FullMoon,
TFHoliday_HalloweenOrFullMoon,
};
enum TFObjectType
{
TFObject_CartDispenser = 0,
TFObject_Dispenser = 0,
TFObject_Teleporter = 1,
TFObject_Sentry = 2,
TFObject_Sapper = 3
};
enum TFObjectMode
{
TFObjectMode_None = 0,
TFObjectMode_Entrance = 0,
TFObjectMode_Exit = 1
}; };
/** /**
@ -172,10 +208,11 @@ native TF2_SetPlayerPowerPlay(client, bool:enabled);
* @param client Player's index. * @param client Player's index.
* @param team Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect) * @param team Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
* @param class TFClassType class to disguise the player as * @param class TFClassType class to disguise the player as
* @param target Specific target player to disguise as (0 for any)
* @noreturn * @noreturn
* @error Invalid client index, client not in game, or no mod support. * @error Invalid client index, client not in game, or no mod support.
*/ */
native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class); native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class, target=0);
/** /**
* Removes the current disguise from a client. Only has an effect on spies. * Removes the current disguise from a client. Only has an effect on spies.
@ -199,6 +236,16 @@ native TF2_RemovePlayerDisguise(client);
*/ */
native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0); native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
/**
* Induces the bleed effect on a client
*
* @param client Player's index.
* @param attacker Attacker's index.
* @param float Duration of bleeding (in seconds).
* @noreturn
*/
native TF2_MakeBleed(client, attacker, Float:duration);
/** /**
* Retrieves the entity index of the CPlayerResource entity * Retrieves the entity index of the CPlayerResource entity
* *
@ -232,15 +279,62 @@ native TFClassType:TF2_GetClass(const String:classname[]);
forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result); forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
/** /**
* Called when the game checks to see if the current day is one of its tracked holidays * @deprecated No longer called. Use TF2_OnIsHolidayActive.
*
* @note Change the value of holiday and return Plugin_Changed to override.
* Return Plugin_Continue for no change.
*
* @param holiday Current Holiday
*/ */
#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.
* Return Plugin_Continue to let the original calculation or return a higher
* action to override the decision with the value of 'result'
*
* @param holiday Holiday being checked.
* @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);
/**
* Returns whether or not a client (Player) is in a duel.
*
* @param client Client Index.
* @return Boolean of whether or not the client/player is dueling.
*/
native bool:TF2_IsPlayerInDuel(client);
/**
* Called after a condition is added to a player
*
* @param client Index of the client to which the conditon is being added.
* @param condition Condition that is being added.
* @noreturn
*/
forward TF2_OnConditionAdded(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);
/**
* Called when the server enters the Waiting for Players round state
*
* @noreturn
*/
forward TF2_OnWaitingForPlayersStart();
/**
* Called when the server exits the Waiting for Players round state
*
* @noreturn
*/
forward TF2_OnWaitingForPlayersEnd();
/** /**
* Do not edit below this line! * Do not edit below this line!
*/ */
@ -268,7 +362,9 @@ public __ext_tf2_SetNTVOptional()
MarkNativeAsOptional("TF2_DisguisePlayer"); MarkNativeAsOptional("TF2_DisguisePlayer");
MarkNativeAsOptional("TF2_RemovePlayerDisguise"); MarkNativeAsOptional("TF2_RemovePlayerDisguise");
MarkNativeAsOptional("TF2_StunPlayer"); MarkNativeAsOptional("TF2_StunPlayer");
MarkNativeAsOptional("TF2_MakeBleed");
MarkNativeAsOptional("TF2_GetResourceEntity"); MarkNativeAsOptional("TF2_GetResourceEntity");
MarkNativeAsOptional("TF2_GetClass"); MarkNativeAsOptional("TF2_GetClass");
MarkNativeAsOptional("TF2_IsPlayerInDuel");
} }
#endif #endif

View File

@ -48,6 +48,7 @@
#define TF_CONDFLAG_TELEPORTGLOW (1 << 6) #define TF_CONDFLAG_TELEPORTGLOW (1 << 6)
#define TF_CONDFLAG_TAUNTING (1 << 7) #define TF_CONDFLAG_TAUNTING (1 << 7)
#define TF_CONDFLAG_UBERCHARGEFADE (1 << 8) #define TF_CONDFLAG_UBERCHARGEFADE (1 << 8)
#define TF_CONDFLAG_CLOAKFLICKER (1 << 9)
#define TF_CONDFLAG_TELEPORTING (1 << 10) #define TF_CONDFLAG_TELEPORTING (1 << 10)
#define TF_CONDFLAG_KRITZKRIEGED (1 << 11) #define TF_CONDFLAG_KRITZKRIEGED (1 << 11)
#define TF_CONDFLAG_DEADRINGERED (1 << 13) #define TF_CONDFLAG_DEADRINGERED (1 << 13)
@ -57,10 +58,17 @@
#define TF_CONDFLAG_CHARGING (1 << 17) #define TF_CONDFLAG_CHARGING (1 << 17)
#define TF_CONDFLAG_DEMOBUFF (1 << 18) #define TF_CONDFLAG_DEMOBUFF (1 << 18)
#define TF_CONDFLAG_CRITCOLA (1 << 19) #define TF_CONDFLAG_CRITCOLA (1 << 19)
#define TF_CONDFLAG_HEALING (1 << 20) #define TF_CONDFLAG_INHEALRADIUS (1 << 20)
#define TF_CONDFLAG_ONFIRE (1 << 21) #define TF_CONDFLAG_HEALING (1 << 21)
#define TF_CONDFLAG_OVERHEALED (1 << 22) #define TF_CONDFLAG_ONFIRE (1 << 22)
#define TF_CONDFLAG_JARATED (1 << 23) #define TF_CONDFLAG_OVERHEALED (1 << 23)
#define TF_CONDFLAG_JARATED (1 << 24)
#define TF_CONDFLAG_BLEEDING (1 << 25)
#define TF_CONDFLAG_DEFENSEBUFFED (1 << 26)
#define TF_CONDFLAG_MILKED (1 << 27)
#define TF_CONDFLAG_MEGAHEAL (1 << 28)
#define TF_CONDFLAG_REGENBUFFED (1 << 29)
#define TF_CONDFLAG_MARKEDFORDEATH (1 << 30)
#define TF_DEATHFLAG_KILLERDOMINATION (1 << 0) #define TF_DEATHFLAG_KILLERDOMINATION (1 << 0)
#define TF_DEATHFLAG_ASSISTERDOMINATION (1 << 1) #define TF_DEATHFLAG_ASSISTERDOMINATION (1 << 1)
@ -68,6 +76,171 @@
#define TF_DEATHFLAG_ASSISTERREVENGE (1 << 3) #define TF_DEATHFLAG_ASSISTERREVENGE (1 << 3)
#define TF_DEATHFLAG_FIRSTBLOOD (1 << 4) #define TF_DEATHFLAG_FIRSTBLOOD (1 << 4)
#define TF_DEATHFLAG_DEADRINGER (1 << 5) #define TF_DEATHFLAG_DEADRINGER (1 << 5)
#define TF_DEATHFLAG_INTERRUPTED (1 << 6)
#define TF_DEATHFLAG_GIBBED (1 << 7)
#define TF_DEATHFLAG_PURGATORY (1 << 8)
// Custom kill identifiers for the customkill property on the player_death event
enum {
TF_CUSTOM_HEADSHOT = 1,
TF_CUSTOM_BACKSTAB,
TF_CUSTOM_BURNING,
TF_CUSTOM_WRENCH_FIX,
TF_CUSTOM_MINIGUN,
TF_CUSTOM_SUICIDE,
TF_CUSTOM_TAUNT_HADOUKEN,
TF_CUSTOM_BURNING_FLARE,
TF_CUSTOM_TAUNT_HIGH_NOON,
TF_CUSTOM_TAUNT_GRAND_SLAM,
TF_CUSTOM_PENETRATE_MY_TEAM,
TF_CUSTOM_PENETRATE_ALL_PLAYERS,
TF_CUSTOM_TAUNT_FENCING,
TF_CUSTOM_PENETRATE_HEADSHOT,
TF_CUSTOM_TAUNT_ARROW_STAB,
TF_CUSTOM_TELEFRAG,
TF_CUSTOM_BURNING_ARROW,
TF_CUSTOM_FLYINGBURN,
TF_CUSTOM_PUMPKIN_BOMB,
TF_CUSTOM_DECAPITATION,
TF_CUSTOM_TAUNT_GRENADE,
TF_CUSTOM_BASEBALL,
TF_CUSTOM_CHARGE_IMPACT,
TF_CUSTOM_TAUNT_BARBARIAN_SWING,
TF_CUSTOM_AIR_STICKY_BURST,
TF_CUSTOM_DEFENSIVE_STICKY,
TF_CUSTOM_PICKAXE,
TF_CUSTOM_ROCKET_DIRECTHIT,
TF_CUSTOM_TAUNT_UBERSLICE,
TF_CUSTOM_PLAYER_SENTRY,
TF_CUSTOM_STANDARD_STICKY,
TF_CUSTOM_SHOTGUN_REVENGE_CRIT,
TF_CUSTOM_TAUNT_ENGINEER_SMASH,
TF_CUSTOM_BLEEDING,
TF_CUSTOM_GOLD_WRENCH,
TF_CUSTOM_CARRIED_BUILDING,
TF_CUSTOM_COMBO_PUNCH,
TF_CUSTOM_TAUNT_ENGINEER_ARM,
TF_CUSTOM_FISH_KILL,
TF_CUSTOM_TRIGGER_HURT,
TF_CUSTOM_DECAPITATION_BOSS,
TF_CUSTOM_STICKBOMB_EXPLOSION,
TF_CUSTOM_AEGIS_ROUND,
TF_CUSTOM_FLARE_EXPLOSION,
TF_CUSTOM_BOOTS_STOMP,
TF_CUSTOM_PLASMA,
TF_CUSTOM_PLASMA_CHARGED,
TF_CUSTOM_PLASMA_GIB,
TF_CUSTOM_PRACTICE_STICKY,
TF_CUSTOM_EYEBALL_ROCKET,
};
// Weapon codes as used in some events, such as player_death
// (not to be confused with Item Definition Indexes)
enum {
TF_WEAPON_NONE = 0,
TF_WEAPON_BAT,
TF_WEAPON_BAT_WOOD,
TF_WEAPON_BOTTLE,
TF_WEAPON_FIREAXE,
TF_WEAPON_CLUB,
TF_WEAPON_CROWBAR,
TF_WEAPON_KNIFE,
TF_WEAPON_FISTS,
TF_WEAPON_SHOVEL,
TF_WEAPON_WRENCH,
TF_WEAPON_BONESAW,
TF_WEAPON_SHOTGUN_PRIMARY,
TF_WEAPON_SHOTGUN_SOLDIER,
TF_WEAPON_SHOTGUN_HWG,
TF_WEAPON_SHOTGUN_PYRO,
TF_WEAPON_SCATTERGUN,
TF_WEAPON_SNIPERRIFLE,
TF_WEAPON_MINIGUN,
TF_WEAPON_SMG,
TF_WEAPON_SYRINGEGUN_MEDIC,
TF_WEAPON_TRANQ,
TF_WEAPON_ROCKETLAUNCHER,
TF_WEAPON_GRENADELAUNCHER,
TF_WEAPON_PIPEBOMBLAUNCHER,
TF_WEAPON_FLAMETHROWER,
TF_WEAPON_GRENADE_NORMAL,
TF_WEAPON_GRENADE_CONCUSSION,
TF_WEAPON_GRENADE_NAIL,
TF_WEAPON_GRENADE_MIRV,
TF_WEAPON_GRENADE_MIRV_DEMOMAN,
TF_WEAPON_GRENADE_NAPALM,
TF_WEAPON_GRENADE_GAS,
TF_WEAPON_GRENADE_EMP,
TF_WEAPON_GRENADE_CALTROP,
TF_WEAPON_GRENADE_PIPEBOMB,
TF_WEAPON_GRENADE_SMOKE_BOMB,
TF_WEAPON_GRENADE_HEAL,
TF_WEAPON_GRENADE_STUNBALL,
TF_WEAPON_GRENADE_JAR,
TF_WEAPON_GRENADE_JAR_MILK,
TF_WEAPON_PISTOL,
TF_WEAPON_PISTOL_SCOUT,
TF_WEAPON_REVOLVER,
TF_WEAPON_NAILGUN,
TF_WEAPON_PDA,
TF_WEAPON_PDA_ENGINEER_BUILD,
TF_WEAPON_PDA_ENGINEER_DESTROY,
TF_WEAPON_PDA_SPY,
TF_WEAPON_BUILDER,
TF_WEAPON_MEDIGUN,
TF_WEAPON_GRENADE_MIRVBOMB,
TF_WEAPON_FLAMETHROWER_ROCKET,
TF_WEAPON_GRENADE_DEMOMAN,
TF_WEAPON_SENTRY_BULLET,
TF_WEAPON_SENTRY_ROCKET,
TF_WEAPON_DISPENSER,
TF_WEAPON_INVIS,
TF_WEAPON_FLAREGUN,
TF_WEAPON_LUNCHBOX,
TF_WEAPON_JAR,
TF_WEAPON_COMPOUND_BOW,
TF_WEAPON_BUFF_ITEM,
TF_WEAPON_PUMPKIN_BOMB,
TF_WEAPON_SWORD,
TF_WEAPON_DIRECTHIT,
TF_WEAPON_LIFELINE,
TF_WEAPON_LASER_POINTER,
TF_WEAPON_DISPENSER_GUN,
TF_WEAPON_SENTRY_REVENGE,
TF_WEAPON_JAR_MILK,
TF_WEAPON_HANDGUN_SCOUT_PRIMARY,
TF_WEAPON_BAT_FISH,
TF_WEAPON_CROSSBOW,
TF_WEAPON_STICKBOMB,
TF_WEAPON_HANDGUN_SCOUT_SEC,
TF_WEAPON_SODA_POPPER,
TF_WEAPON_SNIPERRIFLE_DECAP,
TF_WEAPON_RAYGUN,
TF_WEAPON_PARTICLE_CANNON,
TF_WEAPON_MECHANICAL_ARM,
};
// TF2 Weapon Slots for GetPlayerWeaponSlot
enum
{
TFWeaponSlot_Primary,
TFWeaponSlot_Secondary,
TFWeaponSlot_Melee,
TFWeaponSlot_Grenade,
TFWeaponSlot_Building,
TFWeaponSlot_PDA,
TFWeaponSlot_Item1,
TFWeaponSlot_Item2
};
// Identifiers for the eventtype property on the teamplay_flag_event event
enum {
TF_FLAGEVENT_PICKEDUP = 1,
TF_FLAGEVENT_CAPTURED,
TF_FLAGEVENT_DEFENDED,
TF_FLAGEVENT_DROPPED,
TF_FLAGEVENT_RETURNED
};
enum TFResourceType enum TFResourceType
{ {
@ -133,15 +306,15 @@ stock TFClassType:TF2_GetPlayerClass(client)
* @param client Player's index. * @param client Player's index.
* @param class TFClassType class symbol. * @param class TFClassType class symbol.
* @param weapons This paramater is ignored. * @param weapons This paramater is ignored.
* @param persistant If true changes the players desired class so the change stays after death. * @param persistent If true changes the players desired class so the change stays after death.
* @noreturn * @noreturn
* @error Invalid client index. * @error Invalid client index.
*/ */
stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistant=true) stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistent=true)
{ {
SetEntProp(client, Prop_Send, "m_iClass", _:class); SetEntProp(client, Prop_Send, "m_iClass", _:class);
if (persistant) if (persistent)
{ {
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class); SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class);
} }
@ -254,7 +427,80 @@ stock TF2_RemoveAllWeapons(client)
* @param client Player's index. * @param client Player's index.
* @return Player's condition bits * @return Player's condition bits
*/ */
#pragma deprecated Use TF2_IsPlayerInCondition instead.
stock TF2_GetPlayerConditionFlags(client) stock TF2_GetPlayerConditionFlags(client)
{ {
return GetEntProp(client, Prop_Send, "m_nPlayerCond"); return GetEntProp(client, Prop_Send, "m_nPlayerCond")|GetEntProp(client, Prop_Send, "_condition_bits");
}
/**
* Check whether or not a condition is set on a player
*
* @param client Player's index.
* @return True if set, false otherwise
*/
stock bool:TF2_IsPlayerInCondition(client, TFCond:cond)
{
// Conditions are stored across two netprops now, one for each 32-bit segment.
if (_:cond < 32)
{
new bit = 1 << _:cond;
if ((GetEntProp(client, Prop_Send, "m_nPlayerCond") & bit) == bit)
{
return true;
}
if ((GetEntProp(client, Prop_Send, "_condition_bits") & bit) == bit)
{
return true;
}
}
else
{
new bit = (1 << (_:cond - 32));
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx") & bit) == bit)
{
return true;
}
}
return false;
}
/**
* Gets an entity's object type.
*
* @param entity Entity index.
* @return Current TFObjectType of entity.
* @error Invalid entity index.
*/
stock TFObjectType:TF2_GetObjectType(entity)
{
new offset = GetEntSendPropOffs(entity, "m_iObjectType");
if (offset <= 0)
{
ThrowError("Entity index %d is not an object", entity);
}
return TFObjectType:GetEntData(entity, offset);
}
/**
* Gets an entity's object mode.
*
* @param entity Entity index.
* @return Current TFObjectMode of entity.
* @error Invalid entity index.
*/
stock TFObjectMode:TF2_GetObjectMode(entity)
{
new offset = GetEntSendPropOffs(entity, "m_iObjectMode");
if (offset <= 0)
{
ThrowError("Entity index %d is not an object", entity);
}
return TFObjectMode:GetEntData(entity, offset);
} }

View File

@ -36,7 +36,7 @@
#define _version_included #define _version_included
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */ #define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
#define SOURCEMOD_V_MINOR 3 /**< SourceMod Minor version */ #define SOURCEMOD_V_MINOR 4 /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE 4 /**< SourceMod Release version */ #define SOURCEMOD_V_RELEASE 1 /**< SourceMod Release version */
#define SOURCEMOD_VERSION "1.3.4" /**< SourceMod version string (major.minor.release.build) */ #define SOURCEMOD_VERSION "1.4.1" /**< SourceMod version string (major.minor.release.build) */

BIN
env/linux/bin/spcomp-1.4.1 vendored Executable file

Binary file not shown.

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

Binary file not shown.

View File

@ -123,7 +123,7 @@ public Plugin:myinfo =
author = "Greyscale | Richard Helgeby", author = "Greyscale | Richard Helgeby",
description = "Infection/survival style gameplay", description = "Infection/survival style gameplay",
version = VERSION, version = VERSION,
url = "http://www.zombiereloaded.com" url = "http://forums.alliedmods.net/forumdisplay.php?f=132"
}; };
/** /**

View File

@ -21,7 +21,7 @@ fi
ZR_VERSION_FILE="src/zr/hgversion.h.inc" ZR_VERSION_FILE="src/zr/hgversion.h.inc"
ZR_PRODUCT_NAME="Zombie:Reloaded" ZR_PRODUCT_NAME="Zombie:Reloaded"
ZR_COPYRIGHT="Copyright (C) 2009 Greyscale, Richard Helgeby" ZR_COPYRIGHT="Copyright (C) 2009-2012 Greyscale, Richard Helgeby"
ZR_BRANCH="zr-3.0-b2" ZR_BRANCH="zr-3.0-b2"
ZR_REVISION=$(hg id -n):$(hg id -i) ZR_REVISION=$(hg id -n):$(hg id -i)