forked from Simnation/Main
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Function to select bait from available options
|
||||||
-- Function to select bait from available options
|
-- Function to select bait from available options
|
||||||
local function SelectBait()
|
local function SelectBait()
|
||||||
local availableBaits = {}
|
local availableBaits = {}
|
||||||
|
@ -72,44 +73,24 @@ local function SelectBait()
|
||||||
return availableBaits[1]
|
return availableBaits[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create a menu for bait selection using lib.registerMenu instead
|
-- Create a notification about available baits
|
||||||
local options = {}
|
local baitNames = ""
|
||||||
for _, bait in pairs(availableBaits) do
|
for i, bait in ipairs(availableBaits) do
|
||||||
table.insert(options, {
|
if i > 1 then baitNames = baitNames .. ", " end
|
||||||
title = bait.label,
|
baitNames = baitNames .. bait.label
|
||||||
description = 'Catch Bonus: +' .. bait.catchBonus .. '% | Loss Chance: ' .. bait.loseChance .. '%'
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local selectedBait = nil
|
TriggerEvent('wasabi_fishing:notify', 'Available Baits', 'You have: ' .. baitNames, 'inform')
|
||||||
|
|
||||||
lib.registerMenu({
|
-- Just use the best bait available (highest catch bonus)
|
||||||
id = 'bait_selection_menu',
|
table.sort(availableBaits, function(a, b)
|
||||||
title = 'Select Fishing Bait',
|
return a.catchBonus > b.catchBonus
|
||||||
position = 'top-right',
|
end)
|
||||||
options = options,
|
|
||||||
onSelect = function(selected)
|
|
||||||
selectedBait = availableBaits[selected]
|
|
||||||
end,
|
|
||||||
onClose = function()
|
|
||||||
-- Do nothing, selectedBait will remain nil
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
lib.showMenu('bait_selection_menu')
|
TriggerEvent('wasabi_fishing:notify', 'Selected Bait', 'Using ' .. availableBaits[1].label .. ' (best available)', 'inform')
|
||||||
|
return availableBaits[1]
|
||||||
-- 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
|
end
|
||||||
|
|
||||||
return selectedBait
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Function to handle the fishing process
|
-- Function to handle the fishing process
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue