-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
23 lines (22 loc) · 798 Bytes
/
server.lua
File metadata and controls
23 lines (22 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Citizen.CreateThread(function()
MySQL.ready(function ()
print("User Active System by redoper & feťo started!")
end)
end)
function getIdentity(source)
local identifier = GetPlayerIdentifiers(source)[1]
local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {['@identifier'] = identifier})
if result[1] ~= nil then
local identity = result[1]
return {
identifier = identity['identifier'],
}
else
return nil
end
end
AddEventHandler('es:playerLoaded', function(source)
local Identifier = GetPlayerIdentifiers(source)[1]
local now = os.date()
MySQL.Async.execute('UPDATE `users` SET `last_connected`=@now WHERE `identifier`=@identifier;', {['@identifier'] = Identifier, ['@now'] = now}, nil)
end)