-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
31 lines (26 loc) · 1.11 KB
/
Copy pathserver.lua
File metadata and controls
31 lines (26 loc) · 1.11 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
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.CreateCallback('me_mail:server:GetPlayers', function(source, cb)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local allplayers = {}
local players = MySQL.Sync.fetchAll('SELECT citizenid, charinfo FROM players')
if players[1] ~= nil then
for _, value in pairs(players) do
local charinfo = json.decode(value.charinfo)
local phone = charinfo.phone
local firstname = charinfo.firstname
local lastname = charinfo.lastname
local citizenid = value.citizenid
local Target = QBCore.Functions.GetPlayerByPhone(phone)
if Target then
allplayers[#allplayers + 1] = {
citizenid = value.citizenid,
sender = Player.PlayerData.charinfo.phone,
phone = phone,
name = '🟢 ' .. Target.PlayerData.charinfo.firstname .. ' ' .. Target.PlayerData.charinfo.lastname
}
end
end
end
cb(allplayers)
end)