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

Help / Support [HELP] Adding 1 Ammo per 500 DMG to Shootgun


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MirChaker
Junior Member
Join Date: Jan 2010
Old 07-30-2015 , 15:00   [HELP] Adding 1 Ammo per 500 DMG to Shootgun
Reply With Quote #1

can someone help me putting this code so that this gun gives ammo per 500 dmg and with headshot it gives more.. i have zombie plague server which is running gunxp mode but this gun damage 1K per hit and still does not gives ammo after 1-2 shot it does give. please help

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <gunxpmod>
#include <engine>
#include <cstrike>

new PLUGIN_NAME[]     = "UNLOCK : Sawn Off Shotgun"
new PLUGIN_AUTHOR[]     = "xbatista"
new PLUGIN_VERSION[]     = "1.0"

new const WEAPON_V_MDL[] = "models/gunxpmod/v_double.mdl";
#define WEAPON_CSW CSW_M3
new const weapon_n[] = "weapon_xm1014";

const 
m_pPlayer    41;
const 
m_flPrimaryAttack 46;
const 
m_iClip 51;

#define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers )

new g_hasZoom[33];

new 
damage_weaponpCvarRofweapon_recoil;
new 
g_maxplayers;    
new 
bool:g_Weapon[33]=false
new 
Float:cl_pushangle[33][3];
new 
szClipszAmmo;

public 
plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
//register_gxm_item("Sawn Off Shotgun", "-Clip -Aim -Rate +Power +Scope ( Xm1014 )", 120)

    
damage_weapon register_cvar("gxm_damage_xm","10.0"); // damage multiplier
    
pCvarRof register_cvar"xm_rof""0.2" ); // weapon rof
    
weapon_recoil register_cvar"xm_recoil""2.0" ); // weapon recoil

    
register_event("CurWeapon""Event_CurWeapon""be""1=1");
    
    
RegisterHamHam_Weapon_PrimaryAttackweapon_n"Fwd_AttackSpeedPost" );
    
RegisterHam(Ham_Weapon_PrimaryAttackweapon_n"Fwd_AttackSpeedPre");
    
RegisterHam(Ham_TakeDamage"player""Ham_DamageWeapon");

    
register_forwardFM_CmdStart"Fwd_CmdStart" );

    
g_maxplayers get_maxplayers();
}

public 
gunxp_level_change_post(idlevel){
    
    
g_Weapon[id] = false;
    
    if (
level == 28){
            
g_Weapon[id] = true;
    }
}

public 
gunxp_gun_selected(idgun){
    if(
gun 7)
            
g_Weapon[id] = false;
    
    if (
gun == 28){
            
g_Weapon[id] = true;
    }
}
public 
client_connect(id
{
    
g_Weapon[id] = false;
}
public 
plugin_precache()  
{
    
engfunc(EngFunc_PrecacheModelWEAPON_V_MDL);
}

public 
Fwd_AttackSpeedPre(Ent)
{
    new 
id pev(Ent,pev_owner);
    
entity_get_vectoridEV_VEC_punchanglecl_pushangle[id]);
}
public 
Fwd_AttackSpeedPost( const Entity )
{
    static 
id id get_pdata_cbase(Entitym_pPlayer4)
    if (
g_Weapon[id] && IsPlayer(id) )
    {
        if ( 
pev_valid(Entity) )
        {
            static 
iClip iClip get_pdata_int(Entitym_iClip4)

            if ( 
iClip )
            {
                
set_pdata_int(Entitym_iClipiClip 34)
            }
            else if ( 
iClip <= )
            {
                
set_pdata_int(Entitym_iClip04)
            }
        }

        
set_pdata_floatEntitym_flPrimaryAttackget_pcvar_floatpCvarRof ), );

        new 
Float:push[3];
        
entity_get_vectoridEV_VEC_punchanglecl_pushangle[id]);
        
xs_vec_subpushcl_pushangle[id], push);
        
xs_vec_mul_scalarpushget_pcvar_floatweapon_recoil ), push);
        
xs_vec_addpushcl_pushangle[id], push);
        
entity_set_vectoridEV_VEC_punchanglepush);
    }
}

public 
Ham_DamageWeapon(idinflictorattackerFloat:damagedamagebits
{
    if ( !
IsPlayer(attacker) || !g_Weapon[attacker] )
            return 
HAM_IGNORED

    new 
weapon2 get_user_weapon(attacker__);
    if( 
weapon2 == WEAPON_CSW)
    {
        
SetHamParamFloat(4damage get_pcvar_float(damage_weapon));
        return 
HAM_HANDLED;
    }

    return 
HAM_IGNORED;
}
public 
Event_CurWeapon(id
{
    if ( !
g_Weapon[id] || !is_user_alive(id) )
    return 
PLUGIN_CONTINUE;

    new 
Gun read_data(2

    if( 
Gun == WEAPON_CSW)
    {
        
entity_set_string(idEV_SZ_viewmodelWEAPON_V_MDL)
    }

    return 
PLUGIN_CONTINUE;
}
public 
Fwd_CmdStartiduc_handleseed )
{
    if( !
is_user_aliveid ) || !g_Weapon[id] ) 
        return 
FMRES_IGNORED;

    if( ( 
get_ucuc_handleUC_Buttons ) & IN_ATTACK2 ) && !( pevidpev_oldbuttons ) & IN_ATTACK2 ) )
    {
        new 
szWeapID get_user_weaponidszClipszAmmo )

        if( 
szWeapID == WEAPON_CSW && !g_hasZoomid ])
        {
            
g_hasZoomid ] = true
            cs_set_user_zoom
idCS_SET_AUGSG552_ZOOM)
        }

        else 
        {    if( 
g_hasZoomid ] )
            {
                
g_hasZoomid ] = false
                cs_set_user_zoom
id,  CS_RESET_ZOOM)
            }
        }

        return 
FMRES_HANDLED;
    }

    return 
FMRES_IGNORED;

MirChaker is offline
thekiller123
Member
Join Date: Dec 2012
Old 08-01-2015 , 21:55   Re: [HELP] Adding 1 Ammo per 500 DMG to Shootgun
Reply With Quote #2

Try this:

PHP Code:
#include <amxmodx> 
#include <fakemeta> 
#include <hamsandwich> 
#include <xs> 
#include <gunxpmod> 
#include <engine> 
#include <cstrike>
#include <zombieplague>

new PLUGIN_NAME[]     = "UNLOCK : Sawn Off Shotgun" 
new PLUGIN_AUTHOR[]     = "xbatista" 
new PLUGIN_VERSION[]     = "1.0" 

new const WEAPON_V_MDL[] = "models/gunxpmod/v_double.mdl"
#define WEAPON_CSW CSW_M3 
new const weapon_n[] = "weapon_xm1014"

const 
m_pPlayer    41
const 
m_flPrimaryAttack 46
const 
m_iClip 51

#define IsPlayer(%1)  ( 1 <= %1 <= g_maxplayers ) 

new g_damagedealt_human[33], cvar_dmg_ap_allowcvar_ammodamagecvar_ammo_quantity;
new 
g_hasZoom[33];
new 
g_ammopacks[33];

new 
damage_weaponpCvarRofweapon_recoil
new 
g_maxplayers;     
new 
bool:g_Weapon[33]=false;  
new 
Float:cl_pushangle[33][3]; 
new 
szClipszAmmo

public 
plugin_init()  

    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR
    
//register_gxm_item("Sawn Off Shotgun", "-Clip -Aim -Rate +Power +Scope ( Xm1014 )", 120) 

    
damage_weapon register_cvar("gxm_damage_xm","10.0"); // damage multiplier 
    
pCvarRof register_cvar"xm_rof""0.2" ); // weapon rof 
    
weapon_recoil register_cvar"xm_recoil""2.0" ); // weapon recoil
    
cvar_dmg_ap_allow register_cvar("gxm_dmg_ap_reward_allow""1")
    
cvar_ammodamage register_cvar("gxm_dmg_for_reward""500")
    
cvar_ammo_quantity register_cvar("gxm_reward_ap_quantity""1")

    
register_event("CurWeapon""Event_CurWeapon""be""1=1"); 
     
    
RegisterHamHam_Weapon_PrimaryAttackweapon_n"Fwd_AttackSpeedPost" ); 
    
RegisterHam(Ham_Weapon_PrimaryAttackweapon_n"Fwd_AttackSpeedPre"); 
    
RegisterHam(Ham_TakeDamage"player""Ham_DamageWeapon"); 

    
register_forwardFM_CmdStart"Fwd_CmdStart" ); 

    
g_maxplayers get_maxplayers(); 


public 
gunxp_level_change_post(idlevel){ 
     
    
g_Weapon[id] = false
     
    if (
level == 28){ 
            
g_Weapon[id] = true
    } 


public 
gunxp_gun_selected(idgun){ 
    if(
gun 7
            
g_Weapon[id] = false
     
    if (
gun == 28){ 
            
g_Weapon[id] = true
    } 

public 
client_connect(id)  

    
g_Weapon[id] = false

public 
plugin_precache()   

    
engfunc(EngFunc_PrecacheModelWEAPON_V_MDL); 


public 
Fwd_AttackSpeedPre(Ent

    new 
id pev(Ent,pev_owner); 
    
entity_get_vectoridEV_VEC_punchanglecl_pushangle[id]); 

public 
Fwd_AttackSpeedPost( const Entity 

    static 
id id get_pdata_cbase(Entitym_pPlayer4
    if (
g_Weapon[id] && IsPlayer(id) ) 
    { 
        if ( 
pev_valid(Entity) ) 
        { 
            static 
iClip iClip get_pdata_int(Entitym_iClip4

            if ( 
iClip 
            { 
                
set_pdata_int(Entitym_iClipiClip 34
            } 
            else if ( 
iClip <= 
            { 
                
set_pdata_int(Entitym_iClip04
            } 
        } 

        
set_pdata_floatEntitym_flPrimaryAttackget_pcvar_floatpCvarRof ), ); 

        new 
Float:push[3]; 
        
entity_get_vectoridEV_VEC_punchanglecl_pushangle[id]); 
        
xs_vec_subpushcl_pushangle[id], push); 
        
xs_vec_mul_scalarpushget_pcvar_floatweapon_recoil ), push); 
        
xs_vec_addpushcl_pushangle[id], push); 
        
entity_set_vectoridEV_VEC_punchanglepush); 
    } 
}

public 
Ham_DamageWeapon(idinflictorattackerFloat:damagedamagebits)  

    if ( !
IsPlayer(attacker) || !g_Weapon[attacker] ) 
            return 
HAM_IGNORED;

    new 
weapon2 get_user_weapon(attacker__); 
    if( 
weapon2 == WEAPON_CSW
    { 
        
SetHamParamFloat(4damage get_pcvar_float(damage_weapon)); 
        return 
HAM_HANDLED
    }

    if(
get_pcvar_num(cvar_dmg_ap_allow))
    {
        
// Store damage dealt
        
g_damagedealt_human[attacker] += floatround(damage)
            
        
// Reward ammo packs for every [ammo damage] dealt
        
while (g_damagedealt_human[attacker] > get_pcvar_num(cvar_ammodamage))
        {
                
g_ammopacks[attacker]++
                
g_damagedealt_human[attacker] -= get_pcvar_num(cvar_ammodamage)
                
zp_set_user_ammo_packs(attackerzp_get_user_ammo_packs(attacker) + get_pcvar_num(cvar_ammo_quantity))
        }
    }

    return 
HAM_IGNORED
}

public 
Event_CurWeapon(id)  

    if ( !
g_Weapon[id] || !is_user_alive(id) ) 
    return 
PLUGIN_CONTINUE

    new 
Gun read_data(2)  

    if( 
Gun == WEAPON_CSW
    { 
        
entity_set_string(idEV_SZ_viewmodelWEAPON_V_MDL
    } 

    return 
PLUGIN_CONTINUE

public 
Fwd_CmdStartiduc_handleseed 

    if( !
is_user_aliveid ) || !g_Weapon[id] )  
        return 
FMRES_IGNORED

    if( ( 
get_ucuc_handleUC_Buttons ) & IN_ATTACK2 ) && !( pevidpev_oldbuttons ) & IN_ATTACK2 ) ) 
    { 
        new 
szWeapID get_user_weaponidszClipszAmmo 

        if( 
szWeapID == WEAPON_CSW && !g_hasZoomid ]) 
        { 
            
g_hasZoomid ] = true 
            cs_set_user_zoom
idCS_SET_AUGSG552_ZOOM
        } 

        else  
        {    if( 
g_hasZoomid ] ) 
            { 
                
g_hasZoomid ] = false 
                cs_set_user_zoom
id,  CS_RESET_ZOOM
            } 
        } 

        return 
FMRES_HANDLED
    } 

    return 
FMRES_IGNORED


Last edited by thekiller123; 08-01-2015 at 22:06.
thekiller123 is offline
MirChaker
Junior Member
Join Date: Jan 2010
Old 08-02-2015 , 16:34   Re: [HELP] Adding 1 Ammo per 500 DMG to Shootgun
Reply With Quote #3

not working :/ it is still the same
MirChaker is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 08-02-2015 , 19:57   Re: [HELP] Adding 1 Ammo per 500 DMG to Shootgun
Reply With Quote #4

at how many damage the players are getting 1 ammo pack?

Last edited by Depresie; 08-02-2015 at 19:58.
Depresie is offline
MirChaker
Junior Member
Join Date: Jan 2010
Old 08-03-2015 , 07:17   Re: [HELP] Adding 1 Ammo per 500 DMG to Shootgun
Reply With Quote #5

per 3-4 shots. 1 shot damages 300-2000 but it does not give ammo according to the damage this problem is happening with the guns of gunxp normal guns are working fine. Like Unlock Swan off Shotgun and Hunting Pump the guns of gunxp mod are occurring problems not giving ammo according to the damage.

Last edited by MirChaker; 08-03-2015 at 07:17.
MirChaker is offline
MirChaker
Junior Member
Join Date: Jan 2010
Old 08-03-2015 , 07:18   Re: [HELP] Adding 1 Ammo per 500 DMG to Shootgun
Reply With Quote #6

after 1K damage with multi shots or sometimes more thn 2K damage if 1 shot damage 1.8K headshot it does not give ammo until 2-3 shots are made players are getting ammo at every high damage rate.

Last edited by MirChaker; 08-03-2015 at 07:19.
MirChaker 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 11:03.


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