|
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
|

12-24-2009
, 18:38
unlimited ammo
|
#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( 3 ) if(headshot) { if(is_user_alive(attacker)) { new iWeapon = read_data(2) new old_hp = get_user_health(attacker) set_user_health(attacker, old_hp + 30) give_nade(attacker, NADE_HEGRENADE) client_print(attacker,print_chat,"asdad") if( !( NOCLIP_WPN_BS & (1<<iWeapon) ) ) { fm_cs_set_weapon_ammo( get_pdata_cbase(attacker, m_pActiveItem) , g_MaxClipAmmo[ iWeapon ] ) } } } else { if(is_user_alive(attacker)) { new iWeapon = read_data(2) new old_hp = get_user_health(attacker) set_user_health(attacker, old_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_ammo( get_pdata_cbase(attacker, m_pActiveItem) , g_MaxClipAmmo[ iWeapon ] ) } } } } give_nade(index, NadeType:nade, mode = 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(id, NadeType:nade) { message_begin(MSG_ONE, g_msg_ammo, {0,0,0}, id) write_byte(g_nadeammomsg[nade]) write_byte(1) message_end() }
__________________
|
|