-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.lua
More file actions
65 lines (61 loc) · 2.05 KB
/
client.lua
File metadata and controls
65 lines (61 loc) · 2.05 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
61
62
63
64
65
local QBCore = exports['qb-core']:GetCoreObject()
local open = false
local loaded = false
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
loaded = true
end)
Citizen.CreateThread(function()
while true do
Wait(1)
SetPauseMenuActive(false)
if loaded then
local Player = QBCore.Functions.GetPlayerData()
if (IsControlJustPressed(0, 200)) and not open and not IsPauseMenuActive() then
TransitionToBlurred(1000)
SetNuiFocus(true, true)
open = true
-- Call the callback to get playersOnline data
QBCore.Functions.TriggerCallback('astro:getplayers', function(playersOnline, policeCount, players)
print("heLLO")
local characterData = {
characterName = Player.charinfo.firstname..' '..Player.charinfo.lastname,
job = Player.job.name,
cashAmount = Player.money['cash'],
bankAmount = Player.money['bank'],
playersOnline = playersOnline,
policeAvailable = true
}
SendNUIMessage({
type = "characterData",
data = characterData
})
SendNUIMessage({
action = "show"
})
end)
end
end
end
end)
function closemenu()
TransitionFromBlurred(1000)
SetNuiFocus(false, false)
SendNUIMessage({
action = "hide"
})
open = false
end
RegisterNUICallback('Settings', function(data)
closemenu()
ActivateFrontendMenu(GetHashKey('FE_MENU_VERSION_LANDING_MENU'),0,-1)
end)
RegisterNUICallback('Map', function(data)
closemenu()
ActivateFrontendMenu(GetHashKey('FE_MENU_VERSION_MP_PAUSE'),0,-1)
end)
RegisterNUICallback('DropPlayer', function(data)
TriggerServerEvent('astro:droppayer')
end)
-- Send the data to the client-side script
RegisterCommand("send", function()
end)