Here you go
I added 1 to the max clip ammo just so the clip ammo will always appear full instead of -1. ie. Using glock should always say 12 but without +1 it will always say 11. I'm not sure if the +1 will cause errors or not, it didn't while I tested. If you don't care about the clip ammo always being -1 of max then just remove the +1.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "Unlimited Clip Ammo"
#define VERSION "1.0"
#define AUTHOR "bugsy"
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4
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
}
public plugin_init()
{
register_plugin( PLUGIN , VERSION , AUTHOR );
register_event( "CurWeapon" , "fw_CurWeapon" , "b" , "1=1" );
}
public fw_CurWeapon( id )
{
static szWeapon[32], iWeapon, iWeaponEntity;
iWeapon = read_data( 2 );
get_weaponname( iWeapon , szWeapon , sizeof szWeapon - 1 );
iWeaponEntity = fm_find_ent_by_owner( -1 , szWeapon , id );
fm_set_weapon_ammo( iWeaponEntity , g_MaxClipAmmo[ iWeapon ] + 1 );
}
public fm_find_ent_by_owner( entity , const classname[] , owner )
{
while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
return entity;
}
public fm_set_weapon_ammo(entity, amount)
{
set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
__________________