|
Veteran Member
Join Date: Jul 2006
Location: France (95)
|

02-24-2009
, 15:03
Re: Regen ammo,without sg,fb,he.
|
#7
|
You can use this full code, bpammo will not change.
If you still want to use your task, juste use the code i've put in Player_Spawn function and past it in your task.
PHP Code:
/* Copyright © 2009, ConnorMcLeod
Free Reload 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.
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 Free Reload; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <amxmodx> #include <fakemeta> #include <hamsandwich>
#define PLUGIN "Free Reload" #define AUTHOR "ConnorMcLeod" #define VERSION "0.0.1"
const NOCLIP_WPN_BS = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4)) const SHOTGUNS_BS = ((1<<CSW_M3)|(1<<CSW_XM1014))
// weapons offsets const m_pPlayer = 41 const m_iId = 43 const m_flNextPrimaryAttack = 46 const m_iPrimaryAmmoType = 49 const m_iClip = 51 const m_fInReload = 54 const m_fInSpecialReload = 55
// players offsets const m_flNextAttack = 83 new const m_rgAmmo_Player[] = {376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386}
new const g_iMaxAmmo[] = {0, 30, 90, 200, 90, 32, 100, 100, 35, 52, 120}
new const g_iMaxClip[CSW_P90+1] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8 , 30, 30, 20, 2, 7, 30, 30, -1, 50}
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
new szWeapon[17] for(new i=1; i<=CSW_P90; i++) { if( !(NOCLIP_WPN_BS & (1<<i)) && get_weaponname(i, szWeapon, charsmax(szWeapon)) ) { if( SHOTGUNS_BS & (1<<i) ) { RegisterHam(Ham_Weapon_Reload, szWeapon, "Shotgun_Reload") } else { RegisterHam(Ham_Item_PostFrame, szWeapon, "Item_PostFrame") } } } }
public Player_Spawn( id ) { if( is_user_alive( id ) ) { for(new i=1; i<sizeof(m_rgAmmo_Player); i++) { set_pdata_int(id, m_rgAmmo_Player[i], g_iMaxAmmo[i], 5) } } }
public Item_PostFrame( iEnt ) { if( get_pdata_int(iEnt, m_fInReload, 4) && get_pdata_float(get_pdata_cbase(iEnt, m_pPlayer, 4), m_flNextAttack, 5) ) { set_pdata_int(iEnt, m_iClip, g_iMaxClip[get_pdata_int(iEnt, m_iId, 4)], 4) set_pdata_int(iEnt, m_fInReload, 0, 4) return HAM_HANDLED } return HAM_IGNORED }
public Shotgun_Reload( iEnt ) { if( get_pdata_float(iEnt, m_flNextPrimaryAttack, 4) <= 0.0 && get_pdata_int(iEnt, m_fInSpecialReload, 4) == 2 ) { set_pdata_int(get_pdata_cbase(iEnt, m_pPlayer, 4), 381, 33, 5) } }
__________________
|
|