View Single Post
josko
Member
Join Date: Dec 2008
Old 11-20-2020 , 12:26   Re: New-Era's Unlimited Ammo v1.0.1 Updated !
Reply With Quote #40

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>



// Temp lookup table (from csdm), will be in next sh version
new weapon_slot[] = {
	0,
	2,	//CSW_P228
	0,
	1,	//CSW_SCOUT
	4,	//CSW_HEGRENADE
	1,	//CSW_XM1014
	5,	//CSW_C4
	1,	//CSW_MAC10
	1,	//CSW_AUG
	4,	//CSW_SMOKEGRENADE
	2,	//CSW_ELITE
	2,	//CSW_FIVESEVEN
	1,	//CSW_UMP45
	1,	//CSW_SG550
	1,	//CSW_GALIL
	1,	//CSW_FAMAS
	2,	//CSW_USP
	2,	//CSW_GLOCK18
	1,	//CSW_AWP
	1,	//CSW_MP5NAVY
	1,	//CSW_M249
	1,	//CSW_M3
	1,	//CSW_M4A1
	1,	//CSW_TMP
	1,	//CSW_G3SG1
	4,	//CSW_FLASHBANG
	2,	//CSW_DEAGLE
	1,	//CSW_SG552
	1,	//CSW_AK47
	3,	//CSW_KNIFE
	1	//CSW_P90
}
// Temp Lookup table, will be in next sh version
new max_bp_ammo[] = {
        0,
        52,     //CSW_P228
        0,
        90,     //CSW_SCOUT
        1,      //CSW_HEGRENADE
        32,     //CSW_XM1014
        1,      //CSW_C4
        100,	//CSW_MAC10
        90,     //CSW_AUG
        1,      //CSW_SMOKEGRENADE
        120,	//CSW_ELITE
        100,	//CSW_FIVESEVEN
        100,	//CSW_UMP45
        90,     //CSW_SG550
        90,     //CSW_GALIL
        90,     //CSW_FAMAS
        100,	//CSW_USP
        120,	//CSW_GLOCK18
        30,     //CSW_AWP
        120,	//CSW_MP5NAVY
        200,	//CSW_M249
        32,     //CSW_M3
        90,     //CSW_M4A1
        120,	//CSW_TMP
        90,     //CSW_G3SG1
        2,      //CSW_FLASHBANG
        35,     //CSW_DEAGLE
        90,     //CSW_SG552
        90,     //CSW_AK47
        0,      //CSW_KNIFE
        100	    //CSW_P90
}
//---------------------------------------------------------------------------------------------------
public plugin_init()
{

    // Plugin Info
    register_plugin("UnlimitedAmmo", "1.0", "Vittu")

    // EVENTS
	register_event("CurWeapon", "event_curweapon", "be", "1=1")
}
//----------------------------------------------------------------------------------------------------
public event_curweapon(id)
{
    new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
	//new wpnid = read_data(2)

	new slot = weapon_slot[wpnid]

	// Make sure its a gun
	if ( slot == 1 || slot == 2 )
	{
		new maxBpAmmo = max_bp_ammo[wpnid]

		if ( cs_get_user_bpammo(id, wpnid) < maxBpAmmo )
			cs_set_user_bpammo(id, wpnid, maxBpAmmo)
	}
}
//-----------------------------------------------------------------------------------------------------

Here's a better Code I think. Ammo stays at the max values as they have by default, you just shoot and reload, truly unlimited ammo!

I think New-Eras plugin makes so you get 255 ammo on every gun? I don't like that if that is the case, then this code is much better, made by Vittu but for a Superhero mod hero called Inspector Tequila. I took the code from that and made this. Though I'll give all credit to Vittu since it's his code really.
josko is offline