Does the grenade not throw because it gets holstered by the switch back
to original weapon? You could do some code to prevent grenade holstering
when its being thrown then. That will probably block the switch back
entirely though.
Next option would be, make a function in frag grenade like
"ThrowOffHand( CBaseCombatWeapon* pWeapon );" that calls the regular
primary attack and then switches back the weapon it's been invoked with
afterwards.
Scott Robson wrote:
>
>
> Hi list, I have this code for creating a new keyboard command for throwing a
> grenade, the issue i'm having with it is when I include the commented code
> (to revert back the the previous player weapon) it only starts to change to
> the grenade then reverts back to the previous weapon, if i leave the code out
> then it does change the weapon and throw a grenade but obviously does not
> change back. Can anyone help with this? Cheers, Scott. void CC_ThrowGrenade(
> void ){ CBasePlayer *pPlayer = UTIL_GetCommandClient(); if ( pPlayer ) {
> CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon(); if ( pWeapon ) {
> // Tell the client to stop selecting weapons engine->ClientCommand(
> UTIL_GetCommandClient()->edict(), "cancelselect" ); if (
> pPlayer->Weapon_OwnsThisType( "weapon_frag" ) ) { pPlayer->SelectItem(
> "weapon_frag" ); CBaseCombatWeapon *pFrag = pPlayer->GetActiveWeapon();
> pFrag->PrimaryAttack(); //pPlayer->SelectLastItem(); } } }}static
> ConCommand throw_grena
de( "throw_grenade", CC_ThrowGrenade );
> _________________________________________________________________
> Check out the new and improved services from Windows Live. Learn more!
> http://clk.atdmt.com/UKM/go/132630768/direct/01/
> _______________________________________________
> 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