-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
133 lines (115 loc) · 3.44 KB
/
client.lua
File metadata and controls
133 lines (115 loc) · 3.44 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
local AdminMenu = {
isOpen = false,
permissions = {},
panels = {},
cachedPlayers = {}
}
local function sendNui(action, data)
SendNUIMessage({
action = action,
data = data or {}
})
end
local function setFocus(state)
SetNuiFocus(state, state)
SetNuiFocusKeepInput(state)
end
local function requestMenu()
TriggerServerEvent('ultimate_admin:requestMenu')
end
RegisterNetEvent('ultimate_admin:openMenu', function(payload)
AdminMenu.permissions = payload.permissions or {}
AdminMenu.panels = payload.panels or {}
AdminMenu.cachedPlayers = payload.players or {}
AdminMenu.isOpen = true
setFocus(true)
sendNui('open', payload)
end)
RegisterNetEvent('ultimate_admin:updatePlayers', function(players)
AdminMenu.cachedPlayers = players
sendNui('players', players)
end)
RegisterNetEvent('ultimate_admin:fixVehicle', function()
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
SetVehicleFixed(vehicle)
SetVehicleDirtLevel(vehicle, 0.0)
end
end)
RegisterNetEvent('ultimate_admin:changePlate', function(plate)
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
SetVehicleNumberPlateText(vehicle, plate)
end
end)
RegisterNetEvent('ultimate_admin:spawnObject', function(model)
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local modelHash = GetHashKey(model)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
local object = CreateObject(modelHash, coords.x, coords.y, coords.z - 1.0, true, true, true)
SetEntityHeading(object, heading)
PlaceObjectOnGroundProperly(object)
SetModelAsNoLongerNeeded(modelHash)
end)
RegisterNetEvent('ultimate_admin:createStash', function(stashId)
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
TriggerServerEvent('inventory:server:OpenInventory', 'stash', stashId, {
maxweight = 400000,
slots = 50
})
TriggerEvent('inventory:client:SetCurrentStash', stashId)
TriggerServerEvent('ultimate_admin:logStash', stashId, coords)
end)
RegisterNetEvent('ultimate_admin:adminChat', function(source, message)
if not message or message == '' then
return
end
sendNui('toast', { message = ('[Admin] %s: %s'):format(source, message), type = 'info' })
end)
RegisterNetEvent('ultimate_admin:reportUpdate', function(source, message)
if not message or message == '' then
return
end
sendNui('toast', { message = ('[Report] %s: %s'):format(source, message), type = 'warning' })
end)
RegisterNetEvent('ultimate_admin:notify', function(message, type)
sendNui('toast', { message = message, type = type or 'info' })
end)
RegisterNUICallback('close', function(_, cb)
AdminMenu.isOpen = false
setFocus(false)
cb('ok')
end)
RegisterNUICallback('action', function(data, cb)
TriggerServerEvent('ultimate_admin:action', data)
cb('ok')
end)
RegisterNUICallback('requestPlayers', function(_, cb)
cb(AdminMenu.cachedPlayers)
end)
RegisterCommand('uamenu', function()
requestMenu()
end, false)
RegisterKeyMapping('uamenu', 'Open Ultimate Admin Menu', 'keyboard', 'F10')
CreateThread(function()
while true do
if AdminMenu.isOpen then
DisableControlAction(0, 1, true)
DisableControlAction(0, 2, true)
DisableControlAction(0, 24, true)
DisableControlAction(0, 25, true)
DisableControlAction(0, 200, true)
Wait(0)
else
Wait(500)
end
end
end)