[Release] [ESX] loffe_fishing

Hello. sells fish and does not get money. where should I set it?

1 Like

i kinda want to know the same thing ive been messing around with the code to no avail

Hi fella this is a great script but i have one error when i sell fish please help all my player love this in RP

Error running system event handling function for resource loffe_fishing: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: @loffe_fishing/server/server.lua:50: bad argument #1 to ‘random’ (number expected, got nil)
stack traceback:
[C]: in function ‘math.random’
@loffe_fishing/server/server.lua:50: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:219: in function citizen:/scripting/lua/scheduler.lua:218
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:218: in function citizen:/scripting/lua/scheduler.lua:182

1 Like

SQL needs to be updated to:

INSERT INTO `items` (name, label, `limit`) VALUES
	('lfish', 'Fish', -1),
	('lrod', 'Fishing rod', 1),
	('lbait', 'Fishing bait', -1),
	('lUbait', 'Ultra Fishing Bait', -1),
	('lEbait', 'Extreme Fishing Bait', -1)
	
;

it has a , after (‘lEbait’, ‘Extreme Fishing Bait’, -1)

1 Like

On line 50 in server/main.lua there is a code with math.random. For some reason in the math.random there is a Config.SellPrice which doesn’t exist in the Config. Either you add Config.SellPrice = 10,50 in the config or you have to replace Config.SellPrice with 10,50 in the math.random!

Hi fella thank you for taking the time to help but i replace it i think i did it right but still givees an error could you see if i place it right

RegisterServerEvent(‘loffe_fishing:sell’)
AddEventHandler(‘loffe_fishing:sell’, function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local itemAmount = xPlayer.getInventoryItem(‘lfish’).count
if itemAmount > 0 then
xPlayer.removeInventoryItem(‘lfish’, itemAmount)
local price = itemAmount*math.random(Config.SellPrice = 10,50)
xPlayer.addMoney(price)
TriggerClientEvent(‘loffe_fishing:notify’, _source, _U(‘sold’) … price … ‘:-’)
end
end)

RegisterServerEvent(‘loffe_fishing:sell’)
AddEventHandler(‘loffe_fishing:sell’, function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local itemAmount = xPlayer.getInventoryItem(‘lfish’).count
if itemAmount ~= 0 then
xPlayer.removeInventoryItem(‘lfish’, itemAmount)
local price = itemAmount*math.random(10,50)
xPlayer.addMoney(price)
TriggerClientEvent(‘loffe_fishing:notify’, _source, _U(‘sold’) … price … ‘:-’)
end
end)

screenshots dude …

Thank you so much LifeGoal you are the best it works great no more errors thank you again P.s its people like you that makes not no skild in lua carry on in learning and creating cool servers with greatr scripts that you all made thank you

1 Like

its saying not not enough excessories and cant fish but I have have a rod, bait and ultra bait any one else having problems with it

great script but says “Locale [sv] does not exist” at the fishing spot and store and sell spot

Not explaining what the script does ? No video no pics how lazy. Can you give us some information not just fishing script? Like commands etc? That would avoid unnecessary questions.thanks

code one yourself then if its so lazy…

ty i was lf this