This is what I have:
TriggerServerEvent("apart:lockAppart", interiors[i].name, 1)
then server I have this
RegisterServerEvent("apart:lockAppart")
AddEventHandler('apart:lockAppart', function(name, status, apart)
local source = source
TriggerEvent('es:getPlayerFromId', source, function(user)
local player = user.getIdentifier()
local name = name
local status = status
local locked = 1
local unlocked = 0
MySQL.Async.fetchAll("SELECT * FROM user_appartement WHERE name = @nom", {['@nom'] = tostring(name)}, function (result)
if (result) then
locked = result[1].locked
if locked == 1 then
MySQL.Sync.execute("UPDATE user_appartement SET locked=@status WHERE name = @nom",{['@nom'] = player, ['@status'] = unlocked})
else
MySQL.Sync.execute("UPDATE user_appartement SET locked=@status WHERE name = @nom",{['@nom'] = player, ['@status'] = locked})
end
end
end)
end)
I am brand new to this but I am trying to get it to return the value of locked in the sql and then set it to either 0 or 1.