ed
|
@ -496,7 +496,43 @@ CodeStudio.Products = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
['magnet_fishing'] = {
|
||||||
|
categoryName = "Magnetfischen",
|
||||||
|
categoryLogo = "fa-tools",
|
||||||
|
items = {
|
||||||
|
['basic_magnet'] = {
|
||||||
|
itemName = "Standard Magnet",
|
||||||
|
itemStock = 50,
|
||||||
|
itemPrice = 100,
|
||||||
|
itemInfo = "",
|
||||||
|
},
|
||||||
|
['strong_magnet'] = {
|
||||||
|
itemName = "Starker Magnet",
|
||||||
|
itemStock = 50,
|
||||||
|
itemPrice = 150,
|
||||||
|
itemInfo = "",
|
||||||
|
},
|
||||||
|
['neodymium_magnet'] = {
|
||||||
|
itemName = "Neodymium Magnet",
|
||||||
|
itemStock = 50,
|
||||||
|
itemPrice = 200,
|
||||||
|
itemInfo = "",
|
||||||
|
},
|
||||||
|
['rare_earth_magnet'] = {
|
||||||
|
itemName = "Großer Neodymium Magnet",
|
||||||
|
itemStock = 50,
|
||||||
|
itemPrice = 250,
|
||||||
|
itemInfo = "",
|
||||||
|
},
|
||||||
|
['magnet_rope'] = {
|
||||||
|
itemName = "Magnetangel Seil",
|
||||||
|
itemStock = 150,
|
||||||
|
itemPrice = 400,
|
||||||
|
itemInfo = "",
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
['hardware'] = {
|
['hardware'] = {
|
||||||
|
@ -2987,6 +3023,7 @@ CodeStudio.Shops = {
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
[14] = {
|
[14] = {
|
||||||
ShopName = 'Millars Fishery',
|
ShopName = 'Millars Fishery',
|
||||||
Category = {
|
Category = {
|
||||||
|
@ -3007,7 +3044,7 @@ CodeStudio.Shops = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
[14] = {
|
[15] = {
|
||||||
ShopName = 'Whitewater Adventures',
|
ShopName = 'Whitewater Adventures',
|
||||||
Category = {
|
Category = {
|
||||||
[1] = 'freizeit',
|
[1] = 'freizeit',
|
||||||
|
@ -3027,11 +3064,25 @@ CodeStudio.Shops = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[16] = {
|
||||||
|
ShopName = 'John',
|
||||||
|
Category = {
|
||||||
|
[1] = 'magnet_fishing',
|
||||||
|
|
||||||
|
},
|
||||||
|
Locations = {
|
||||||
|
vector4(-1512.7101, 1503.2269, 115.2890, 340.4643),
|
||||||
|
|
||||||
|
},
|
||||||
|
Interaction = {
|
||||||
|
targetIcon = 'fas fa-shopping-basket',
|
||||||
|
targetLabel = 'Mit John reden',
|
||||||
|
spawnPed = 'S_M_Y_WareTech_01', -- Put false if you dont need ped
|
||||||
|
scenario = 'WORLD_HUMAN_STAND_MOBILE', --Ped Scenario Animation put false if you dont need
|
||||||
|
radius = 2.5,
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
resources/[inventory]/cs_shops/ui/image/basic_magnet.png
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/bicycle.png
Normal file
After Width: | Height: | Size: 286 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/escooter.png
Normal file
After Width: | Height: | Size: 133 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/magnet_rope.png
Normal file
After Width: | Height: | Size: 217 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/neodymium_magnet.png
Normal file
After Width: | Height: | Size: 141 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/old_ammunition.png
Normal file
After Width: | Height: | Size: 138 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/rare_earth_magnet.png
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/safe.png
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
resources/[inventory]/cs_shops/ui/image/strong_magnet.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
resources/[inventory]/inventory_images/images/basic_magnet.png
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
resources/[inventory]/inventory_images/images/bicycle.png
Normal file
After Width: | Height: | Size: 286 KiB |
BIN
resources/[inventory]/inventory_images/images/escooter.png
Normal file
After Width: | Height: | Size: 133 KiB |
BIN
resources/[inventory]/inventory_images/images/magnet_rope.png
Normal file
After Width: | Height: | Size: 217 KiB |
After Width: | Height: | Size: 141 KiB |
BIN
resources/[inventory]/inventory_images/images/old_ammunition.png
Normal file
After Width: | Height: | Size: 138 KiB |
BIN
resources/[inventory]/inventory_images/images/old_coin.png
Normal file
After Width: | Height: | Size: 288 KiB |
BIN
resources/[inventory]/inventory_images/images/old_gun.png
Normal file
After Width: | Height: | Size: 170 KiB |
BIN
resources/[inventory]/inventory_images/images/old_knife.png
Normal file
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 93 KiB |
BIN
resources/[inventory]/inventory_images/images/safe.png
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
resources/[inventory]/inventory_images/images/strong_magnet.png
Normal file
After Width: | Height: | Size: 46 KiB |
|
@ -10214,16 +10214,150 @@ itemsData = {
|
||||||
image = 'food_bag.png',
|
image = 'food_bag.png',
|
||||||
name = 'food_bag',
|
name = 'food_bag',
|
||||||
},
|
},
|
||||||
keys = {
|
scrap_metal = {
|
||||||
shouldClose = true,
|
shouldClose = true,
|
||||||
type = 'item',
|
type = 'item',
|
||||||
description = '',
|
description = '',
|
||||||
weight = 2,
|
weight = 1000,
|
||||||
label = 'Motelschlüssel',
|
label = 'scrap_metal',
|
||||||
unique = true,
|
unique = true,
|
||||||
useable = true,
|
useable = true,
|
||||||
image = 'keys.png',
|
image = 'scrap_metal.png',
|
||||||
name = 'keys',
|
name = 'scrap_metal',
|
||||||
|
},
|
||||||
|
old_coin = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 400,
|
||||||
|
label = 'old_coin',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'old_coin.png',
|
||||||
|
name = 'old_coin',
|
||||||
|
},
|
||||||
|
rusty_knife = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 600,
|
||||||
|
label = 'rusty_knife',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'rusty_knife.png',
|
||||||
|
name = 'rusty_knife',
|
||||||
|
},
|
||||||
|
old_knife = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 600,
|
||||||
|
label = 'altes Messer',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'old_knife.png',
|
||||||
|
name = 'old_knife',
|
||||||
|
},
|
||||||
|
bicycle = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 4000,
|
||||||
|
label = 'rusty_knife',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'rusty_knife.png',
|
||||||
|
name = 'rusty_knife',
|
||||||
|
},
|
||||||
|
old_ammunition = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 200,
|
||||||
|
label = 'old_ammunition',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'old_ammunition.png',
|
||||||
|
name = 'old_ammunition',
|
||||||
|
},
|
||||||
|
old_gun = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 1000,
|
||||||
|
label = 'alte Pistole',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'old_gun.png',
|
||||||
|
name = 'old_gun',
|
||||||
|
},
|
||||||
|
escooter = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 10000,
|
||||||
|
label = 'E-Scooter',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'escooter.png',
|
||||||
|
name = 'escooter',
|
||||||
|
},
|
||||||
|
safe = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 20000,
|
||||||
|
label = 'Tresor',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'safe.png',
|
||||||
|
name = 'safe',
|
||||||
|
},
|
||||||
|
magnet_rope = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 800,
|
||||||
|
label = 'Magnetangel Seil',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'magnet_rope.png',
|
||||||
|
name = 'magnet_rope',
|
||||||
|
},
|
||||||
|
basic_magnet = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 1000,
|
||||||
|
label = 'Standard Magnet',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'basic_magnet.png',
|
||||||
|
name = 'basic_magnet',
|
||||||
|
},
|
||||||
|
strong_magnet = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 1000,
|
||||||
|
label = 'Starker Magnet',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'strong_magnet.png',
|
||||||
|
name = 'strong_magnet',
|
||||||
|
},
|
||||||
|
neodymium_magnet = {
|
||||||
|
shouldClose = true,
|
||||||
|
type = 'item',
|
||||||
|
description = '',
|
||||||
|
weight = 1500,
|
||||||
|
label = 'Neodymium Magnet',
|
||||||
|
unique = true,
|
||||||
|
useable = true,
|
||||||
|
image = 'neodymium_magnet.png',
|
||||||
|
name = 'neodymium_magnet',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
-----------------For support, scripts, and more----------------
|
-----------------For support, scripts, and more----------------
|
||||||
--------------- https://discord.gg/wasabiscripts -------------
|
--------------- https://discord.gg/wasabiscripts -------------
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
local fishing = false
|
local magnetFishing = false
|
||||||
|
|
||||||
if Config.sellShop.enabled then
|
if Config.sellShop.enabled then
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
|
@ -25,11 +25,11 @@ if Config.sellShop.enabled then
|
||||||
end
|
end
|
||||||
if self.currentDistance <= 1.8 then
|
if self.currentDistance <= 1.8 then
|
||||||
if not textUI then
|
if not textUI then
|
||||||
lib.showTextUI(Strings.sell_fish)
|
lib.showTextUI(Strings.sell_finds)
|
||||||
textUI = true
|
textUI = true
|
||||||
end
|
end
|
||||||
if IsControlJustReleased(0, 38) then
|
if IsControlJustReleased(0, 38) then
|
||||||
FishingSellItems()
|
MagnetSellItems()
|
||||||
end
|
end
|
||||||
elseif self.currentDistance >= 1.9 and textUI then
|
elseif self.currentDistance >= 1.9 and textUI then
|
||||||
lib.hideTextUI()
|
lib.hideTextUI()
|
||||||
|
@ -51,40 +51,40 @@ if Config.sellShop.enabled then
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to check for available baits and select the best one
|
-- Function to check for available magnets and select the best one
|
||||||
local function GetBestAvailableBait()
|
local function GetBestAvailableMagnet()
|
||||||
local availableBaits = {}
|
local availableMagnets = {}
|
||||||
|
|
||||||
-- Check all bait types
|
-- Check all magnet types
|
||||||
for _, bait in pairs(Config.bait.types) do
|
for _, magnet in pairs(Config.magnets.types) do
|
||||||
local hasItem = lib.callback.await('wasabi_fishing:checkItem', 100, bait.itemName)
|
local hasItem = lib.callback.await('wasabi_magnet:checkItem', 100, magnet.itemName)
|
||||||
if hasItem then
|
if hasItem then
|
||||||
table.insert(availableBaits, bait)
|
table.insert(availableMagnets, magnet)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if #availableBaits == 0 then
|
if #availableMagnets == 0 then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Sort baits by catch bonus (highest first)
|
-- Sort magnets by catch bonus (highest first)
|
||||||
table.sort(availableBaits, function(a, b)
|
table.sort(availableMagnets, function(a, b)
|
||||||
return (a.catchBonus or 0) > (b.catchBonus or 0)
|
return (a.catchBonus or 0) > (b.catchBonus or 0)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Return the best bait
|
-- Return the best magnet
|
||||||
return availableBaits[1]
|
return availableMagnets[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to handle the fishing process
|
-- Function to handle the magnet fishing process
|
||||||
local function StartFishingProcess(selectedBait, waterLoc)
|
local function StartMagnetFishingProcess(selectedMagnet, waterLoc)
|
||||||
fishing = true
|
magnetFishing = true
|
||||||
|
|
||||||
-- Create fishing rod prop
|
-- Create magnet rope prop
|
||||||
local model = `prop_fishing_rod_01`
|
local model = `prop_fishing_rod_01` -- Using fishing rod as placeholder, ideally would be replaced with a magnet rope model
|
||||||
lib.requestModel(model, 100)
|
lib.requestModel(model, 100)
|
||||||
local pole = CreateObject(model, GetEntityCoords(cache.ped), true, false, false)
|
local magnetRope = CreateObject(model, GetEntityCoords(cache.ped), true, false, false)
|
||||||
AttachEntityToEntity(pole, cache.ped, GetPedBoneIndex(cache.ped, 18905), 0.1, 0.05, 0, 80.0, 120.0, 160.0, true, true, false, true, 1, true)
|
AttachEntityToEntity(magnetRope, cache.ped, GetPedBoneIndex(cache.ped, 18905), 0.1, 0.05, 0, 80.0, 120.0, 160.0, true, true, false, true, 1, true)
|
||||||
SetModelAsNoLongerNeeded(model)
|
SetModelAsNoLongerNeeded(model)
|
||||||
|
|
||||||
-- Load animations
|
-- Load animations
|
||||||
|
@ -96,168 +96,126 @@ local function StartFishingProcess(selectedBait, waterLoc)
|
||||||
Wait(3000)
|
Wait(3000)
|
||||||
TaskPlayAnim(cache.ped, 'amb@world_human_stand_fishing@idle_a', 'idle_c', 1.0, -1.0, 1.0, 11, 0, 0, 0, 0)
|
TaskPlayAnim(cache.ped, 'amb@world_human_stand_fishing@idle_a', 'idle_c', 1.0, -1.0, 1.0, 11, 0, 0, 0, 0)
|
||||||
|
|
||||||
-- Main fishing loop
|
-- Main magnet fishing loop
|
||||||
while fishing do
|
while magnetFishing do
|
||||||
Wait(0)
|
Wait(0)
|
||||||
local unarmed = `WEAPON_UNARMED`
|
local unarmed = `WEAPON_UNARMED`
|
||||||
SetCurrentPedWeapon(cache.ped, unarmed)
|
SetCurrentPedWeapon(cache.ped, unarmed)
|
||||||
ShowHelp(Strings.intro_instruction)
|
ShowHelp(Strings.intro_instruction)
|
||||||
DisableControlAction(0, 24, true)
|
DisableControlAction(0, 24, true)
|
||||||
|
|
||||||
-- Cast line
|
-- Cast magnet
|
||||||
if IsDisabledControlJustReleased(0, 24) then
|
if IsDisabledControlJustReleased(0, 24) then
|
||||||
-- Casting animation
|
-- Casting animation
|
||||||
TaskPlayAnim(cache.ped, 'mini@tennis', 'forehand_ts_md_far', 1.0, -1.0, 1.0, 48, 0, 0, 0, 0)
|
TaskPlayAnim(cache.ped, 'mini@tennis', 'forehand_ts_md_far', 1.0, -1.0, 1.0, 48, 0, 0, 0, 0)
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.waiting_bite, Strings.waiting_bite_desc, 'inform')
|
TriggerEvent('wasabi_magnet:notify', Strings.waiting_find, Strings.waiting_find_desc, 'inform')
|
||||||
|
|
||||||
-- Wait for fish to bite
|
-- Wait for magnet to find something
|
||||||
local waitTime = math.random(Config.timeForBite.min, Config.timeForBite.max)
|
local waitTime = math.random(Config.timeForFind.min, Config.timeForFind.max)
|
||||||
Wait(waitTime)
|
Wait(waitTime)
|
||||||
|
|
||||||
-- Check if player is still fishing
|
-- Check if player is still magnet fishing
|
||||||
if not fishing then
|
if not magnetFishing then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.got_bite, Strings.got_bite_desc, 'inform')
|
TriggerEvent('wasabi_magnet:notify', Strings.got_pull, Strings.got_pull_desc, 'inform')
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
|
|
||||||
-- Get fish data based on selected bait
|
-- Get find data based on selected magnet
|
||||||
local fishData = lib.callback.await('wasabi_fishing:getFishData', 100, selectedBait.itemName)
|
local findData = lib.callback.await('wasabi_magnet:getFindData', 100, selectedMagnet.itemName)
|
||||||
|
|
||||||
-- Skill check to catch fish
|
-- Skill check to retrieve find
|
||||||
if lib.skillCheck(fishData.difficulty) then
|
if lib.skillCheck(findData.difficulty) then
|
||||||
ClearPedTasks(cache.ped)
|
ClearPedTasks(cache.ped)
|
||||||
TryFish(fishData)
|
TryMagnetFind(findData)
|
||||||
TaskPlayAnim(cache.ped, 'amb@world_human_stand_fishing@idle_a', 'idle_c', 1.0, -1.0, 1.0, 11, 0, 0, 0, 0)
|
TaskPlayAnim(cache.ped, 'amb@world_human_stand_fishing@idle_a', 'idle_c', 1.0, -1.0, 1.0, 11, 0, 0, 0, 0)
|
||||||
|
|
||||||
-- Check for bait loss
|
-- Check for magnet loss
|
||||||
local loseChance = math.random(1,100)
|
local loseChance = math.random(1,100)
|
||||||
if loseChance <= selectedBait.loseChance then
|
if loseChance <= selectedMagnet.loseChance then
|
||||||
TriggerServerEvent('wasabi_fishing:loseBait', selectedBait.itemName)
|
TriggerServerEvent('wasabi_magnet:loseMagnet', selectedMagnet.itemName)
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.bait_lost, Strings.bait_lost_desc, 'error')
|
TriggerEvent('wasabi_magnet:notify', Strings.magnet_lost, Strings.magnet_lost_desc, 'error')
|
||||||
|
|
||||||
-- Check if we still have this bait
|
-- Check if we still have this magnet
|
||||||
local hasBait = lib.callback.await('wasabi_fishing:checkItem', 100, selectedBait.itemName)
|
local hasMagnet = lib.callback.await('wasabi_magnet:checkItem', 100, selectedMagnet.itemName)
|
||||||
if not hasBait then
|
if not hasMagnet then
|
||||||
-- Try to get a new bait
|
-- Try to get a new magnet
|
||||||
local newBait = GetBestAvailableBait()
|
local newMagnet = GetBestAvailableMagnet()
|
||||||
if newBait then
|
if newMagnet then
|
||||||
selectedBait = newBait
|
selectedMagnet = newMagnet
|
||||||
TriggerEvent('wasabi_fishing:notify', 'New Bait', 'Using ' .. selectedBait.label .. ' as bait', 'inform')
|
TriggerEvent('wasabi_magnet:notify', 'New Magnet', 'Using ' .. selectedMagnet.label .. ' as magnet', 'inform')
|
||||||
else
|
else
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.no_bait, Strings.no_bait_desc, 'error')
|
TriggerEvent('wasabi_magnet:notify', Strings.no_magnet, Strings.no_magnet_desc, 'error')
|
||||||
fishing = false
|
magnetFishing = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Failed to catch fish
|
-- Failed to retrieve find
|
||||||
local breakChance = math.random(1,100)
|
local breakChance = math.random(1,100)
|
||||||
if breakChance < Config.fishingRod.breakChance then
|
if breakChance < Config.magnetRope.breakChance then
|
||||||
TriggerServerEvent('wasabi_fishing:rodBroke')
|
TriggerServerEvent('wasabi_magnet:ropeBroke')
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.rod_broke, Strings.rod_broke_desc, 'error')
|
TriggerEvent('wasabi_magnet:notify', Strings.rope_broke, Strings.rope_broke_desc, 'error')
|
||||||
ClearPedTasks(cache.ped)
|
ClearPedTasks(cache.ped)
|
||||||
fishing = false
|
magnetFishing = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.failed_fish, Strings.failed_fish_desc, 'error')
|
TriggerEvent('wasabi_magnet:notify', Strings.failed_find, Strings.failed_find_desc, 'error')
|
||||||
end
|
end
|
||||||
elseif IsControlJustReleased(0, 194) then
|
elseif IsControlJustReleased(0, 194) then
|
||||||
-- Cancel fishing with backspace
|
-- Cancel magnet fishing with backspace
|
||||||
ClearPedTasks(cache.ped)
|
ClearPedTasks(cache.ped)
|
||||||
TriggerEvent('wasabi_fishing:notify', 'Fishing Canceled', 'You stopped fishing', 'inform')
|
TriggerEvent('wasabi_magnet:notify', 'Magnet Fishing Canceled', 'You stopped magnet fishing', 'inform')
|
||||||
break
|
break
|
||||||
elseif #(GetEntityCoords(cache.ped) - waterLoc) > 30 then
|
elseif #(GetEntityCoords(cache.ped) - waterLoc) > 30 then
|
||||||
-- Too far from water
|
-- Too far from water
|
||||||
TriggerEvent('wasabi_fishing:notify', 'Too Far', 'You moved too far from the water', 'error')
|
TriggerEvent('wasabi_magnet:notify', 'Too Far', 'You moved too far from the water', 'error')
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Clean up
|
-- Clean up
|
||||||
fishing = false
|
magnetFishing = false
|
||||||
DeleteObject(pole)
|
DeleteObject(magnetRope)
|
||||||
RemoveAnimDict('mini@tennis')
|
RemoveAnimDict('mini@tennis')
|
||||||
RemoveAnimDict('amb@world_human_stand_fishing@idle_a')
|
RemoveAnimDict('amb@world_human_stand_fishing@idle_a')
|
||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent('wasabi_fishing:startFishing', function()
|
RegisterNetEvent('wasabi_magnet:startMagnetFishing', function()
|
||||||
-- Check if player is in a valid state to fish
|
-- Check if player is in a valid state to magnet fish
|
||||||
if IsPedInAnyVehicle(cache.ped) or IsPedSwimming(cache.ped) then
|
if IsPedInAnyVehicle(cache.ped) or IsPedSwimming(cache.ped) then
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.cannot_perform, Strings.cannot_perform_desc, 'error')
|
TriggerEvent('wasabi_magnet:notify', Strings.cannot_perform, Strings.cannot_perform_desc, 'error')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if already fishing
|
-- Check if already magnet fishing
|
||||||
if fishing then
|
if magnetFishing then
|
||||||
TriggerEvent('wasabi_fishing:notify', 'Already Fishing', 'You are already fishing', 'error')
|
TriggerEvent('wasabi_magnet:notify', 'Already Magnet Fishing', 'You are already magnet fishing', 'error')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for water
|
-- Check for water
|
||||||
local water, waterLoc = WaterCheck()
|
local water, waterLoc = WaterCheck()
|
||||||
if not water then
|
if not water then
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.no_water, Strings.no_water_desc, 'error')
|
TriggerEvent('wasabi_magnet:notify', Strings.no_water, Strings.no_water_desc, 'error')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Select bait
|
-- Select magnet
|
||||||
local selectedBait = GetBestAvailableBait()
|
local selectedMagnet = GetBestAvailableMagnet()
|
||||||
if not selectedBait then
|
if not selectedMagnet then
|
||||||
TriggerEvent('wasabi_fishing:notify', Strings.no_bait, Strings.no_bait_desc, 'error')
|
TriggerEvent('wasabi_magnet:notify', Strings.no_magnet, Strings.no_magnet_desc, 'error')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Start fishing process
|
-- Start magnet fishing process
|
||||||
TriggerEvent('wasabi_fishing:notify', 'Bait Selected', 'Using ' .. selectedBait.label .. ' as bait', 'inform')
|
TriggerEvent('wasabi_magnet:notify', 'Magnet Selected', 'Using ' .. selectedMagnet.label, 'inform')
|
||||||
StartFishingProcess(selectedBait, waterLoc)
|
StartMagnetFishingProcess(selectedMagnet, waterLoc)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Process fish with knife
|
RegisterNetEvent('wasabi_magnet:interupt', function()
|
||||||
RegisterNetEvent('wasabi_fishing:processFish', function(fishItem)
|
magnetFishing = false
|
||||||
-- Check if player has knife
|
|
||||||
local hasKnife = lib.callback.await('wasabi_fishing:checkItem', 100, Config.processing.knifeItem)
|
|
||||||
if not hasKnife then
|
|
||||||
TriggerEvent('wasabi_fishing:notify', 'No Knife', 'You need a knife to process fish', 'error')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Start processing animation
|
|
||||||
local playerPed = cache.ped
|
|
||||||
|
|
||||||
lib.requestAnimDict('anim@amb@business@coc@coc_unpack_cut@', 100)
|
|
||||||
TaskPlayAnim(playerPed, 'anim@amb@business@coc@coc_unpack_cut@', 'fullcut_cycle_v6_cokecutter', 8.0, -8.0, -1, 1, 0, false, false, false)
|
|
||||||
|
|
||||||
-- Processing progress bar
|
|
||||||
if lib.progressBar({
|
|
||||||
duration = 5000,
|
|
||||||
label = 'Processing Fish',
|
|
||||||
useWhileDead = false,
|
|
||||||
canCancel = true,
|
|
||||||
disable = {
|
|
||||||
car = true,
|
|
||||||
move = true,
|
|
||||||
combat = true
|
|
||||||
},
|
|
||||||
anim = {
|
|
||||||
dict = 'anim@amb@business@coc@coc_unpack_cut@',
|
|
||||||
clip = 'fullcut_cycle_v6_cokecutter'
|
|
||||||
},
|
|
||||||
}) then
|
|
||||||
-- Success - server handles the actual item processing
|
|
||||||
TriggerServerEvent('wasabi_fishing:processItem', fishItem)
|
|
||||||
else
|
|
||||||
-- Cancelled
|
|
||||||
TriggerEvent('wasabi_fishing:notify', 'Canceled', 'Fish processing canceled', 'error')
|
|
||||||
end
|
|
||||||
|
|
||||||
ClearPedTasks(playerPed)
|
|
||||||
RemoveAnimDict('anim@amb@business@coc@coc_unpack_cut@')
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterNetEvent('wasabi_fishing:interupt', function()
|
|
||||||
fishing = false
|
|
||||||
ClearPedTasks(cache.ped)
|
ClearPedTasks(cache.ped)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -27,10 +27,10 @@ CreateBlip = function(coords, sprite, colour, text, scale)
|
||||||
return blip
|
return blip
|
||||||
end
|
end
|
||||||
|
|
||||||
TryFish = function(data)
|
TryMagnetFind = function(data)
|
||||||
TriggerServerEvent('wasabi_fishing:tryFish', data)
|
TriggerServerEvent('wasabi_magnet:tryFind', data)
|
||||||
end
|
end
|
||||||
|
|
||||||
FishingSellItems = function()
|
MagnetSellItems = function()
|
||||||
TriggerServerEvent('wasabi_fishing:sellFish')
|
TriggerServerEvent('wasabi_magnet:sellFinds')
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,13 +19,13 @@ Config.magnets = {
|
||||||
types = {
|
types = {
|
||||||
{
|
{
|
||||||
itemName = 'basic_magnet',
|
itemName = 'basic_magnet',
|
||||||
label = 'Basic Magnet',
|
label = 'Standard Magnet',
|
||||||
loseChance = 25,
|
loseChance = 25,
|
||||||
catchBonus = 0 -- base chance
|
catchBonus = 0 -- base chance
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
itemName = 'strong_magnet',
|
itemName = 'strong_magnet',
|
||||||
label = 'Strong Magnet',
|
label = 'Starker Magnet',
|
||||||
loseChance = 15,
|
loseChance = 15,
|
||||||
catchBonus = 15 -- 15% better catch chance
|
catchBonus = 15 -- 15% better catch chance
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@ Config.magnets = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
itemName = 'rare_earth_magnet',
|
itemName = 'rare_earth_magnet',
|
||||||
label = 'Rare Earth Magnet',
|
label = 'Großer Neodymium Magnet',
|
||||||
loseChance = 5, -- very hard to lose
|
loseChance = 5, -- very hard to lose
|
||||||
catchBonus = 35, -- 35% better catch chance
|
catchBonus = 35, -- 35% better catch chance
|
||||||
exclusive = {'treasure'} -- can only catch treasure with this
|
exclusive = {'treasure'} -- can only catch treasure with this
|
||||||
|
@ -57,13 +57,14 @@ Config.timeForFind = { -- Set min and max random range of time it takes for some
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.finds = {
|
Config.finds = {
|
||||||
{ item = 'scrap_metal', label = 'Scrap Metal', price = {50, 100}, difficulty = {'easy'} },
|
{ item = 'scrap_metal', label = 'Altmetall', price = {50, 100}, difficulty = {'easy'} },
|
||||||
{ item = 'old_coin', label = 'Old Coin', price = {100, 200}, difficulty = {'easy', 'easy'} },
|
{ item = 'old_coin', label = 'alte Münze', price = {100, 200}, difficulty = {'easy', 'easy'} },
|
||||||
{ item = 'rusty_knife', label = 'Rusty Knife', price = {150, 250}, difficulty = {'medium', 'easy'} },
|
{ item = 'rusty_knife', label = 'altes Messer', price = {150, 250}, difficulty = {'medium', 'easy'} },
|
||||||
{ item = 'bicycle_parts', label = 'Bicycle Parts', price = {200, 300}, difficulty = {'medium'} },
|
{ item = 'bicycle', label = 'Fahrrad', price = {200, 300}, difficulty = {'medium'} },
|
||||||
{ item = 'metal_debris', label = 'Metal Debris', price = {75, 150}, difficulty = {'easy'} },
|
{ item = 'old_ammunition', label = 'alte Munition', price = {75, 150}, difficulty = {'easy'} },
|
||||||
{ item = 'antique_item', label = 'Antique Item', price = {300, 600}, difficulty = {'medium', 'hard'} },
|
{ item = 'old_gun', label = 'alte Pistole', price = {75, 150}, difficulty = {'easy'} },
|
||||||
{ item = 'safe', label = 'Safe', price = {500, 1000}, difficulty = {'hard', 'hard', 'medium'} },
|
{ item = 'escooter', label = 'E-Scooter', price = {300, 600}, difficulty = {'medium', 'hard'} },
|
||||||
|
{ item = 'safe', label = 'Tresor', price = {500, 1000}, difficulty = {'hard', 'hard', 'medium'} },
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,36 +2,30 @@
|
||||||
--------------- https://discord.gg/wasabiscripts -------------
|
--------------- https://discord.gg/wasabiscripts -------------
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
Strings = {
|
Strings = {
|
||||||
intro_instruction = 'Drücke ~INPUT_ATTACK~ zu auswerfen, ~INPUT_FRONTEND_RRIGHT~ um abzubrechen.',
|
intro_instruction = 'Drücke ~INPUT_ATTACK~ zum Auswerfen, ~INPUT_FRONTEND_RRIGHT~ zum Abbrechen.',
|
||||||
rod_broke = 'Kaputt.',
|
rope_broke = 'Kaputt.',
|
||||||
rod_broke_desc = 'Oha, zu fest gezogen! Die Angel ist kaputt.',
|
rope_broke_desc = 'Oha, zu fest gezogen! Das Seil ist gerissen.',
|
||||||
cannot_perform = 'Nope.',
|
cannot_perform = 'Nope.',
|
||||||
cannot_perform_desc = 'Das geht gerade nicht – der Fisch macht Pause.',
|
cannot_perform_desc = 'Das geht gerade nicht – hier kannst du nicht magnet-fischen.',
|
||||||
failed = 'Oops, das war nix.',
|
failed = 'Oops, das war nix.',
|
||||||
failed_fish = 'Nix gefangen – der Fisch war schneller.',
|
failed_find = 'Nichts gefunden – der Magnet hat nichts angezogen.',
|
||||||
no_water = 'Error 404: Wasser nicht gefunden.',
|
no_water = 'Error 404: Wasser nicht gefunden.',
|
||||||
no_water_desc = 'Deine Angel verheddert sich im trockenen Gras. Bravo.',
|
no_water_desc = 'Dein Magnet braucht Wasser, um effektiv zu sein.',
|
||||||
no_bait = 'Kein Köder.',
|
no_magnet = 'Kein Magnet.',
|
||||||
no_bait_desc = 'Ohne Köder bist du nur ein sehr geduldiger Spaziergänger am Wasser.',
|
no_magnet_desc = 'Ohne Magnet kannst du nichts anziehen.',
|
||||||
bait_lost = 'Köder abgehauen.',
|
magnet_lost = 'Magnet verloren.',
|
||||||
bait_lost_desc = 'Der Köder hat sich selbstständig gemacht..',
|
magnet_lost_desc = 'Dein Magnet hat sich vom Seil gelöst.',
|
||||||
fish_success = 'Fisch im Kasten – das Abendessen ist gesichert.',
|
find_success = 'Fund gesichert!',
|
||||||
fish_success_desc = 'Du hast eine/n %s!',
|
find_success_desc = 'Du hast eine/n %s gefunden!',
|
||||||
sell_shop_blip = 'Fish Market',
|
sell_shop_blip = 'Schrotthändler',
|
||||||
sell_fish = '[E] - Fisch verkaufen',
|
sell_finds = '[E] - Funde verkaufen',
|
||||||
kicked = 'Du kannst’s versuchen, aber das klappt hier nicht.',
|
kicked = 'Du kannst's versuchen, aber das klappt hier nicht.',
|
||||||
sold_for = 'Fisch verkauft.',
|
sold_for = 'Fund verkauft.',
|
||||||
sold_for_desc = 'Du hast %sx %s für $%s verkauft.',
|
sold_for_desc = 'Du hast %sx %s für $%s verkauft.',
|
||||||
got_bite = 'Achtung, da zappelt was!',
|
got_pull = 'Achtung, da zieht was!',
|
||||||
got_bite_desc = 'Der Fisch ist am Haken, gleich wird’s sportlich!',
|
got_pull_desc = 'Der Magnet hat etwas gefunden, zieh ihn hoch!',
|
||||||
waiting_bite = 'Geduld, der Fisch überlegt noch.',
|
waiting_find = 'Geduld, der Magnet sucht noch.',
|
||||||
waiting_bite_desc = 'Ein bisschen Geduld – der Fisch ist gleich da.',
|
waiting_find_desc = 'Ein bisschen Geduld – gleich findest du etwas.',
|
||||||
cannot_carry = 'Kein Platz!',
|
cannot_carry = 'Kein Platz!',
|
||||||
cannot_carry_desc = 'Du schleppst schon genug – mehr passt nicht rein!',
|
cannot_carry_desc = 'Du schleppst schon genug – mehr passt nicht rein!'
|
||||||
no_knife = 'Kein Messer',
|
|
||||||
no_knife_desc = 'Ohne Messer ist der Fisch nur Deko.',
|
|
||||||
processing_success = 'Fang verarbeitet – nächster Schritt: Grill an!',
|
|
||||||
processing_success_desc = '%d %s – frisch aus der Fischverarbeitung!',
|
|
||||||
caviar_found = 'Kaviar entdeckt – Fisch deluxe!',
|
|
||||||
caviar_found_desc = 'Wow, wertvoller Kaviar im Fisch – das hat sich gelohnt!'
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ local addCommas = function(n)
|
||||||
:gsub(",(%-?)$","%1"):reverse()
|
:gsub(",(%-?)$","%1"):reverse()
|
||||||
end
|
end
|
||||||
|
|
||||||
lib.callback.register('wasabi_fishing:checkItem', function(source, itemname)
|
lib.callback.register('wasabi_magnet:checkItem', function(source, itemname)
|
||||||
local item = HasItem(source, itemname)
|
local item = HasItem(source, itemname)
|
||||||
if item >= 1 then
|
if item >= 1 then
|
||||||
return true
|
return true
|
||||||
|
@ -15,46 +15,46 @@ lib.callback.register('wasabi_fishing:checkItem', function(source, itemname)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
lib.callback.register('wasabi_fishing:getFishData', function(source, baitType)
|
lib.callback.register('wasabi_magnet:getFindData', function(source, magnetType)
|
||||||
-- Find the bait data
|
-- Find the magnet data
|
||||||
local baitData = nil
|
local magnetData = nil
|
||||||
for _, bait in pairs(Config.bait.types) do
|
for _, magnet in pairs(Config.magnets.types) do
|
||||||
if bait.itemName == baitType then
|
if magnet.itemName == magnetType then
|
||||||
baitData = bait
|
magnetData = magnet
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not baitData then
|
if not magnetData then
|
||||||
-- Use default bait data if the provided bait type is not found
|
-- Use default magnet data if the provided magnet type is not found
|
||||||
for _, bait in pairs(Config.bait.types) do
|
for _, magnet in pairs(Config.magnets.types) do
|
||||||
if bait.itemName == Config.bait.defaultBait then
|
if magnet.itemName == Config.magnets.defaultMagnet then
|
||||||
baitData = bait
|
magnetData = magnet
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If using illegal bait, only catch pufferfish
|
-- If using exclusive magnet, only find specific items
|
||||||
if baitData.exclusive then
|
if magnetData.exclusive then
|
||||||
for _, fishType in pairs(baitData.exclusive) do
|
for _, findType in pairs(magnetData.exclusive) do
|
||||||
for _, fish in pairs(Config.fish) do
|
for _, find in pairs(Config.finds) do
|
||||||
if fish.item == fishType then
|
if find.item == findType then
|
||||||
return fish
|
return find
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Otherwise, random fish with catch bonus
|
-- Otherwise, random find with catch bonus
|
||||||
local availableFish = {}
|
local availableFinds = {}
|
||||||
for _, fish in pairs(Config.fish) do
|
for _, find in pairs(Config.finds) do
|
||||||
-- Don't include exclusive fish types unless using the right bait
|
-- Don't include exclusive find types unless using the right magnet
|
||||||
local isExclusive = false
|
local isExclusive = false
|
||||||
for _, bait in pairs(Config.bait.types) do
|
for _, magnet in pairs(Config.magnets.types) do
|
||||||
if bait.exclusive then
|
if magnet.exclusive then
|
||||||
for _, exclusiveFish in pairs(bait.exclusive) do
|
for _, exclusiveFind in pairs(magnet.exclusive) do
|
||||||
if fish.item == exclusiveFish then
|
if find.item == exclusiveFind then
|
||||||
isExclusive = true
|
isExclusive = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -64,127 +64,57 @@ lib.callback.register('wasabi_fishing:getFishData', function(source, baitType)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not isExclusive then
|
if not isExclusive then
|
||||||
table.insert(availableFish, fish)
|
table.insert(availableFinds, find)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Apply catch bonus logic here if needed
|
-- Apply catch bonus logic here if needed
|
||||||
return availableFish[math.random(#availableFish)]
|
return availableFinds[math.random(#availableFinds)]
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('wasabi_fishing:rodBroke', function()
|
RegisterNetEvent('wasabi_magnet:ropeBroke', function()
|
||||||
RemoveItem(source, Config.fishingRod.itemName, 1)
|
RemoveItem(source, Config.magnetRope.itemName, 1)
|
||||||
TriggerClientEvent('wasabi_fishing:interupt', source)
|
TriggerClientEvent('wasabi_magnet:interupt', source)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('wasabi_fishing:loseBait', function(baitType)
|
RegisterNetEvent('wasabi_magnet:loseMagnet', function(magnetType)
|
||||||
RemoveItem(source, baitType, 1)
|
RemoveItem(source, magnetType, 1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('wasabi_fishing:tryFish', function(data)
|
RegisterNetEvent('wasabi_magnet:tryFind', function(data)
|
||||||
local xPole = HasItem(source, Config.fishingRod.itemName)
|
local xRope = HasItem(source, Config.magnetRope.itemName)
|
||||||
local xBait = false
|
local xMagnet = false
|
||||||
|
|
||||||
-- Check if player has any type of bait
|
-- Check if player has any type of magnet
|
||||||
for _, bait in pairs(Config.bait.types) do
|
for _, magnet in pairs(Config.magnets.types) do
|
||||||
if HasItem(source, bait.itemName) > 0 then
|
if HasItem(source, magnet.itemName) > 0 then
|
||||||
xBait = true
|
xMagnet = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if xPole > 0 and xBait then
|
if xRope > 0 and xMagnet then
|
||||||
if Framework == 'esx' and not Config.oldESX then
|
if Framework == 'esx' and not Config.oldESX then
|
||||||
local player = GetPlayer(source)
|
local player = GetPlayer(source)
|
||||||
if player.canCarryItem(data.item, 1) then
|
if player.canCarryItem(data.item, 1) then
|
||||||
AddItem(source, data.item, 1)
|
AddItem(source, data.item, 1)
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, Strings.fish_success, string.format(Strings.fish_success_desc, data.label), 'success')
|
TriggerClientEvent('wasabi_magnet:notify', source, Strings.find_success, string.format(Strings.find_success_desc, data.label), 'success')
|
||||||
else
|
else
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, Strings.cannot_carry, Strings.cannot_carry_desc, 'error')
|
TriggerClientEvent('wasabi_magnet:notify', source, Strings.cannot_carry, Strings.cannot_carry_desc, 'error')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
AddItem(source, data.item, 1)
|
AddItem(source, data.item, 1)
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, Strings.fish_success, string.format(Strings.fish_success_desc, data.label), 'success')
|
TriggerClientEvent('wasabi_magnet:notify', source, Strings.find_success, string.format(Strings.find_success_desc, data.label), 'success')
|
||||||
end
|
end
|
||||||
elseif xPole > 0 and not xBait then
|
elseif xRope > 0 and not xMagnet then
|
||||||
TriggerClientEvent('wasabi_fishing:interupt', source)
|
TriggerClientEvent('wasabi_magnet:interupt', source)
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, Strings.no_bait, Strings.no_bait_desc, 'error')
|
TriggerClientEvent('wasabi_magnet:notify', source, Strings.no_magnet, Strings.no_magnet_desc, 'error')
|
||||||
elseif xPole < 1 then
|
elseif xRope < 1 then
|
||||||
KickPlayer(source, Strings.kicked)
|
KickPlayer(source, Strings.kicked)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('wasabi_fishing:processItem', function(fishItem)
|
RegisterNetEvent('wasabi_magnet:sellFinds', function()
|
||||||
-- Find processing data for this fish
|
|
||||||
local processData = nil
|
|
||||||
for _, data in pairs(Config.processing.products) do
|
|
||||||
if data.sourceItem == fishItem then
|
|
||||||
processData = data
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not processData then
|
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, 'Cannot Process', 'This fish cannot be processed', 'error')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if player has the fish and knife
|
|
||||||
local hasFish = HasItem(source, fishItem)
|
|
||||||
local hasKnife = HasItem(source, Config.processing.knifeItem)
|
|
||||||
|
|
||||||
if hasFish < 1 or hasKnife < 1 then
|
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, 'Missing Items', 'You need both the fish and a knife', 'error')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove the fish
|
|
||||||
RemoveItem(source, fishItem, 1)
|
|
||||||
|
|
||||||
-- Add fish fillets
|
|
||||||
local filletYield = processData.yield[1]
|
|
||||||
local filletAmount = math.random(filletYield.amount[1], filletYield.amount[2])
|
|
||||||
|
|
||||||
if Framework == 'esx' and not Config.oldESX then
|
|
||||||
local player = GetPlayer(source)
|
|
||||||
if player.canCarryItem(filletYield.item, filletAmount) then
|
|
||||||
AddItem(source, filletYield.item, filletAmount)
|
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, 'Processing Success',
|
|
||||||
'You obtained ' .. filletAmount .. ' fish fillets', 'success')
|
|
||||||
else
|
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, Strings.cannot_carry, Strings.cannot_carry_desc, 'error')
|
|
||||||
-- Give back the fish if they can't carry the fillets
|
|
||||||
AddItem(source, fishItem, 1)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
else
|
|
||||||
AddItem(source, filletYield.item, filletAmount)
|
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, 'Processing Success',
|
|
||||||
'You obtained ' .. filletAmount .. ' fish fillets', 'success')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check for caviar
|
|
||||||
for i=2, #processData.yield do
|
|
||||||
local extraYield = processData.yield[i]
|
|
||||||
if extraYield.item == 'caviar' and extraYield.chance then
|
|
||||||
local chance = math.random(1, 100)
|
|
||||||
if chance <= extraYield.chance then
|
|
||||||
if Framework == 'esx' and not Config.oldESX then
|
|
||||||
local player = GetPlayer(source)
|
|
||||||
if player.canCarryItem(extraYield.item, 1) then
|
|
||||||
AddItem(source, extraYield.item, 1)
|
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, 'Caviar Found', 'You found some valuable caviar!', 'success')
|
|
||||||
end
|
|
||||||
else
|
|
||||||
AddItem(source, extraYield.item, 1)
|
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, 'Caviar Found', 'You found some valuable caviar!', 'success')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterNetEvent('wasabi_fishing:sellFish', function()
|
|
||||||
local playerPed = GetPlayerPed(source)
|
local playerPed = GetPlayerPed(source)
|
||||||
local playerCoord = GetEntityCoords(playerPed)
|
local playerCoord = GetEntityCoords(playerPed)
|
||||||
local distance = #(playerCoord - Config.sellShop.coords)
|
local distance = #(playerCoord - Config.sellShop.coords)
|
||||||
|
@ -197,14 +127,9 @@ RegisterNetEvent('wasabi_fishing:sellFish', function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Sell fish
|
-- Sell finds
|
||||||
for i=1, #Config.fish do
|
for i=1, #Config.finds do
|
||||||
SellItem(source, Config.fish[i])
|
SellItem(source, Config.finds[i])
|
||||||
end
|
|
||||||
|
|
||||||
-- Sell processed items
|
|
||||||
for i=1, #Config.processedItems do
|
|
||||||
SellItem(source, Config.processedItems[i])
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -217,20 +142,13 @@ function SellItem(source, itemData)
|
||||||
end
|
end
|
||||||
if rewardAmount > 0 then
|
if rewardAmount > 0 then
|
||||||
AddMoney(source, 'money', rewardAmount)
|
AddMoney(source, 'money', rewardAmount)
|
||||||
TriggerClientEvent('wasabi_fishing:notify', source, Strings.sold_for,
|
TriggerClientEvent('wasabi_magnet:notify', source, Strings.sold_for,
|
||||||
(Strings.sold_for_desc):format(HasItem(source, itemData.item), itemData.label, addCommas(rewardAmount)), 'success')
|
(Strings.sold_for_desc):format(HasItem(source, itemData.item), itemData.label, addCommas(rewardAmount)), 'success')
|
||||||
RemoveItem(source, itemData.item, HasItem(source, itemData.item))
|
RemoveItem(source, itemData.item, HasItem(source, itemData.item))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register usable items for all fish types for processing
|
RegisterUsableItem(Config.magnetRope.itemName, function(source)
|
||||||
for _, fish in pairs(Config.fish) do
|
TriggerClientEvent('wasabi_magnet:startMagnetFishing', source)
|
||||||
RegisterUsableItem(fish.item, function(source)
|
|
||||||
TriggerClientEvent('wasabi_fishing:processFish', source, fish.item)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
RegisterUsableItem(Config.fishingRod.itemName, function(source)
|
|
||||||
TriggerClientEvent('wasabi_fishing:startFishing', source)
|
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
|
|
||||||
local curVersion = GetResourceMetadata(GetCurrentResourceName(), "version")
|
local curVersion = GetResourceMetadata(GetCurrentResourceName(), "version")
|
||||||
local resourceName = "wasabi_fishing"
|
local resourceName = "wasabi_magnet"
|
||||||
|
|
||||||
if Config.checkForUpdates then
|
if Config.checkForUpdates then
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
if GetCurrentResourceName() ~= "wasabi_fishing" then
|
if GetCurrentResourceName() ~= "wasabi_magnet" then
|
||||||
resourceName = "wasabi_fishing (" .. GetCurrentResourceName() .. ")"
|
resourceName = "wasabi_magnet (" .. GetCurrentResourceName() .. ")"
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -60,4 +60,4 @@ if Config.checkForUpdates then
|
||||||
|
|
||||||
return repoVersion, repoURL, repoBody
|
return repoVersion, repoURL, repoBody
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|