mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-11 22:38:10 +03:00
Fixed anim after cs_set_weapon_silenc
This commit is contained in:
parent
431bfbb4d9
commit
95445293a2
@ -243,10 +243,10 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params) // cs
|
|||||||
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
||||||
switch (weapontype) {
|
switch (weapontype) {
|
||||||
case CSW_M4A1:
|
case CSW_M4A1:
|
||||||
if (*silencemode == M4A1_SILENCED)
|
if (*silencemode & M4A1_SILENCED)
|
||||||
return 1;
|
return 1;
|
||||||
case CSW_USP:
|
case CSW_USP:
|
||||||
if (*silencemode == USP_SILENCED)
|
if (*silencemode & USP_SILENCED)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params) // cs
|
|||||||
{
|
{
|
||||||
// Silence/unsilence gun. Does only work on M4A1 and USP.
|
// Silence/unsilence gun. Does only work on M4A1 and USP.
|
||||||
// params[1] = weapon index
|
// params[1] = weapon index
|
||||||
// params[2] = 1, and we silence the gun, 0 and we unsilence gun-
|
// params[2] = 1, and we silence the gun, 0 and we unsilence gun.
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxEntities)
|
if (params[1] < 1 || params[1] > gpGlobals->maxEntities)
|
||||||
@ -281,22 +281,41 @@ static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params) // cs
|
|||||||
|
|
||||||
switch (weapontype) {
|
switch (weapontype) {
|
||||||
case CSW_M4A1:
|
case CSW_M4A1:
|
||||||
if (params[2])
|
if (params[2] == 1) {
|
||||||
*silencemode = M4A1_SILENCED;
|
if (!(*silencemode & M4A1_SILENCED)) { // want to silence - can't already be silenced
|
||||||
else
|
*silencemode |= M4A1_SILENCED;
|
||||||
*silencemode = M4A1_UNSILENCED;
|
// If this weapon has an owner that is a player, play animation for that player.
|
||||||
|
if (UTIL_IsPlayer(amx, pWeapon->v.owner))
|
||||||
|
pWeapon->v.owner->v.weaponanim = M4A1_ATTACHSILENCEANIM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (*silencemode & M4A1_SILENCED) { // want to unsilence - can't already be unsilenced
|
||||||
|
*silencemode &= ~M4A1_SILENCED;
|
||||||
|
// If this weapon has an owner that is a player, play animation for that player.
|
||||||
|
if (UTIL_IsPlayer(amx, pWeapon->v.owner))
|
||||||
|
pWeapon->v.owner->v.weaponanim = M4A1_DETACHSILENCEANIM;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CSW_USP:
|
case CSW_USP:
|
||||||
if (params[2])
|
if (params[2] == 1) {
|
||||||
*silencemode = USP_SILENCED;
|
if (!(*silencemode & USP_SILENCED)) { // want to silence - can't already be silenced
|
||||||
else
|
*silencemode |= USP_SILENCED;
|
||||||
*silencemode = USP_UNSILENCED;
|
// If this weapon has an owner that is a player, play animation for that player.
|
||||||
break;
|
if (UTIL_IsPlayer(amx, pWeapon->v.owner))
|
||||||
|
pWeapon->v.owner->v.weaponanim = USP_ATTACHSILENCEANIM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (*silencemode & USP_SILENCED) { // want to unsilence - can't already be unsilenced
|
||||||
|
*silencemode &= ~USP_SILENCED;
|
||||||
|
// If this weapon has an owner that is a player, play animation for that player.
|
||||||
|
if (UTIL_IsPlayer(amx, pWeapon->v.owner))
|
||||||
|
pWeapon->v.owner->v.weaponanim = USP_DETACHSILENCEANIM;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,10 +202,12 @@ pfnmodule_engine_g* g_engModuleFunc;
|
|||||||
//#define CSW_KNIFE 29
|
//#define CSW_KNIFE 29
|
||||||
#define CSW_P90 30
|
#define CSW_P90 30
|
||||||
|
|
||||||
#define M4A1_UNSILENCED 0
|
#define M4A1_SILENCED (1<<2)
|
||||||
#define M4A1_SILENCED 4
|
#define M4A1_ATTACHSILENCEANIM 6
|
||||||
#define USP_UNSILENCED 0
|
#define M4A1_DETACHSILENCEANIM 13
|
||||||
#define USP_SILENCED 1
|
#define USP_SILENCED (1<<0)
|
||||||
|
#define USP_ATTACHSILENCEANIM 7
|
||||||
|
#define USP_DETACHSILENCEANIM 15
|
||||||
|
|
||||||
#define GLOCK_SEMIAUTOMATIC 0
|
#define GLOCK_SEMIAUTOMATIC 0
|
||||||
#define GLOCK_BURSTMODE 2
|
#define GLOCK_BURSTMODE 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user