Getting an error parsing > @esx_AdvancedFishing/server.lua:7: ')' expected near ','

323 Views Asked by At

Pretty new to lua, and not sure what the issue is... Any ideas?

Error in question

The lua code:

ESX.RegisterUsableItem('turtlebait', function(source)
    local xPlayer = ESX.GetPlayerFromId(source)
    if xPlayer.getInventoryItem('fishingrod').count > 0 then
        TriggerClientEvent('fishing:setbait', (source, "turtle")
        xPlayer.removeInventoryItem('turtlebait', 1)
        TriggerClientEvent('fishing:message', (source, "You attach the ~y~turtle bait~s~ onto your fishing rod")
    else
        TriggerClientEvent('fishing:message', (source, "~r~You don't have a fishing rod")
    end
end)

Line 7: TriggerClientEvent('fishing:setbait', (source, "turtle")

1

There are 1 best solutions below

2
Vinni Marcon On

you need to close all TriggerClientEvent functions

ESX.RegisterUsableItem('turtlebait', function(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer.getInventoryItem('fishingrod').count > 0 then
    TriggerClientEvent('fishing:setbait', (source, "turtle"))
    xPlayer.removeInventoryItem('turtlebait', 1)
    TriggerClientEvent('fishing:message', (source, "You attach the ~y~turtle bait~s~ onto your fishing rod"))
else
    TriggerClientEvent('fishing:message', (source, "~r~You don't have a fishing rod"))
end