Fact check those magazines!

This commit is contained in:
Fesiug 2023-09-25 20:42:37 -04:00
parent f26c02d58d
commit d8b078bc5a
1 changed files with 6 additions and 13 deletions

View File

@ -66,7 +66,10 @@ concommand.Add("benny_inv_equip", function( ply, cmd, args )
wep:SetWep1( args[1] ) wep:SetWep1( args[1] )
wep:SetWep1Clip( item.Loaded ) wep:SetWep1Clip( item.Loaded )
wep:SetClip1( item[ "Ammo" .. item.Loaded ] ) if item.Loaded != 0 then
assert( item[ "Ammo" .. item.Loaded ], "That magazine doesn't exist." )
end
wep:SetClip1( item.Loaded == 0 and 0 or item[ "Ammo" .. item.Loaded ] )
wep:OnReloaded() wep:OnReloaded()
end) end)
@ -220,22 +223,12 @@ if CLIENT then
-- PROTO: These functions don't need to be remade over and over like this. -- PROTO: These functions don't need to be remade over and over like this.
function button:DoClick() function button:DoClick()
RunConsoleCommand("benny_inv_equip", button.ID) RunConsoleCommand("benny_inv_equip", button.ID)
timer.Simple( 0.1, function() regen_items( itemlist ) end ) timer.Simple( 0.1, function() if IsValid( itemlist ) then regen_items( itemlist ) end end )
end end
function button:DoRightClick() function button:DoRightClick()
RunConsoleCommand("benny_inv_discard", button.ID) RunConsoleCommand("benny_inv_discard", button.ID)
timer.Simple( 0.1, function() regen_items( itemlist ) end ) timer.Simple( 0.1, function() if IsValid( itemlist ) then regen_items( itemlist ) end end )
-- local Menu = DermaMenu()
-- Menu:AddOption( "Equip", function()
-- RunConsoleCommand("benny_inv_equip", button.ID)
-- timer.Simple( 0.1, function() regen_items( itemlist ) end )
-- end )
-- Menu:AddOption( "Discard", function()
-- RunConsoleCommand("benny_inv_discard", button.ID)
-- timer.Simple( 0.1, function() regen_items( itemlist ) end )
-- end )
-- Menu:Open()
end end
function button:Paint( w, h ) function button:Paint( w, h )