Raised This Month: $ Target: $400
 0% 

Switching Primary to secondary


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-22-2010 , 10:49   Re: Switching Primary to secondary
Reply With Quote #3

This will simulate pressing Q but only to toggle between pistol and knife.

Let me know if you need anything changed, here's how it works:
  • Holding pistol, primary, grenade, or C4 (anything other than knife) - Switch to knife
  • Holding knife - Switch to pistol
  • Holding knife but do not have a pistol - Do nothing
  • Holding nothing - Do nothing

PHP Code:
#include <fakemeta>
#include <hamsandwich>

public TogglePistolKnifeiPlayer )
{    
    static const 
m_pActiveItem 373;
    static const 
m_rpgPlayerItems_Slot2 369
    static const 
m_iId 43;

    static 
iActiveItem;
    static 
szWeapon19 ];
    static 
iEntity;
    
    
iActiveItem get_pdata_cbaseiPlayer m_pActiveItem );
    
    if( 
iActiveItem )
    {
        if ( 
ExecuteHamHam_Item_ItemSlot iActiveItem ) == )
        {
            
iEntity get_pdata_cbaseiPlayer m_rpgPlayerItems_Slot2 );
            
            if ( 
iEntity )
            {
                
get_weaponnameget_pdata_intiEntity m_iId ) , szWeapon charsmaxszWeapon ) );
                
engclient_cmdiPlayer szWeapon );
            }
        }
        else
        {
            
engclient_cmdiPlayer "weapon_knife" );    
        }
    }

or
PHP Code:
public TogglePistolKnifeiPlayer )
{    
    static const 
m_pActiveItem 373;
    static 
iActiveItem;

    
iActiveItem get_pdata_cbaseiPlayer m_pActiveItem );
    
    if( 
iActiveItem )
        
client_cmdiPlayer , ( ExecuteHamHam_Item_ItemSlot iActiveItem ) == ) ? "slot2;wait;wait;wait;+attack;wait;-attack" "slot3;wait;wait;wait;+attack;wait;-attack" );

__________________

Last edited by Bugsy; 05-22-2010 at 11:24.
Bugsy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode