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

A better Burst-fire


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 07-11-2016 , 03:16   A better Burst-fire
Reply With Quote #1

When the player has Glock/Famas, if he press +attack it shoots normaly, but if he press +attack2 it shoots burst-fire (whiout affecting the +attack)

This is what i tryed so far:
PHP Code:
public fwdCmdStart(iducHandle)
{
    static 
tButtontWeapon
    
    tButton 
get_uc(ucHandleUC_Buttons)
    
tWeapon get_user_weapon(id)
    
    if(
tButton IN_ATTACK2)
    {
        switch(
tWeapon)
        {
            case 
CSW_GLOCK18CSW_FAMAS:
            {
                
set_uc(ucHandleUC_ButtonstButton &= ~IN_ATTACK2)
                
client_cmd(id"+attack;wait;wait;wait;-attack")
            }
        }
    }
    
    return 
FMRES_IGNORED

Is this possible to make?
Syturi0 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-11-2016 , 04:42   Re: A better Burst-fire
Reply With Quote #2

I think that's because client CMS is blocked by client. Try to set filtercmdstuff to 0. But I think using this way is not good , it's like using no recoil script.
See amxx server side aimbots or no recoil, no spread , something like this :

https://forums.alliedmods.net/archiv...p/t-81644.html
and look how they changed recoil.


P.S. If you want to use client cmd method then use eng_clientcmd to force attack and if you want to make it more accurate then make "wait" to be done by plugin not by client.

Last edited by siriusmd99; 07-11-2016 at 04:47.
siriusmd99 is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 07-15-2016 , 20:42   Re: A better Burst-fire
Reply With Quote #3

Quote:
Originally Posted by siriusmd99 View Post
I think that's because client CMS is blocked by client. Try to set filtercmdstuff to 0. But I think using this way is not good , it's like using no recoil script.
See amxx server side aimbots or no recoil, no spread , something like this :

https://forums.alliedmods.net/archiv...p/t-81644.html
and look how they changed recoil.


P.S. If you want to use client cmd method then use eng_clientcmd to force attack and if you want to make it more accurate then make "wait" to be done by plugin not by client.

No idea what you meant with that no recoil plugin, i checked the code, and it has nothing to do with what i want.

Also, no idea how to make "waits" done by plugin and not by client.



*BUMP*

Last edited by Syturi0; 07-16-2016 at 15:30.
Syturi0 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 07-16-2016 , 13:32   Re: A better Burst-fire
Reply With Quote #4

untested:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

public plugin_init()
{
    
RegisterHam(Ham_Item_PostFrame"weapon_famas""fw_ItemPostFrame"0)
}

public 
fw_ItemPostFrame(pWeapon)
{
         
/*
            all checks go here
        */

       
static pPlayerpPlayer get_pdata_cbase(pWeapon414);
       static 
bitButtonsbitButtons pev(pPlayerpev_button);

       if ((
bitButtons IN_ATTACK2) && (get_pdata_float(pWeapon474) <= 0.0))
       {
            
cs_set_weapon_burst(pPlayer,1)
            
ExecuteHamB(Ham_Weapon_PrimaryAttackpWeapon)
            
cs_set_weapon_burst(pPlayer,0)
            
set_pdata_float(pWeapon472.44);
            
set_pev(pPlayerpev_buttonbitButtons & ~IN_ATTACK2);
       }

__________________
JusTGo is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 07-28-2016 , 01:36   Re: A better Burst-fire
Reply With Quote #5

Quote:
Originally Posted by JusTGo View Post
untested:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

public plugin_init()
{
    
RegisterHam(Ham_Item_PostFrame"weapon_famas""fw_ItemPostFrame"0)
}

public 
fw_ItemPostFrame(pWeapon)
{
         
/*
            all checks go here
        */

       
static pPlayerpPlayer get_pdata_cbase(pWeapon414);
       static 
bitButtonsbitButtons pev(pPlayerpev_button);

       if ((
bitButtons IN_ATTACK2) && (get_pdata_float(pWeapon474) <= 0.0))
       {
            
cs_set_weapon_burst(pPlayer,1)
            
ExecuteHamB(Ham_Weapon_PrimaryAttackpWeapon)
            
cs_set_weapon_burst(pPlayer,0)
            
set_pdata_float(pWeapon472.44);
            
set_pev(pPlayerpev_buttonbitButtons & ~IN_ATTACK2);
       }

Nope, its all buggy and gives tons of console errors, doesnt work at all.
Syturi0 is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 07-28-2016 , 01:37   Re: A better Burst-fire
Reply With Quote #6

*BUMP*
Syturi0 is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-28-2016 , 17:00   Re: A better Burst-fire
Reply With Quote #7

Search for Weapon Balance Mod on the forum, i am sure you will find what you need in there
__________________
Depresie is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 07-28-2016 , 17:21   Re: A better Burst-fire
Reply With Quote #8

Quote:
Originally Posted by Depresie View Post
Search for Weapon Balance Mod on the forum, i am sure you will find what you need in there
It has nothing to do with what i want.

What i want is, when pressing mouse2 it shoots in Burst-Mode, when pressing mouse1 it shoots in Normal-Mode, instantly.
Syturi0 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-28-2016 , 19:48   Re: A better Burst-fire
Reply With Quote #9

PHP Code:
 Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <Hamsandwich>
#include <fakemeta>

#define PLUGIN "XXXXXXXX"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

#define WEAPON_LINUX    4

const m_iWeaponOwner 41

#define SetMode(%1,%2)      ((%1 |= (1 << ( %2 & 31))))
#define unSetMode(%1,%2)    ((%1 &= ~(1 << ( %2 & 31))))
#define CheckMode(%1,%2)    ((%1 & (1 << ( %2 & 31))))

new Mode

new const mode_weapons[][] = {
    
"weapon_glock18",
    
"weapon_famas"
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    for(new 
0sizeof mode_weaponsi++)
    {
        
RegisterHam(Ham_Item_Deploymode_weapons[i], "fw_wpn_deployed"false)
        
RegisterHam(Ham_Weapon_PrimaryAttackmode_weapons[i], "fw_player_firsmode"false)
        
RegisterHam(Ham_Weapon_SecondaryAttackmode_weapons[i], "fw_player_secmode"false)
    }
}

public 
fw_wpn_deployed( const iWpnid )
{
    if(!
pev_valid(wpnid))
        return 
HAM_IGNORED;
    
    new 
owner get_pdata_cbase(wpnidm_iWeaponOwnerWEAPON_LINUX)
    
    if(!
owner// no owner detected...
        
return HAM_IGNORED;
    
    
unSetMode(id,owner)
}

public 
fw_player_secmode(const wpnid)
{
    if(!
pev_valid(wpnid))
        return 
HAM_IGNORED;
    
    new 
owner get_pdata_cbase(wpnidm_iWeaponOwnerWEAPON_LINUX)
    
    if(!
owner// no owner detected...
        
return HAM_IGNORED;
    
    
    if(!(
CheckMode(Mode,owner)))
    {
        
SetMode(Mode,owner)
        
ExecuteHamB(Ham_Weapon_SecondaryAttackwpnid)
    }
    
    
ExecuteHamB(Ham_Weapon_PrimaryAttackwpnid)
    return 
HAM_SUPERCEDE;
}

public 
fw_player_firsmode(const wpnid)
{
    if(!
pev_valid(wpnid))
        return 
HAM_IGNORED;
    
    new 
owner get_pdata_cbase(wpnidm_iWeaponOwnerWEAPON_LINUX)
    
    if(!
owner// no owner detected...
        
return HAM_IGNORED;
    
    if((
CheckMode(Mode,owner)))
    {
        
unSetMode(Mode,owner)
        
ExecuteHamB(Ham_Weapon_SecondaryAttackwpnid)
    }
    
    
ExecuteHamB(Ham_Weapon_PrimaryAttackwpnid)
    return 
HAM_SUPERCEDE;

this should work i guess...

Last edited by Natsheh; 07-28-2016 at 20:01.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 07-28-2016 , 20:36   Re: A better Burst-fire
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
PHP Code:
 Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <Hamsandwich>
#include <fakemeta>

#define PLUGIN "XXXXXXXX"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

#define WEAPON_LINUX    4

const m_iWeaponOwner 41

#define SetMode(%1,%2)      ((%1 |= (1 << ( %2 & 31))))
#define unSetMode(%1,%2)    ((%1 &= ~(1 << ( %2 & 31))))
#define CheckMode(%1,%2)    ((%1 & (1 << ( %2 & 31))))

new Mode

new const mode_weapons[][] = {
    
"weapon_glock18",
    
"weapon_famas"
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    for(new 
0sizeof mode_weaponsi++)
    {
        
RegisterHam(Ham_Item_Deploymode_weapons[i], "fw_wpn_deployed"false)
        
RegisterHam(Ham_Weapon_PrimaryAttackmode_weapons[i], "fw_player_firsmode"false)
        
RegisterHam(Ham_Weapon_SecondaryAttackmode_weapons[i], "fw_player_secmode"false)
    }
}

public 
fw_wpn_deployed( const iWpnid )
{
    if(!
pev_valid(wpnid))
        return 
HAM_IGNORED;
    
    new 
owner get_pdata_cbase(wpnidm_iWeaponOwnerWEAPON_LINUX)
    
    if(!
owner// no owner detected...
        
return HAM_IGNORED;
    
    
unSetMode(id,owner)
}

public 
fw_player_secmode(const wpnid)
{
    if(!
pev_valid(wpnid))
        return 
HAM_IGNORED;
    
    new 
owner get_pdata_cbase(wpnidm_iWeaponOwnerWEAPON_LINUX)
    
    if(!
owner// no owner detected...
        
return HAM_IGNORED;
    
    
    if(!(
CheckMode(Mode,owner)))
    {
        
SetMode(Mode,owner)
        
ExecuteHamB(Ham_Weapon_SecondaryAttackwpnid)
    }
    
    
ExecuteHamB(Ham_Weapon_PrimaryAttackwpnid)
    return 
HAM_SUPERCEDE;
}

public 
fw_player_firsmode(const wpnid)
{
    if(!
pev_valid(wpnid))
        return 
HAM_IGNORED;
    
    new 
owner get_pdata_cbase(wpnidm_iWeaponOwnerWEAPON_LINUX)
    
    if(!
owner// no owner detected...
        
return HAM_IGNORED;
    
    if((
CheckMode(Mode,owner)))
    {
        
unSetMode(Mode,owner)
        
ExecuteHamB(Ham_Weapon_SecondaryAttackwpnid)
    }
    
    
ExecuteHamB(Ham_Weapon_PrimaryAttackwpnid)
    return 
HAM_SUPERCEDE;

this should work i guess...
Does not compile, few mistakes. I fixed them however it crashed my server soon as I deployed the famas weapon. I attached the my compiling version, if you want to fix it.
PHP Code:
/** AMX Mod X Script
 *  
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; either version 2 of the License, or ( at
 *  your option ) any later version.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *  See the GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * ***********************************************************
 */

 
#include <amxmodx>
#include <Hamsandwich>
#include <fakemeta>

#define PLUGIN  "burst_fire_mod"
#define VERSION "1.0"
#define AUTHOR  "Natsheh"

#define WEAPON_LINUX 4

const m_iWeaponOwner 41;

#define SetMode(%1,%2)   ( ( %1 |= ( 1 << ( %2 & 31 ) ) ) )
#define unSetMode(%1,%2) ( ( %1 &= ~( 1 << ( %2 & 31 ) ) ) )
#define CheckMode(%1,%2) ( ( %1 & ( 1 << ( %2 & 31 ) ) ) )

new Mode;

new const 
mode_weapons[][] =
{
    
"weapon_glock18",
    
"weapon_famas"
};

public 
plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    for( new 
0sizeof mode_weaponsi++ )
    {
        
RegisterHamHam_Item_Deploymode_weapons], "fw_wpn_deployed"false );
        
RegisterHamHam_Weapon_PrimaryAttackmode_weapons], "fw_player_firsmode"false );
        
RegisterHamHam_Weapon_SecondaryAttackmode_weapons], "fw_player_secmode"false );
    }
}

public 
fw_wpn_deployed( const wpnid )
{
    if( !
pev_validwpnid ) )
    {
        return 
HAM_IGNORED;
    }
    
    new 
owner get_pdata_cbasewpnidm_iWeaponOwnerWEAPON_LINUX );
    
    if( !
owner // no owner detected...
    
{
        return 
HAM_IGNORED;
    }
    
    
unSetModeModeowner );
    return 
HAM_IGNORED;
}

public 
fw_player_secmode( const wpnid )
{
    if( !
pev_validwpnid ) )
    {
        return 
HAM_IGNORED;
    }
    
    new 
owner get_pdata_cbasewpnidm_iWeaponOwnerWEAPON_LINUX );
    
    if( !
owner // no owner detected...
    
{
        return 
HAM_IGNORED;
    }
    
    if( !( 
CheckModeModeowner ) ) )
    {
        
SetModeModeowner );
        
ExecuteHamBHam_Weapon_SecondaryAttackwpnid );
    }
    
    
ExecuteHamBHam_Weapon_PrimaryAttackwpnid );
    return 
HAM_SUPERCEDE;
}

public 
fw_player_firsmode( const wpnid )
{
    if( !
pev_validwpnid ) )
    {
        return 
HAM_IGNORED;
    }
    
    new 
owner get_pdata_cbasewpnidm_iWeaponOwnerWEAPON_LINUX );
    
    if( !
owner // no owner detected...
    
{
        return 
HAM_IGNORED;
    }
    
    if( ( 
CheckModeModeowner ) ) )
    {
        
unSetModeModeowner );
        
ExecuteHamBHam_Weapon_SecondaryAttackwpnid );
    }
    
    
ExecuteHamBHam_Weapon_PrimaryAttackwpnid );
    return 
HAM_SUPERCEDE;

I over looked the code and a saw this:
Code:
new owner = get_pdata_cbase(wpnid, m_iWeaponOwner, WEAPON_LINUX)
It doc says:
Code:
get_pdata_cbase(id, offset, linuxdiff=5, macdiff=5);

This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
This requires the mod to have the pev and base fields set in hamdata.ini.
Note this dereferences memory! Improper use of this will crash the server.
This will return an index of the corresponding cbase field in private data.

Return -1 on a null entry (-1 for none set) or the index of the corresponding pdata field.
Also, it return -1 on failure, so you check will not be useful or are you expecting zero to return?
Code:
    new owner = get_pdata_cbase( wpnid, m_iWeaponOwner, WEAPON_LINUX );         if( !owner ) // no owner detected...     {         return HAM_IGNORED;     }
Doing 'if( owner < 0 )' should handle it.
Attached Files
File Type: sma Get Plugin or Get Source (burst_fire_mod.sma - 244 views - 3.0 KB)
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 07-28-2016 at 20:49. Reason: misspellings
addons_zz 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:08.


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