Skip to content
Open
Show file tree
Hide file tree
Changes from 10 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.

30 changes: 15 additions & 15 deletions html/index.js

Large diffs are not rendered by default.

26 changes: 25 additions & 1 deletion server/players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ local function getPlayers()
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,
name = playerData.charinfo.firstname .. ' ' .. playerData.charinfo.lastname,
Expand All @@ -52,15 +53,38 @@ local function getPlayers()
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
Loading