AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Shot on ATTACK2 (https://forums.alliedmods.net/showthread.php?t=170440)

The Inhabitant Of Heavens 10-24-2011 17:42

Shot on ATTACK2
 
How to make a shot at ATTACK2?

weapon_xm1014

PHP Code:

public fw_CmdStart(iduc_handleseed)
{
    if ((!
is_user_alive(id) )
        return 
FMRES_IGNORED

    
if (get_user_weapon(id) == CSW_XM1014)
    {
        if ((
get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_oldbuttons) & IN_ATTACK2))
        {
            new 
xm1014 find_ent_by_owner(-1"weapon_xm1014"id)
            
ExecuteHam(Ham_Weapon_PrimaryAttackxm1014)
        }
    }
    return 
FMRES_HANDLED


This is not working

Stereo 10-24-2011 17:48

Re: Shot on ATTACK2
 
PHP Code:

if(get_user_weapon(id) == CSW_XM1014
{
        
ExecuteHam(Ham_Weapon_PrimaryAttackid)



The Inhabitant Of Heavens 10-24-2011 18:45

Re: Shot on ATTACK2
 
server crashes

Bugsy 10-24-2011 19:06

Re: Shot on ATTACK2
 
Quote:

Originally Posted by Stereo (Post 1582710)
PHP Code:

if(get_user_weapon(id) == CSW_XM1014
{
        
ExecuteHam(Ham_Weapon_PrimaryAttackid)



You need to pass the weapon entity id to that but it will not work for weapons, you can use it to toss a grenade, though.

The ammo reduces with each shot though no sound is played and it doesn't look like a shot is happening:
PHP Code:

public fw_CmdStart(iduc_handleseed)
{
    if ( !
is_user_aliveid ) )
        return 
FMRES_IGNORED
    
    
if ( get_user_weaponid ) == CSW_XM1014 )
    {
        if ( ( 
get_uc(uc_handleUC_Buttons) & IN_ATTACK2 ) && !( pevid pev_oldbuttons ) & IN_ATTACK2 ) )
        {
            
set_ucuc_handle UC_Buttons get_ucuc_handle UC_Buttons ) & ~IN_ATTACK2 );
            
            const 
m_pActiveItem 373;
            new 
iWeaponEnt get_pdata_cbaseid m_pActiveItem );
            
            
ExecuteHamHam_Weapon_PrimaryAttack iWeaponEnt );
        }
    }
    
    return 
FMRES_HANDLED



The Inhabitant Of Heavens 11-04-2011 04:50

Re: Shot on ATTACK2
 
Bugsy,thank you very much!

How to make a shot on ATTACK 2 (weapon_usp) as the automatic machine?

Quote:

if ((get_uc(uc_handle, UC_Buttons) & IN_ATTACK2) && !(pev(id, pev_oldbuttons) & IN_ATTACK2))
{
PrimanyAttack ( id )
}

Quote:

public PrimanyAttack( Player )
{
new test = find_ent_by_owner(-1, "weapon_usp", Player)

ExecuteHam( Ham_Weapon_PrimaryAttack , test );

play_anim ( Player, random_num( 5 , 6 ) )
}
....

The Inhabitant Of Heavens 11-04-2011 13:57

Re: Shot on ATTACK2
 
There are no ideas?

Bugsy 11-04-2011 14:23

Re: Shot on ATTACK2
 
You want it to fire like a machine gun when pressing attack 2?

The Inhabitant Of Heavens 11-04-2011 14:29

Re: Shot on ATTACK2
 
I want that shooting was all time keeping ATTACK2 (weapon usp)

The Inhabitant Of Heavens 11-06-2011 10:46

Re: Shot on ATTACK2
 
How to make pistols shoot when player is holding a primary attack button.Usually to make pistol fire you have to press attack button all the time


All times are GMT -4. The time now is 14:20.

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