Raised This Month: $51 Target: $400
 12% 

Adding Burst-Fire Mode to a weapon


Post New Thread Reply   
 
Thread Tools Display Modes
D4rkSiD3Rs
Senior Member
Join Date: Jan 2018
Location: Morocco
Old 07-02-2018 , 08:26   Re: Adding Burst-Fire Mode to a weapon
Reply With Quote #21

Quote:
Originally Posted by E1_531G View Post
So, just try:
hook secondary attack (with Ham) on weapon_m249 and use cs_set_weapon_burst( entity, 1 ), if you are right it will work otherwise it won't.

But I think you have seen a modified weapon based on Famas.
No, I don't think so! I'm sure it was M249, I think the server's owner made a plugin which change the fire rate of that weapon to make it like on burst fire mode
D4rkSiD3Rs is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-02-2018 , 12:27   Re: Adding Burst-Fire Mode to a weapon
Reply With Quote #22

You can view code of those Extra Items (Zombie Plague) which have Burst-Fire. I think such weapons are AN94 & WaterPistol.
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
Suntox
Member
Join Date: Nov 2016
Old 07-05-2018 , 20:50   Re: Adding Burst-Fire Mode to a weapon
Reply With Quote #23

Original code from WaterPistol.
try this:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "M429 Brust Fire"
#define VERSION "1.0"
#define AUTHOR "Suntox"

#define BURST_NUM 5
#define BURST_DELAY 0.025

#define wp_baseon_classname "weapon_m249"

#define TASK_BURST 123123

new g_iBurstNum[33], g_iBurst[33], Float:g_last_shoot[33], Float:g_last_fire[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_CmdStart"fw_CmdStart")
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_HANDLED
        
    
if(get_user_weapon(id) != CSW_M249)
        return 
FMRES_HANDLED
        
    
static CurButton
    CurButton 
get_uc(uc_handleUC_Buttons)
    
    if(
CurButton IN_ATTACK)
    {
        
CurButton &= ~IN_ATTACK
        set_uc
(uc_handleUC_ButtonsCurButton)
        
        static 
Float:CurTime
        CurTime 
get_gametime()
        
        new 
Float:flNextAttack flNextAttack get_pdata_float(id835)
        
        if (
flNextAttack 0.0)
            return 
FMRES_IGNORED        
        
        
if(CurTime 0.5 g_last_fire[id])
        {
            static 
ent
            ent 
find_ent_by_owner(-1wp_baseon_classnameid)
            
            if(
cs_get_weapon_ammo(ent) <= 0)
                return 
FMRES_IGNORED
            
            g_iBurst
[id] = 1
            g_iBurstNum
[id] = BURST_NUM
            
            g_last_fire
[id] = CurTime
        
}
    }
    
    return 
FMRES_HANDLED
}

public 
client_PostThink(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return

    if(
get_user_weapon(id) != CSW_M249)
        return
        
    if(!
g_iBurst[id] || !g_iBurstNum[id])
        return
    
    static 
Float:CurTime
    CurTime 
get_gametime()
    
    if(
CurTime BURST_DELAY g_last_shoot[id])
    {
        
do_burst(id)
        
g_last_shoot[id] = CurTime
    
}
}

public 
do_burst(id)
{
    static 
ent
    ent 
find_ent_by_owner(-1wp_baseon_classnameid)
    
    if(!
pev_valid(ent))
        return
            
    if(
g_iBurstNum[id] > && g_iBurst[id] && cs_get_weapon_ammo(ent) > 0)
    {
        
ExecuteHamB(Ham_Weapon_PrimaryAttackent)
        
        
set_weapon_anim(id1)
        
        
g_iBurstNum[id]--
    } else {
        
g_iBurst[id] = 0
        remove_task
(id+TASK_BURST)
    }
}

stock set_weapon_anim(idanim)
{
    
set_pev(idpev_weaponanimanim)

    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM_id)
    
write_byte(anim)
    
write_byte(pev(id,pev_body))
    
message_end()


Last edited by Suntox; 07-05-2018 at 20:51.
Suntox is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 07-07-2018 , 20:22   Re: Adding Burst-Fire Mode to a weapon
Reply With Quote #24

There is a plugin that adds burst fire to some weapons: https://forums.alliedmods.net/showthread.php?t=241129
lazarev is offline
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 19:12.


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