 |
|
Way Past Expiration
Join Date: May 2009
Location: Latvia
|

05-19-2012
, 05:10
Re: Weapon Bullet Shell
|
#10
|
AFAIK you need to do some serious calculations.
Anyway I have Found some old code on my PC
Spoiler
Code:
// Make vectors
UTIL_MakeVectors( Player, v_angle + punchangle );
// Get player velocity and some other stuff
static Float:vVel[ 3 ], Float:vAngle[ 3 ], Float:vOrigin[ 3 ], Float:vViewOfs[ 3 ],
i, Float:vShellOrigin[ 3 ], Float:vShellVelocity[ 3 ], Float:vRight[ 3 ],
Float:vUp[ 3 ], Float:vForward[ 3 ];
pev( Player, pev_velocity, vVel );
pev( Player, pev_view_ofs, vViewOfs );
pev( Player, pev_angles, vAngle );
pev( Player, pev_origin, vOrigin );
global_get( glb_v_right, vRight );
global_get( glb_v_up, vUp );
global_get( glb_v_forward, vForward );
for( i = 0; i < 3; i++ )
{
vShellOrigin[ i ] = vOrigin[ i ] + vViewOfs[ i ] + vUp[ i ] * -12.0 + vForward[ i ] * 20.0 + vRight[ i ] * 4.0;
vShellVelocity[ i ] = vVel[ i ] + vRight[ i ] * random_float( 50.0, 70.0 ) + vUp[ i ] * random_float( 100.0, 150.0 ) + vForward[ i ] * 25.0;
}
}
CBaseWeapon__EjectBrass( Float:vecOrigin[ 3 ], Float:vecVelocity[ 3 ], Float:rotation, model, soundtype )
{
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, rotation );
write_short( model );
write_byte( soundtype );
write_byte( 25 ) // 2.5 seconds
message_end( );
}
__________________

|
|
|
|