Raised This Month: $ Target: $400
 0% 

Switching Primary to secondary


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DIREKTOR
Senior Member
Join Date: Jan 2010
Location: On server
Old 05-22-2010 , 07:34   Switching Primary to secondary
Reply With Quote #1

Well is it possible to make script that will Switch to user secondary weapon (usp) and then to Knife Like pressing "Q" Rapidly .I wanna add that script insted of fm_strip_user_weapons(id); . Please Help me
__________________
Quote:
Originally Posted by KadiR View Post
Learn the fucking server rules you idiot.
DIREKTOR is offline
Send a message via MSN to DIREKTOR
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 05-22-2010 , 09:15   Re: Switching Primary to secondary
Reply With Quote #2

client_cmd("slot3;slot2");
=P

Edit: Wait, what weapon should be on user's hand at the end of the script?
Seta00 is offline
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
DIREKTOR
Senior Member
Join Date: Jan 2010
Location: On server
Old 05-22-2010 , 11:11   Re: Switching Primary to secondary
Reply With Quote #4

I figured it myself but thanks anyway
__________________
Quote:
Originally Posted by KadiR View Post
Learn the fucking server rules you idiot.
DIREKTOR is offline
Send a message via MSN to DIREKTOR
Reply



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