diff --git a/amxmodx/msvc12/amxmodx_mm.vcxproj b/amxmodx/msvc12/amxmodx_mm.vcxproj
index c02bfdef..6ae2689b 100644
--- a/amxmodx/msvc12/amxmodx_mm.vcxproj
+++ b/amxmodx/msvc12/amxmodx_mm.vcxproj
@@ -382,6 +382,7 @@
+
diff --git a/amxmodx/msvc12/amxmodx_mm.vcxproj.filters b/amxmodx/msvc12/amxmodx_mm.vcxproj.filters
index 86499225..07545eb8 100644
--- a/amxmodx/msvc12/amxmodx_mm.vcxproj.filters
+++ b/amxmodx/msvc12/amxmodx_mm.vcxproj.filters
@@ -600,6 +600,9 @@
Pawn Includes
+
+ Pawn Includes
+
+
@@ -167,6 +169,7 @@
+
diff --git a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters
index 33e30dbe..89db5505 100644
--- a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters
+++ b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters
@@ -59,6 +59,9 @@
Source Files
+
+ Source Files
+
@@ -94,10 +97,16 @@
Header Files
+
+ Header Files
+
Pawn Includes
+
+ Pawn Includes
+
\ No newline at end of file
diff --git a/plugins/include/amxconst.inc b/plugins/include/amxconst.inc
index 2512f09f..96dfcd21 100755
--- a/plugins/include/amxconst.inc
+++ b/plugins/include/amxconst.inc
@@ -118,43 +118,6 @@ public stock const Float:NULL_VECTOR[3];
#define PLUGIN_HANDLED 1 /* stop other plugins */
#define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */
-/**
- * IDs of weapons in CS
- */
-#define CSW_P228 1
-#define CSW_SCOUT 3
-#define CSW_HEGRENADE 4
-#define CSW_XM1014 5
-#define CSW_C4 6
-#define CSW_MAC10 7
-#define CSW_AUG 8
-#define CSW_SMOKEGRENADE 9
-#define CSW_ELITE 10
-#define CSW_FIVESEVEN 11
-#define CSW_UMP45 12
-#define CSW_SG550 13
-#define CSW_GALI 14
-#define CSW_GALIL 14
-#define CSW_FAMAS 15
-#define CSW_USP 16
-#define CSW_GLOCK18 17
-#define CSW_AWP 18
-#define CSW_MP5NAVY 19
-#define CSW_M249 20
-#define CSW_M3 21
-#define CSW_M4A1 22
-#define CSW_TMP 23
-#define CSW_G3SG1 24
-#define CSW_FLASHBANG 25
-#define CSW_DEAGLE 26
-#define CSW_SG552 27
-#define CSW_AK47 28
-#define CSW_KNIFE 29
-#define CSW_P90 30
-#define CSW_VEST 31 // Custom
-#define CSW_VESTHELM 32 // Custom
-#define CSW_SHIELDGUN 99
-
/**
* HI weapon constants
*/
@@ -187,6 +150,7 @@ public stock const Float:NULL_VECTOR[3];
#define HIT_RIGHTARM 5
#define HIT_LEFTLEG 6
#define HIT_RIGHTLEG 7
+#define HIT_SHIELD 8 // CS only
/**
* @section emit_sound() constants
@@ -485,3 +449,5 @@ enum HashType
Hash_Keccak_384, // Provides Keccak 384 bit hashing
Hash_Keccak_512 // Provides Keccak 512 bit hashing
};
+
+#include // To keep backward compatibility
\ No newline at end of file
diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc
index 041d35d9..70e3ade5 100755
--- a/plugins/include/cstrike.inc
+++ b/plugins/include/cstrike.inc
@@ -21,121 +21,7 @@
#pragma loadlib cstrike
#endif
-/**
- * @section Team and team model constants, used by cs_[get|set]_user_team().
- */
-
-/**
- * Internal Counter-Strike model id constants.
- *
- * @note Model ids starting with CZ_ are only valid in Condition Zero.
- */
-enum CsInternalModel
-{
- CS_NORESET = -1,
- CS_DONTCHANGE = 0,
- CS_CT_URBAN = 1,
- CS_T_TERROR = 2,
- CS_T_LEET = 3,
- CS_T_ARCTIC = 4,
- CS_CT_GSG9 = 5,
- CS_CT_GIGN = 6,
- CS_CT_SAS = 7,
- CS_T_GUERILLA = 8,
- CS_CT_VIP = 9,
- CZ_T_MILITIA = 10,
- CZ_CT_SPETSNAZ = 11,
-};
-
-/**
- * Counter-Strike team id constants.
- */
-enum CsTeams
-{
- CS_TEAM_UNASSIGNED = 0,
- CS_TEAM_T = 1,
- CS_TEAM_CT = 2,
- CS_TEAM_SPECTATOR = 3,
-};
-
-/**
- * @endsection
- */
-
-/**
- * Counter-Strike armor types for use with cs_[get|set]_user_armor().
- */
-enum CsArmorType
-{
- CS_ARMOR_NONE = 0, // no armor
- CS_ARMOR_KEVLAR = 1, // body vest only
- CS_ARMOR_VESTHELM = 2, // vest and helmet
-};
-
-/**
- * Map zone flags returned by cs_get_user_mapzones().
- */
-#define CS_MAPZONE_BUY (1<<0) // Buyzone
-#define CS_MAPZONE_BOMBTARGET (1<<1) // Bomb target zone
-#define CS_MAPZONE_HOSTAGE_RESCUE (1<<2) // Hostage rescue zone
-#define CS_MAPZONE_ESCAPE (1<<3) // Terrorist escape zone
-#define CS_MAPZONE_VIP_SAFETY (1<<4) // VIP escape zone
-
-/**
- * Constants used for cs_[get|set]_user_zoom().
- */
-enum
-{
- CS_RESET_ZOOM = 0, // Reset any zoom blocking (mode has no effect)
- CS_SET_NO_ZOOM, // Disable any sort of zoom
- CS_SET_FIRST_ZOOM, // Set first zoom level (AWP style)
- CS_SET_SECOND_ZOOM, // Set second zoom level (AWP style)
- CS_SET_AUGSG552_ZOOM, // Set AUG/SG552 zoom style
-};
-
-/**
- * Constants used for the CS_OnBuy() and CS_OnBuyAttempt() forwards.
- *
- * @note While these mostly overlap with the CSW_* constants the CSI_* constants
- * contain custom AMXX values that do not correspond to any real value in
- * the game. The CSI_* constants should therefore be used for consistency.
- */
-#define CSI_P228 CSW_P228
-#define CSI_SCOUT CSW_SCOUT
-#define CSI_HEGRENADE CSW_HEGRENADE
-#define CSI_XM1014 CSW_XM1014
-#define CSI_C4 CSW_C4
-#define CSI_MAC10 CSW_MAC10
-#define CSI_AUG CSW_AUG
-#define CSI_SMOKEGRENADE CSW_SMOKEGRENADE
-#define CSI_ELITE CSW_ELITE
-#define CSI_FIVESEVEN CSW_FIVESEVEN
-#define CSI_UMP45 CSW_UMP45
-#define CSI_SG550 CSW_SG550
-#define CSI_GALIL CSW_GALIL
-#define CSI_FAMAS CSW_FAMAS
-#define CSI_USP CSW_USP
-#define CSI_GLOCK18 CSW_GLOCK18
-#define CSI_AWP CSW_AWP
-#define CSI_MP5NAVY CSW_MP5NAVY
-#define CSI_M249 CSW_M249
-#define CSI_M3 CSW_M3
-#define CSI_M4A1 CSW_M4A1
-#define CSI_TMP CSW_TMP
-#define CSI_G3SG1 CSW_G3SG1
-#define CSI_FLASHBANG CSW_FLASHBANG
-#define CSI_DEAGLE CSW_DEAGLE
-#define CSI_SG552 CSW_SG552
-#define CSI_AK47 CSW_AK47
-#define CSI_P90 CSW_P90
-#define CSI_SHIELDGUN CSW_SHIELDGUN // The real CS value, use CSI_SHELD instead.
-#define CSI_VEST CSW_VEST // Custom
-#define CSI_VESTHELM CSW_VESTHELM // Custom
-#define CSI_DEFUSER 33 // Custom
-#define CSI_NVGS 34 // Custom
-#define CSI_PRIAMMO 36 // Custom
-#define CSI_SECAMMO 37 // Custom
-#define CSI_SHIELD 38 // Custom - The value passed by the forward, more convenient for plugins.
+#include
/**
* Returns client's deaths.
@@ -1139,6 +1025,157 @@ native cs_create_entity(const classname[]);
*/
native cs_find_ent_by_class(start_index, const classname[]);
+/**
+ * Finds an entity in the world using Counter-Strike's custom FindEntityByString
+ * wrapper, matching by owner.
+ *
+ * @note Unlike other mods CS keeps track of entities using a custom hashtable.
+ * This function utilizes the hasthable and allows for considerably faster
+ * classname lookup compared to the default FindEntityByString (used by
+ * find_ent_by_owner() for example).
+ * @note This exclusively considers entities in the hashtable, created by the
+ * game itself or using cs_create_entity().
+ *
+ * @param start_index Entity index to start searching from. -1 to start from
+ * the first entity
+ * @param classname Classname to search for
+ * @param owner Entity index to search for entity's owner
+ *
+ * @return Entity index > 0 if found, 0 otherwise
+ */
+native cs_find_ent_by_owner(start_index, const classname[], owner);
+
+/**
+ * Returns the item id associated with an item name and its aliases.
+ *
+ * @note The item name is case sensitive an can be with or without
+ * weapon_ and item_ prefixes. This can be a command alias as well.
+ * Values examples: ak47, weapon_ak47, kevlar, item_kevlar, vest, bullpup, ...
+ *
+ * @param name Alias or classname
+ * @param classid If item is a weapon, variable to store the associated
+ * weapon class id in (CS_WEAPONCLASS_* constants)
+ *
+ * @return Item id (CSI_* constants)
+ */
+native any:cs_get_item_id(const name[], &CsWeaponClassType:classid = CS_WEAPONCLASS_NONE);
+
+/**
+ * Returns an item name associated with a command alias.
+ *
+ * @note The alias is case sensitive.
+ * @note If not an alias to a weapon, buffer will be set with the original alias.
+ *
+ * @param alias Alias name
+ * @param itemname Buffer to store item name to
+ * @param maxlength Maximum buffer size
+ *
+ * @return True if alias is translated, false otherwise
+ */
+native bool:cs_get_translated_item_alias(const alias[], itemname[], maxlength);
+
+/**
+ * Returns some information about a weapon.
+ *
+ * @param weapon_id Weapon id, see CSW_* constants
+ * @param type Info type, see CS_WEAPONINFO_* constants
+ *
+ * @return Weapon information value
+ * @error If weapon_id and type are out of bound, an error will be thrown.
+ */
+native any:cs_get_weapon_info(weapon_id, CsWeaponInfo:type);
+
+/**
+ * Returns a weapon class id associated with a weapon id.
+ *
+ * @param weapon_id Weapon id (CSI_* constants)
+ *
+ * @return Weapon class id (CS_WEAPONCLASS_* constants)
+ */
+stock CsWeaponClassType:cs_get_weapon_class(weapon_id)
+{
+ new CsWeaponClassType:type = CS_WEAPONCLASS_NONE;
+
+ if (cs_is_valid_itemid(weapon_id, .weapon_only = true) || weapon_id == CSI_SHIELD)
+ {
+ switch (weapon_id)
+ {
+ case CSI_SHIELDGUN, CSI_SHIELD:
+ {
+ type = CS_WEAPONCLASS_PISTOL;
+ }
+ case CSI_KNIFE:
+ {
+ type = CS_WEAPONCLASS_KNIFE;
+ }
+ default:
+ {
+ new const bits = (1 << weapon_id);
+
+ if(bits & CSI_ALL_PISTOLS)
+ {
+ type = CS_WEAPONCLASS_PISTOL;
+ }
+ else if(bits & CSI_ALL_GRENADES)
+ {
+ type = CS_WEAPONCLASS_GRENADE;
+ }
+ else if(bits & CSI_ALL_SMGS)
+ {
+ type = CS_WEAPONCLASS_SUBMACHINEGUN;
+ }
+ else if(bits & CSI_ALL_SHOTGUNS)
+ {
+ type = CS_WEAPONCLASS_SHOTGUN;
+ }
+ else if(bits & CSI_ALL_MACHINEGUNS)
+ {
+ type = CS_WEAPONCLASS_MACHINEGUN;
+ }
+ else if(bits & CSI_ALL_RIFLES)
+ {
+ type = CS_WEAPONCLASS_RIFLE;
+ }
+ else if(bits & CSI_ALL_SNIPERRIFLES)
+ {
+ type = CS_WEAPONCLASS_SNIPERRIFLE;
+ }
+ }
+ }
+ }
+
+ return type;
+}
+
+/**
+ * Checks whether an item id is not out of bounds.
+ *
+ * @param id Item id (CSI_* constants)
+ * @param weapon_only If true, only the real weapon ids will be checked,
+ * including shield as well
+ *
+ * @return True if item id is valid, false otherwise
+ */
+stock bool:cs_is_valid_itemid(id, bool:weapon_only = false)
+{
+ if (id <= CSI_NONE)
+ {
+ return false;
+ }
+
+ if (id > CSI_LAST_WEAPON && id != CSI_SHIELDGUN && weapon_only)
+ {
+ return false;
+ }
+
+ if (id >= CSI_MAX_COUNT)
+ {
+ return false;
+ }
+
+ return true;
+}
+
/**
* Called when CS internally fires a command to a player.
*
diff --git a/plugins/include/cstrike_const.inc b/plugins/include/cstrike_const.inc
new file mode 100644
index 00000000..4478b9fb
--- /dev/null
+++ b/plugins/include/cstrike_const.inc
@@ -0,0 +1,487 @@
+// vim: set ts=4 sw=4 tw=99 noet:
+//
+// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
+// Copyright (C) The AMX Mod X Development Team.
+//
+// This software is licensed under the GNU General Public License, version 3 or higher.
+// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
+// https://alliedmods.net/amxmodx-license
+
+//
+// Counter-Strike Functions
+//
+
+#if defined _cstrike_const_included
+ #endinput
+#endif
+#define _cstrike_const_included
+
+/**
+ * IDs of weapons in CS
+ */
+#define CSW_NONE 0
+#define CSW_P228 1
+#define CSW_SCOUT 3
+#define CSW_HEGRENADE 4
+#define CSW_XM1014 5
+#define CSW_C4 6
+#define CSW_MAC10 7
+#define CSW_AUG 8
+#define CSW_SMOKEGRENADE 9
+#define CSW_ELITE 10
+#define CSW_FIVESEVEN 11
+#define CSW_UMP45 12
+#define CSW_SG550 13
+#define CSW_GALI 14
+#define CSW_GALIL 14
+#define CSW_FAMAS 15
+#define CSW_USP 16
+#define CSW_GLOCK18 17
+#define CSW_AWP 18
+#define CSW_MP5NAVY 19
+#define CSW_M249 20
+#define CSW_M3 21
+#define CSW_M4A1 22
+#define CSW_TMP 23
+#define CSW_G3SG1 24
+#define CSW_FLASHBANG 25
+#define CSW_DEAGLE 26
+#define CSW_SG552 27
+#define CSW_AK47 28
+#define CSW_KNIFE 29
+#define CSW_P90 30
+#define CSW_VEST 31 // Custom
+#define CSW_VESTHELM 32 // Custom
+#define CSW_SHIELDGUN 99
+#define CSW_LAST_WEAPON CSW_P90
+
+const CSW_ALL_WEAPONS = (~(1<(cbase, m_PevOffset);
}
+ edict_t* cbase_to_edict(void *cbase)
+ {
+ return entvar_to_edict(cbase_to_entvar(cbase));
+ }
+
int cbase_to_id(void *cbase)
{
return entvars_to_id(cbase_to_entvar(cbase));
diff --git a/support/PackageScript b/support/PackageScript
index 1d42f07e..314a861f 100644
--- a/support/PackageScript
+++ b/support/PackageScript
@@ -273,6 +273,7 @@ scripting_files = [
'include/core.inc',
'include/csstats.inc',
'include/cstrike.inc',
+ 'include/cstrike_const.inc',
'include/csx.inc',
'include/cvars.inc',
'include/datapack.inc',