forked from DeffoN0tSt3/ESX-QBCore-Convert-Functions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetchStatus.lua
More file actions
47 lines (38 loc) · 1.05 KB
/
fetchStatus.lua
File metadata and controls
47 lines (38 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
ESX.RegisterServerCallback("system:fetchStatus", function(source, cb)
local src = source
local user = ESX.GetPlayerFromId(src)
local fetch = [[
SELECT
skills
FROM
users
WHERE
identifier = @identifier
]]
MySQL.Async.fetchScalar(fetch, {
["@identifier"] = user.identifier
}, function(status)
if status ~= nil then
cb(json.decode(status))
else
cb(nil)
end
end)
end)
-->
QBCore.Functions.CreateCallback('system:fetchStatus', function(source, cb)
local Player = QBCore.Functions.GetPlayer(source)
if Player then
exports['ghmattimysql']:execute('SELECT skills FROM players WHERE citizenid = @citizenid', {
['@citizenid'] = Player.PlayerData.citizenid
}, function(status)
if status ~= nil then
cb(json.decode(status))
else
cb(nil)
end
end)
else
cb()
end
end)