-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathserver.lua
More file actions
60 lines (53 loc) · 1.87 KB
/
server.lua
File metadata and controls
60 lines (53 loc) · 1.87 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
48
49
50
51
52
53
54
55
56
57
58
59
60
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
function getInfo(source)
local identifier = getPlayersIdentifier(source)
local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {['@identifier'] = identifier})
if result[1] ~= nil then
local info = result[1]
return info
else
return nil
end
end
function getPlayersIdentifier(id)
if ESX_VERSION >= 1.2 then
local identifier = GetPlayerIdentifiers(id)[1]
local check = string.find(identifier, "license:")
if check == nil then
local identifier = GetPlayerIdentifiers(id)[2]
local cutIdentifier = string.gsub(identifier, "license:", "")
return cutIdentifier
else
local cutIdentifier = string.gsub(identifier, "license:", "")
return cutIdentifier
end
else
local identifier = GetPlayerIdentifiers(id)[1]
return identifier
end
end
ESX.RegisterServerCallback('strin_jobform:getInfo', function(source, cb)
local info = getInfo(source)
cb(info)
end)
RegisterServerEvent('strin_jobform:sendWebhook')
AddEventHandler('strin_jobform:sendWebhook', function(data)
local job = data.job
local label = data.label
local info = getInfo(source)
local headers = {
['Content-Type'] = 'application/json'
}
local data = {
["username"] = label,
["embeds"] = {{
["color"] = 3447003,
['description'] = '📝**Person Information**📝\nFirstname: '..info['firstname']..'\nLastname: '..info['lastname']..'\nDate of Birth: '..info['dateofbirth']..'\nGender: '..info['sex']..'\nPhone Number: '..info['phone_number']..'\n \nWhy are you joining our company?\n'..data.wayjoc..'\n \nTell us about yourself\n'..data.tuaby,
["footer"] = {
["text"] = info['name']
}
}}
}
PerformHttpRequest(WEBHOOKS[job], function(err, text, headers) end, 'POST', json.encode(data), headers)
end)