hof-errors/server/sv_functions.lua
2025-03-19 09:39:02 -05:00

37 lines
1.2 KiB
Lua

local QBX = exports.qbx_core
local function FormatCoords(x,y,z,heading)
local formattedX = math.floor(x * 100) / 100
local formattedY = math.floor(y * 100) / 100
local formattedZ = math.floor(z * 100) / 100
local formattedHeading = math.floor(heading * 100) / 100
local formattedString = formattedX .. ', '.. formattedY .. ', '.. formattedZ .. ', H: '..formattedHeading
return formattedString
end
local function FetchIdentifiers (source)
local identifiersString = ''
for _, identifier in ipairs(GetPlayerIdentifiers(source)) do
identifiersString = identifiersString .. '\n'..identifier
end
identifiersString = identifiersString .. '\n'
return identifiersString
end
local function DeadOrLastStand (source)
local _source = source
local Player = QBX:GetPlayer(_source)
local dead = Player.PlayerData.metadata.isDead
local laststand = Player.PlayerData.metadata.inLaststand
if dead then return "Player Dead" end
if laststand then return "Player in Laststand" end
return "Player Alive"
end
return {
FormatCoords = FormatCoords,
FetchIdentifiers = FetchIdentifiers,
DeadOrLastStand = DeadOrLastStand
}