-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.lua
More file actions
25 lines (20 loc) · 779 Bytes
/
server.lua
File metadata and controls
25 lines (20 loc) · 779 Bytes
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
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.CreateCallback('astro:getplayers', function(_, cb)
local totalPlayers = 0
local policeCount = 0
local players = {}
for _, v in pairs(QBCore.Functions.GetQBPlayers()) do
if v then
totalPlayers += 1
if v.PlayerData.job.name == "police" and v.PlayerData.job.onduty then
policeCount += 1
end
players[v.PlayerData.source] = {}
players[v.PlayerData.source].optin = QBCore.Functions.IsOptin(v.PlayerData.source)
end
end
cb(totalPlayers, policeCount, players)
end)
RegisterNetEvent("astro:droppayer", function()
DropPlayer(source, "You disconnected from the server")
end)