Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CATEGORY_NAME = "Fun"
- function ulx.uammo( calling_ply, target_plys )
- for _, pl in ipairs( target_plys ) do
- pl.UnlimitedAmmo = enabled
- if ( enabled ) then
- for _, wep in ipairs( pl:GetWeapons() ) do
- FillClips( pl, wep )
- end
- end
- end
- end
- function FillClips( ply, wep )
- if wep:Clip1() < 255 then wep:SetClip1( 250 ) end
- if wep:Clip2() < 255 then wep:SetClip2( 250 ) end
- if wep:GetPrimaryAmmoType() == 10 or wep:GetPrimaryAmmoType() == 8 then
- ply:GiveAmmo( 9 - ply:GetAmmoCount( wep:GetPrimaryAmmoType() ), wep:GetPrimaryAmmoType() )
- elseif wep:GetSecondaryAmmoType() == 9 or wep:GetSecondaryAmmoType() == 2 then
- ply:GiveAmmo( 9 - ply:GetAmmoCount( wep:GetSecondaryAmmoType() ), wep:GetSecondaryAmmoType() )
- end
- end
- function Think()
- for _, ply in ipairs( player.GetAll() ) do
- if ( ply.UnlimitedAmmo and ply:Alive() and ply:GetActiveWeapon() != NULL ) then
- self:FillClips( ply, ply:GetActiveWeapon() )
- end
- end
- end
- local uammo = ulx.command( CATEGORY_NAME, "ulx uammo", ulx.uammo, "!uammo" )
- uammo:addParam{ type=ULib.cmds.PlayersArg }
- uammo:defaultAccess( ULib.ACCESS_ADMIN )
- uammo:help( "Gives Unlimited Ammo To Target(s)" )
- uammo:logString( "#1s allowed unlimited ammo for #2s ." )
- ulx.addToMenu( ulx.ID_MCLIENT, "Unlimited Ammo", "ulx uammo" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement