diff --git a/dlls/cstrike/cstrike.cpp b/dlls/cstrike/cstrike.cpp
index fee2853f..0b9492e6 100755
--- a/dlls/cstrike/cstrike.cpp
+++ b/dlls/cstrike/cstrike.cpp
@@ -254,6 +254,30 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params) // cs
return 0;
}
+static cell AMX_NATIVE_CALL cs_get_weapon_type(AMX *amx, cell *params) // cs_get_weapon_type(index); = 1 param
+{
+ // Get weapon type. Corresponds to CSW_*
+ // params[1] = weapon index
+
+ // Valid entity should be within range
+ if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
+ {
+ MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
+ return 0;
+ }
+
+ // Make into edict pointer
+ edict_t *pWeapon = INDEXENT(params[1]);
+
+ // Check entity validity
+ if (FNullEnt(pWeapon)) {
+ MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
+ return 0;
+ }
+
+ return *((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
+}
+
static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params) // cs_set_weapon_silenced(index, silence = 1); = 2 params
{
// Silence/unsilence gun. Does only work on M4A1 and USP.
@@ -1384,6 +1408,7 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
{"cs_get_user_hasprim", cs_get_user_hasprimary},
{"cs_get_no_knives", cs_get_no_knives},
{"cs_set_no_knives", cs_set_no_knives},
+ {"cs_get_weapon_type", cs_get_weapon_type},
//------------------- <-- max 19 characters!
{NULL, NULL}
};
diff --git a/dlls/cstrike/cstrike.vcproj b/dlls/cstrike/cstrike.vcproj
index c33ef801..69d1ab2d 100755
--- a/dlls/cstrike/cstrike.vcproj
+++ b/dlls/cstrike/cstrike.vcproj
@@ -118,6 +118,8 @@
TargetEnvironment="1"
TypeLibraryName=".\Release/cstrike.tlb"
HeaderFileName=""/>
+
+
+
diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc
index b2fdf47f..71bb9850 100755
--- a/plugins/include/cstrike.inc
+++ b/plugins/include/cstrike.inc
@@ -177,6 +177,10 @@ native cs_get_weapon_ammo(index);
*/
native cs_set_weapon_ammo(index, newammo);
+/* Get weapon type. Corresponds to CSW_* in amxconst.inc: 1 is CSW_P228, 2 is CSW_SCOUT and so on...
+ */
+native cs_get_weapon_type(index);
+
/* Returns 1 if no knives mode is enabled, else 0.
*/
native cs_get_no_knives();