ULX Unlimited Ammo

Hey Guys

I was wondering if someone could help me make a script to give unlimited ammo on ULX.

I found this script - http://pastebin.com/ezFTtMBA. However it doesn’t work and any of my attempts to modify the code have failed.



there is one in moreulx

So you just slap together part of the evolve unlimited ammo plugin with ULX shit and expect it to work?

It might not be perfect, but hey, it works:
[lua]local CATEGORY_NAME = “Fun”

function uammo( caller, target, unset )

if not unset then
	for k, v in pairs( target ) do v.uammo = true end
	str = "#A gave #T unlimited ammo"
	for k, v in pairs( target ) do v.uammo = false end
	str = "#A disabled #T's unlimited ammo"

ulx.fancyLogAdmin( caller, false, str, target )

local uammo = ulx.command( CATEGORY_NAME, “ulx uammo”, uammo, “!uammo” )
uammo:addParam{ type=ULib.cmds.PlayersArg }
uammo:addParam{ type=ULib.cmds.BoolArg, invisible=true }
uammo:defaultAccess( ULib.ACCESS_ADMIN )
uammo:help( “Give the target unlimited ammo.” )
uammo:setOpposite( “ulx unuammo”, { _, _, true }, “!unuammo” )

if SERVER then

hook.Remove( "Think", "uammo_GiveAmmo" )
hook.Add( "Think", "uammo_GiveAmmo", function()

	for k, v in pairs( player.GetAll() ) do

		if !v:Alive() or !v:GetActiveWeapon() or !v.uammo then return end
		wep = v:GetActiveWeapon()
		wep:SetClip1( 2 )
		wep:SetClip2( 2 )


end )


[editline]5th March 2014[/editline]

Unrelated: it’s quite sad to see the third result from googling “moreulx” is a leak site.

Sm63, I never expected it to work. I have experience in C++, C as well as a few other languages, however I have never programmed with LUA before and I did not know garrysmods functions so it was terrible guess work on my part. And I did not create the original script from pastebin.

Internet1001, thanks so much. Works like a charm.