PHP Code:
// Temp entity bounce sound types
#define TE_BOUNCE_NULL 0
#define TE_BOUNCE_SHELL 1
#define TE_BOUNCE_SHOTSHELL 2
#define DEFAULT_VIEWHEIGHT 28.0
#define VEC_DUCK_VIEW 12.0
GetDefaultShellInfo(const iPlayer, const Float: vecOrigin[3], const Float: vecVelocity[3], Float: vecShellVelocity[3], Float: vecShellOrigin[3],
const Float: vecForward[3], const Float: vecRight[3], const Float: vecUp[3], const Float: flForwardScale, const Float: flUpScale, const Float: flRightScale)
{
new Float: flR
new Float: flU
new Float: vecViewOfs[3]
vecViewOfs[2] = pev(iPlayer, pev_flags) & FL_DUCKING ? VEC_DUCK_VIEW : DEFAULT_VIEWHEIGHT
flR = random_float(50.0, 70.0)
flU = random_float(100.0, 150.0)
for (new i = 0; i < 3; i++)
{
vecShellVelocity[i] = vecVelocity[i] + vecRight[i] * flR + vecUp[i] * flU + vecForward[i] * 25
vecShellOrigin[i] = vecOrigin[i] + vecViewOfs[i] + vecUp[i] * flUpScale + vecForward[i] * flForwardScale + vecRight[i] * flRightScale
}
}
UTIL_EjectBrass(const Float: vecOrigin[3], const Float: vecVelocity[3], const Float: flRotation, const iModelIndex, const iSoundtype)
{
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOrigin, 0);
write_byte(TE_MODEL);
engfunc(EngFunc_WriteCoord, vecOrigin[0]);
engfunc(EngFunc_WriteCoord, vecOrigin[1]);
engfunc(EngFunc_WriteCoord, vecOrigin[2]);
engfunc(EngFunc_WriteCoord, vecVelocity[0]);
engfunc(EngFunc_WriteCoord, vecVelocity[1]);
engfunc(EngFunc_WriteCoord, vecVelocity[2]);
engfunc(EngFunc_WriteAngle, flRotation)
write_short(iModelIndex)
write_byte(iSoundtype)
write_byte(25);// 2.5 seconds
message_end
}
/* LOL.
*
* native hl_wpn_eject_brass(const iPlayer, const iShellModelIndex, const iSoundtype, const Float: flForwardScale, const Float: flUpScale, const Float: flRightScale);
*/
public _hl_wpn_eject_brass(iPlugin, iParams)
{
if (iParams != 6)
{
log_error(AMX_ERR_NATIVE, "Bad arguments num, expected 6, passed %d", iParams);
return 0;
}
new iPlayer
CHECK_PLAYER((iPlayer = get_param(1)))
new Float: vecUp[3]
new Float: vecRight[3]
new Float: vecForward[3]
new Float: vecAngles[3]
new Float: vecOrigin[3]
new Float: vecVelocity[3]
new Float: vecShellVelocity[3]
new Float: vecShellOrigin[3]
pev(iPlayer, pev_angles, vecAngles)
pev(iPlayer, pev_origin, vecOrigin)
pev(iPlayer, pev_velocity, vecVelocity)
global_get(glb_v_forward, vecForward)
global_get(glb_v_right, vecRight)
global_get(glb_v_up, vecUp)
GetDefaultShellInfo(iPlayer, vecOrigin, vecVelocity, vecShellVelocity, vecShellOrigin, vecForward, vecRight, vecUp, Float: get_param(4), Float: get_param(5), Float: get_param(6));
UTIL_EjectBrass(vecShellOrigin, vecShellVelocity, vecAngles[2], get_param(2), get_param(3))
return 1;
}