As I said. Look at the definition of GetActiveWeapon in c_basecombatweapon.cpp.
GetActiveWeapon always returns the active weapon of the local player. The owner 
will always be the local player and you use this weapon as the destination of 
the muzzleflash -> every muzzleflash will be send to the local players weapon.
-archy

-------- Original-Nachricht --------
> Datum: Fri, 10 Oct 2008 16:07:17 +0100
> Von: "Luke Smith" <[EMAIL PROTECTED]>
> An: "Discussion of Half-Life Programming" <hlcoders@list.valvesoftware.com>
> Betreff: Re: [hlcoders] Muzzle flash issue

> Thats what I'm trying to do yeah. but its not the muzzle flash. There are
> two events for that one for player and one for npc so thats no problem.
> This
> is with regard to the ejectbrass1 event that handles the ejecting the
> shells
> when firing weapons.
> 
> My entire case looks like this.
> 
> 
> case CL_EVENT_EJECTBRASS1:
> 
> if ( m_Attachments.Count() > 0 )
> 
> {
> 
>  C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
> 
> if (!pWeapon)
> 
> break;
> 
> C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
> 
> if (!pPlayer)
> 
> break;
> 
> C_BaseCombatCharacter *pOwner = ( pWeapon->GetOwner() );
> 
> if (!pOwner)
> 
> break;
> 
> 
> 
> bool bIsLocalPlayer = pPlayer && pPlayer == pOwner;
> 
> if ( bIsLocalPlayer )
> 
> {
> 
> *pWeapon = GetActiveWeapon();
> 
> if ( !pWeapon )
> 
> break;
> 
> 
> 
> if( pWeapon->GetAttachment( LookupAttachment( "1" ), attachOrigin,
> attachAngles ) )
> 
> {
> 
> tempents->EjectBrass( attachOrigin, attachAngles, GetAbsAngles(), atoi(
> options ) );
> 
> }
> 
> }
> 
> else
> 
> {
> 
> break;
> 
> }
> 
> }
> 
> break;
> 
> 
> 
> At the moment it runs the event when the player fires as well as when the
> enemy fires.
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to