Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,9 @@ RegisterNUICallback("getPlayers", function(data, cb)
local players = lib.callback.await('ps-adminmenu:callback:GetPlayers', false)
cb(players)
end)

-- Get players pos
RegisterNUICallback("getPlayersPos", function(data, cb)
local locations = lib.callback.await('ps-adminmenu:callback:GetPlayersPos', false)
cb(locations)
end)
2 changes: 1 addition & 1 deletion html/index.css

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions html/index.js

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions server/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,23 @@ RegisterNetEvent('ps-adminmenu:server:Revive', function(data, selectedData)
local data = CheckDataFromKey(data)
if not data or not CheckPerms(source, data.perms) then return end
local player = selectedData["Player"].value

TriggerClientEvent('hospital:client:Revive', player)
if GetResourceState('qbx_medical') == 'started' then
exports.qbx_medical:Revive(player)
else
TriggerClientEvent('hospital:client:Revive', player)
end
end)

-- Revive All
RegisterNetEvent('ps-adminmenu:server:ReviveAll', function(data)
local data = CheckDataFromKey(data)
if not data or not CheckPerms(source, data.perms) then return end

TriggerClientEvent('hospital:client:Revive', -1)
if GetResourceState('qbx_medical') == 'started' then
exports.qbx_medical:Revive(-1)
else
TriggerClientEvent('hospital:client:Revive', -1)
end
end)

-- Revive Radius
Expand All @@ -105,7 +112,11 @@ RegisterNetEvent('ps-adminmenu:server:ReviveRadius', function(data)
local dist = #(pos - targetPos)

if dist < 15.0 then
TriggerClientEvent("hospital:client:Revive", v)
if GetResourceState('qbx_medical') == 'started' then
exports.qbx_medical:Revive(v)
else
TriggerClientEvent('hospital:client:Revive', v)
end
end
end
end)
Expand Down
29 changes: 28 additions & 1 deletion server/players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ local function getPlayers()
for k, v in pairs(GetPlayers) do
local playerData = v.PlayerData
local vehicles = getVehicles(playerData.citizenid)
local coords = GetEntityCoords(GetPlayerPed(playerData.source))
local pos = { x = coords.x, y = coords.y, z = coords.z }


players[#players + 1] = {
id = k,
Expand All @@ -39,25 +42,49 @@ local function getPlayers()
license = QBCore.Functions.GetIdentifier(k, 'license'),
discord = QBCore.Functions.GetIdentifier(k, 'discord'),
steam = QBCore.Functions.GetIdentifier(k, 'steam'),
fivem = QBCore.Functions.GetIdentifier(k, 'fivem'),
job = playerData.job.label,
grade = playerData.job.grade.level,
dob = playerData.charinfo.birthdate,
cash = playerData.money.cash,
bank = playerData.money.bank,
phone = playerData.charinfo.phone,
vehicles = vehicles
vehicles = vehicles,
pos = pos
}
end


table.sort(players, function(a, b) return a.id < b.id end)

return players
end

local function getPlayersPos()
local locations = {}
local GetPlayers = QBCore.Functions.GetQBPlayers()

for k, v in pairs(GetPlayers) do
local playerData = v.PlayerData
local coords = GetEntityCoords(GetPlayerPed(playerData.source))
local pos = { x = coords.x, y = coords.y, z = coords.z }
locations[#locations + 1] = {
id = k,
pos = pos
}
end

table.sort(locations, function(a, b) return a.id < b.id end)
return locations
end

lib.callback.register('ps-adminmenu:callback:GetPlayers', function(source)
return getPlayers()
end)

lib.callback.register('ps-adminmenu:callback:GetPlayersPos', function(source)
return getPlayersPos()
end)
-- Set Job
RegisterNetEvent('ps-adminmenu:server:SetJob', function(data, selectedData)
local data = CheckDataFromKey(data)
Expand Down
2 changes: 1 addition & 1 deletion server/spectate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local spectating = {}
RegisterNetEvent('ps-adminmenu:server:SpectateTarget', function(data, selectedData)
local data = CheckDataFromKey(data)
if not data or not CheckPerms(source, data.perms) then return end
local player = selectedData["Player"].value
local player = tonumber(selectedData["Player"].value)

local type = "1"
if player == source then return QBCore.Functions.Notify(source, locale("cant_spectate_yourself"), 'error', 7500) end
Expand Down
4 changes: 4 additions & 0 deletions ui/src/layout/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import StaffChat from '@pages/Chat/Chat.svelte'
import Players from '@pages/Players/Players.svelte'
import Commands from '@pages/Commands/Commands.svelte'
import Livemap from '@pages/Livemap/Livemap.svelte'

</script>

<div
Expand All @@ -25,6 +27,8 @@
<Players />
{:else if $ACTIVE_PAGE == 'Commands'}
<Commands />
{:else if $ACTIVE_PAGE == 'Livemap'}
<Livemap />
{/if}
</div>
</div>
1 change: 1 addition & 0 deletions ui/src/layout/Sidebar/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{ value: 'Server', icon: 'fas fa-server' },
{ value: 'Commands', icon: 'fas fa-slash' },
{ value: 'Actions', icon: 'fas fa-wand-magic-sparkles' },
{ value: 'Livemap', icon: 'fas fa-map-location-dot' },
]
</script>

Expand Down
Loading