-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathserver.lua
73 lines (68 loc) · 2.13 KB
/
server.lua
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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 then
local data = {
identifier = result[1]['identifier'],
firstname = result[1]['firstname'],
lastname = result[1]['lastname'],
dateofbirth = result[1]['dateofbirth'],
sex = result[1]['sex'],
height = result[1]['height'],
job = result[1]['job'],
}
callback(data)
else
local data = {
identifier = '',
firstname = '',
lastname = '',
dateofbirth = '',
sex = '',
height = ''
}
callback(data)
end
end)
end
RegisterServerEvent('gc:openIdentity')
AddEventHandler('gc:openIdentity',function(other)
getIdentity(source, function(data)
local gender
if data.sex == "male" then
gender = "h"
elseif data.g == "female" then
gender = "f"
end
TriggerClientEvent('gc:showItentity', tonumber(other), {
nom = data.lastname,
prenom = data.firstname,
dateNaissance = tostring(data.dateofbirth),
sexe = gender,
jobs = data.job,
taille = data.height,
id = identifier
})
end)
end)
RegisterServerEvent('gc:openMeIdentity')
AddEventHandler('gc:openMeIdentity',function()
getIdentity(source, function(data)
local gender
if data.sex == "male" then
gender = "h"
elseif data.g == "female" then
gender = "f"
end
TriggerClientEvent('gc:showItentity', source, {
nom = data.lastname,
prenom = data.firstname,
dateNaissance = tostring(data.dateofbirth),
sexe = gender,
jobs = data.job,
taille = data.height,
id = identifier
})
end)
end)