I been stuck trying to get this to work by looking at how other people work client / server but I can’t seem to do it right. This is what I have from client:
After a bunch of stuff is done (randomly picking a fish from table, spawning it, etc… at the end I have this (just to try to save the caught fish to db)
TriggerServerEvent('FishToInv', name, price, status)
on my server
RegisterServerEvent('FishToInv')
AddEventHandler('FishToInv', function(name, price, status)
TriggerEvent('es:getPlayerFromId', source, function(user)
local player = user.identifier
local name = name
local price = price
local status = status
local executed_query = MySQL:executeQuery("INSERT INTO user_fish (`identifier`, `fish_name`, `fish_price`, `fish_status`) VALUES ('@username', '@name', '@price', '@status')",
{['@username'] = player, ['@name'] = name, ['@price'] = price, ['@status'] = status})
end)
end)
All I want it to do is just store it the db… nothing complicated I want to focus on this first then I can worry about inventory limit and all that can someone please help me out? what I am doing wrong?
Error: ScriptEnvironment::TriggerEvent: Error executing event handler for event es:getPlayerFromID in resource essentialmode: exception has been thrown by the target of an invocation