Update client.lua
This commit is contained in:
		
							parent
							
								
									3d1ee7d52e
								
							
						
					
					
						commit
						30c73f0bfb
					
				
					 1 changed files with 14 additions and 33 deletions
				
			
		| 
						 | 
				
			
			@ -51,6 +51,7 @@ if Config.sellShop.enabled then
 | 
			
		|||
    end)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
-- Function to select bait from available options
 | 
			
		||||
-- Function to select bait from available options
 | 
			
		||||
local function SelectBait()
 | 
			
		||||
    local availableBaits = {}
 | 
			
		||||
| 
						 | 
				
			
			@ -72,46 +73,26 @@ local function SelectBait()
 | 
			
		|||
        return availableBaits[1]
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    -- Create a menu for bait selection using lib.registerMenu instead
 | 
			
		||||
    local options = {}
 | 
			
		||||
    for _, bait in pairs(availableBaits) do
 | 
			
		||||
        table.insert(options, {
 | 
			
		||||
            title = bait.label,
 | 
			
		||||
            description = 'Catch Bonus: +' .. bait.catchBonus .. '% | Loss Chance: ' .. bait.loseChance .. '%'
 | 
			
		||||
        })
 | 
			
		||||
    -- Create a notification about available baits
 | 
			
		||||
    local baitNames = ""
 | 
			
		||||
    for i, bait in ipairs(availableBaits) do
 | 
			
		||||
        if i > 1 then baitNames = baitNames .. ", " end
 | 
			
		||||
        baitNames = baitNames .. bait.label
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    local selectedBait = nil
 | 
			
		||||
    TriggerEvent('wasabi_fishing:notify', 'Available Baits', 'You have: ' .. baitNames, 'inform')
 | 
			
		||||
    
 | 
			
		||||
    lib.registerMenu({
 | 
			
		||||
        id = 'bait_selection_menu',
 | 
			
		||||
        title = 'Select Fishing Bait',
 | 
			
		||||
        position = 'top-right',
 | 
			
		||||
        options = options,
 | 
			
		||||
        onSelect = function(selected)
 | 
			
		||||
            selectedBait = availableBaits[selected]
 | 
			
		||||
        end,
 | 
			
		||||
        onClose = function()
 | 
			
		||||
            -- Do nothing, selectedBait will remain nil
 | 
			
		||||
        end
 | 
			
		||||
    })
 | 
			
		||||
    -- Just use the best bait available (highest catch bonus)
 | 
			
		||||
    table.sort(availableBaits, function(a, b)
 | 
			
		||||
        return a.catchBonus > b.catchBonus
 | 
			
		||||
    end)
 | 
			
		||||
    
 | 
			
		||||
    lib.showMenu('bait_selection_menu')
 | 
			
		||||
    
 | 
			
		||||
    -- Wait for selection with a timeout
 | 
			
		||||
    local startTime = GetGameTimer()
 | 
			
		||||
    while selectedBait == nil do
 | 
			
		||||
        Wait(100)
 | 
			
		||||
        -- Timeout after 15 seconds
 | 
			
		||||
        if GetGameTimer() - startTime > 15000 then
 | 
			
		||||
            return availableBaits[1] -- Default to first bait if no selection
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    return selectedBait
 | 
			
		||||
    TriggerEvent('wasabi_fishing:notify', 'Selected Bait', 'Using ' .. availableBaits[1].label .. ' (best available)', 'inform')
 | 
			
		||||
    return availableBaits[1]
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- Function to handle the fishing process
 | 
			
		||||
local function StartFishingProcess(selectedBait, waterLoc)
 | 
			
		||||
    fishing = true
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue