Advertisement
Guest User

Untitled

a guest
Jan 7th, 2012
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. local CATEGORY_NAME = "Fun"
  2.  
  3. function ulx.uammo( calling_ply, target_plys )
  4.  
  5.  
  6.         for _, pl in ipairs( target_plys ) do
  7.         pl.UnlimitedAmmo = enabled
  8.            
  9.             if ( enabled ) then
  10.                 for _, wep in ipairs( pl:GetWeapons() ) do
  11.                     FillClips( pl, wep )
  12.                 end
  13.             end
  14.         end
  15.            
  16.    
  17.    
  18. end
  19.  
  20. function FillClips( ply, wep )
  21.     if wep:Clip1() < 255 then wep:SetClip1( 250 ) end
  22.     if wep:Clip2() < 255 then wep:SetClip2( 250 ) end
  23.    
  24.     if wep:GetPrimaryAmmoType() == 10 or wep:GetPrimaryAmmoType() == 8 then
  25.         ply:GiveAmmo( 9 - ply:GetAmmoCount( wep:GetPrimaryAmmoType() ), wep:GetPrimaryAmmoType() )
  26.     elseif wep:GetSecondaryAmmoType() == 9 or wep:GetSecondaryAmmoType() == 2 then
  27.         ply:GiveAmmo( 9 - ply:GetAmmoCount( wep:GetSecondaryAmmoType() ), wep:GetSecondaryAmmoType() )
  28.     end
  29. end
  30.  
  31. function Think()
  32. for _, ply in ipairs( player.GetAll() ) do
  33. if ( ply.UnlimitedAmmo and ply:Alive() and ply:GetActiveWeapon() != NULL ) then
  34. self:FillClips( ply, ply:GetActiveWeapon() )
  35. end
  36. end
  37. end
  38.  
  39.  
  40. local uammo = ulx.command( CATEGORY_NAME, "ulx uammo", ulx.uammo, "!uammo" )
  41. uammo:addParam{ type=ULib.cmds.PlayersArg }
  42. uammo:defaultAccess( ULib.ACCESS_ADMIN )
  43. uammo:help( "Gives Unlimited Ammo To Target(s)" )
  44. uammo:logString( "#1s allowed unlimited ammo for #2s ." )
  45. ulx.addToMenu( ulx.ID_MCLIENT, "Unlimited Ammo", "ulx uammo" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement