Hello I search to change a value in mysql table with a lua file, but it doesn’t work, someone can help me please ?
my code:
AddEventHandler("playerSpawned", function(spawn)
TriggerEvent('es:getPlayerFromId', source, function(user)
local veh_id = veh_id
local player = user.identifier
local executed_query = MySQL:executeQuery("SELECT * FROM user_vehicle WHERE identifier = '@username' AND ID = '@ID'",{['@username'] = player, ['@ID'] = veh_id})
local result = MySQL:getResults(executed_query, {'vehicle_model', 'vehicle_plate', 'vehicle_state', 'vehicle_colorprimary', 'vehicle_colorsecondary', 'vehicle_pearlescentcolor', 'vehicle_wheelcolor' }, "identifier")
if(result)then
local executed_query = MySQL:executeQuery("UPDATE user_vehicle SET vehicle_state='Rentré' WHERE identifier='@username'",{['@username'] = player, ['@ID'] = veh_id})
end
--Notification
Citizen.CreateThread(function()
while true do
Wait(0)
SetNotificationTextEntry("STRING");
AddTextComponentString("Bienvenue sur ~b~Identity Roleplay!");
SetNotificationMessage("CHAR_ALL_PLAYERS_CONF", "CHAR_ALL_PLAYERS_CONF", true, 1, "Identity roleplay", "v0.2");
DrawNotification(false, true);
Wait(10000000)
end
end)
end)
I search to change the value in vehicle_state to ‘Rentré’ automatically, but I’m not good in lua so, I don’t understand my error