-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
46 lines (42 loc) · 1.45 KB
/
server.lua
File metadata and controls
46 lines (42 loc) · 1.45 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
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
function getIdentity(source, callback)
local identifier = GetPlayerIdentifiers(source)[1]
MySQL.Async.fetchAll("SELECT * FROM `users` WHERE `identifier` = @identifier", {['@identifier'] = identifier},
function(result)
if result[1]['firstname'] ~= nil and result[1]['lastname'] ~= nil and result[1]['twitter'] ~= nil then
local data = {
identifier = result[1]['identifier'],
firstname = result[1]['firstname'],
lastname = result[1]['lastname'],
twitter = result[1]['twitter'],
dateofbirth = result[1]['dateofbirth'],
sex = result[1]['sex'],
height = result[1]['height']
}
callback(data)
else
local data = {
identifier = ' ',
firstname = ' ',
lastname = ' ',
twitter = ' ',
dateofbirth = ' ',
sex = ' ',
height = ' '
}
callback(data)
end
end)
end
RegisterCommand('num', function(source, args, rawCommand)
args = table.concat(args, ' ')
local xPlayer = ESX.GetPlayerFromId(source)
local playerName = xPlayer.getName()
local number = xPlayer.get("phoneNumber")
getIdentity(source, function(data)
TriggerClientEvent('sendProximityMessageNum', -1, source, data.firstname, number)
end)
end)