Added cs_get_weapon_type(index)
This commit is contained in:
parent
6887dfef16
commit
3fc3ece5b0
|
@ -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}
|
||||
};
|
||||
|
|
|
@ -118,6 +118,8 @@
|
|||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/cstrike.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
|
@ -212,6 +214,9 @@
|
|||
RelativePath=".\moduleconfig.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\plugins\include\cstrike.inc">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user