Thread: Message 'Brass'
View Single Post
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 01-14-2012 , 19:21   Re: Message 'Brass'
Reply With Quote #3

I'm using this:

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 FloatvecOrigin[3], const FloatvecVelocity[3], FloatvecShellVelocity[3], FloatvecShellOrigin[3], 
    const 
FloatvecForward[3], const FloatvecRight[3], const FloatvecUp[3], const FloatflForwardScale, const FloatflUpScale, const FloatflRightScale)
{
    new 
FloatflR
    
new FloatflU
    
new FloatvecViewOfs[3]
    
    
vecViewOfs[2] = pev(iPlayerpev_flags) & FL_DUCKING VEC_DUCK_VIEW DEFAULT_VIEWHEIGHT
    
    flR 
random_float(50.070.0)
    
flU random_float(100.0150.0)
    
    for (new 
03i++)
    {
        
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 FloatvecOrigin[3], const FloatvecVelocity[3], const FloatflRotation, const iModelIndex, const iSoundtype)
{
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecOrigin0);
    
write_byte(TE_MODEL);
    
engfunc(EngFunc_WriteCoordvecOrigin[0]);
    
engfunc(EngFunc_WriteCoordvecOrigin[1]);
    
engfunc(EngFunc_WriteCoordvecOrigin[2]);
    
engfunc(EngFunc_WriteCoordvecVelocity[0]);
    
engfunc(EngFunc_WriteCoordvecVelocity[1]);
    
engfunc(EngFunc_WriteCoordvecVelocity[2]);
    
engfunc(EngFunc_WriteAngleflRotation)
    
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(iPluginiParams)
{
    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 
FloatvecUp[3]
    new 
FloatvecRight[3]
    new 
FloatvecForward[3]
    new 
FloatvecAngles[3]
    new 
FloatvecOrigin[3]
    new 
FloatvecVelocity[3]
    new 
FloatvecShellVelocity[3]
    new 
FloatvecShellOrigin[3]
    
    
pev(iPlayerpev_anglesvecAngles)
    
pev(iPlayerpev_originvecOrigin)
    
pev(iPlayerpev_velocityvecVelocity)
    
    
global_get(glb_v_forwardvecForward)
    
global_get(glb_v_rightvecRight)
    
global_get(glb_v_upvecUp)
    
    
GetDefaultShellInfo(iPlayervecOriginvecVelocityvecShellVelocityvecShellOriginvecForwardvecRightvecUpFloatget_param(4), Floatget_param(5), Floatget_param(6));
    
UTIL_EjectBrass(vecShellOriginvecShellVelocityvecAngles[2], get_param(2), get_param(3))
    
    return 
1;

__________________

Vi Veri Veniversum Vivus Vici
Russian Half-Life and Adrenaline Gamer community
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7