Raised This Month: $ Target: $400
 0% 

unlimited ammo


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-24-2009 , 18:38   unlimited ammo
Reply With Quote #1

hi,

i tried to give ammo to attacker but by first kill, happend nothing and user get ammo @ 2. kill.
can anyone fix this please?


PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>


#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    4
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)
#define m_pActiveItem 373

const NOCLIP_WPN_BS    = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))


new const 
g_MaxClipAmmo[] = 
{
    
0,
    
13//CSW_P228
    
0,
    
10//CSW_SCOUT
    
0,  //CSW_HEGRENADE
    
7,  //CSW_XM1014
    
0,  //CSW_C4
    
30,//CSW_MAC10
    
30//CSW_AUG
    
0,  //CSW_SMOKEGRENADE
    
15,//CSW_ELITE
    
20,//CSW_FIVESEVEN
    
25,//CSW_UMP45
    
30//CSW_SG550
    
35//CSW_GALIL
    
25//CSW_FAMAS
    
12,//CSW_USP
    
20,//CSW_GLOCK18
    
10//CSW_AWP
    
30,//CSW_MP5NAVY
    
100,//CSW_M249
    
8,  //CSW_M3
    
30//CSW_M4A1
    
30,//CSW_TMP
    
20//CSW_G3SG1
    
0,  //CSW_FLASHBANG
    
7,  //CSW_DEAGLE
    
30//CSW_SG552
    
30//CSW_AK47
    
0,  //CSW_KNIFE
    
50//CSW_P90
}
enum NadeType
{
    
NADE_HEGRENADE 0,
    
NADE_FLASHBANG,
    
NADE_SMOKEGREN,
}
const 
m_iClip 51;
new const 
g_nadewpnid[NadeType] =
{
    
4,
    
25,
    
9
}
new const 
g_nadename[NadeType][] =
{
    
"weapon_hegrenade",
    
"weapon_flashbang",
    
"weapon_smokegrenade"
}

new const 
g_nadeammomsg[NadeType] = 
{
    
12,
    
11,
    
13
}
new 
g_msg_ammo
public plugin_init() 
{
    
register_plugin"Deathmach manager" "1.0" "One" );
    
register_event("DeathMsg""DeathMsg""a");
    
g_msg_ammo         get_user_msgid("AmmoPickup")

}
public 
DeathMsg()
{
    new 
attacker read_data(1);
    new 
headshot read_data)
    
    if(
headshot)
    {
        if(
is_user_alive(attacker))
        {
            new 
iWeapon read_data(2)
            new 
old_hp get_user_health(attacker)
            
set_user_health(attackerold_hp 30)
            
give_nade(attackerNADE_HEGRENADE)
            
client_print(attacker,print_chat,"asdad")
            if( !( 
NOCLIP_WPN_BS & (1<<iWeapon) ) )
            {
                
fm_cs_set_weapon_ammoget_pdata_cbase(attackerm_pActiveItem) , g_MaxClipAmmoiWeapon ] )
            }
            
        }
    }
    else
    {
        if(
is_user_alive(attacker))
        {
            new 
iWeapon read_data(2)
            new 
old_hp get_user_health(attacker)
            
set_user_health(attackerold_hp 10)
            
cs_set_user_bpammo(attacker,CSW_M4A1,30)
            
client_print(attacker,print_chat,"asdad")
            if( !( 
NOCLIP_WPN_BS & (1<<iWeapon) ) )
            {
                
fm_cs_set_weapon_ammoget_pdata_cbase(attackerm_pActiveItem) , g_MaxClipAmmoiWeapon ] )
            }
        }
    }
}
give_nade(indexNadeType:nademode 0)
{
    switch(
mode)
    {
        case 
0:
        {
            new 
nadeammo cs_get_user_bpammo(index,g_nadewpnid[nade])
            if (
nadeammo == 0)
            {
                
give_item(index,g_nadename[nade])
            }
            else
            {
                
cs_set_user_bpammo(index,g_nadewpnid[nade],nadeammo+1)
                
                if (!
is_user_bot(index))
                {
                    
msg_ammo_pickup(index,nade)
                }
            }
            
            
        }
        case 
1:
        {
            
give_item(index,g_nadename[nade])
            
            
        }
        case 
2:
        {
            
cs_set_user_bpammo(index,g_nadewpnid[nade],cs_get_user_bpammo(index,g_nadewpnid[nade])+1)
            
            if (!
is_user_bot(index))
            {
                
msg_ammo_pickup(index,nade)
            }
            
            
        }
        case 
3:
        {
            return 
cs_get_user_bpammo(index,g_nadewpnid[nade])
        }
        default:
        {
            return 
0
        
}
    }
    
    return 
cs_get_user_bpammo(index,g_nadewpnid[nade])
}
msg_ammo_pickup(idNadeType:nade)
{
    
message_begin(MSG_ONEg_msg_ammo, {0,0,0}, id)
    
write_byte(g_nadeammomsg[nade])
    
write_byte(1)
    
message_end()

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
 



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 04:14.


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