What I've done for off-hand grenade (using a key to do it) throwing is, I don't 
switch weapons, but rather do all the logic in base code and throw the grenade 
there. That way it's truly offhand, and our weapons have animations for the 
throwing in them. Eliminates all problems with weapon switching too.



-Tony
-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Scott Robson
Sent: January-28-09 8:27 PM
To: [email protected]
Subject: [hlcoders] FW: Key activated grenade throw




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_grenade( "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

Reply via email to