mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
add: players List and math round angl / pos
This commit is contained in:
parent
ee1e2caf30
commit
66269d39de
|
@ -17,6 +17,14 @@ function gmInte.getPlayerFormat(ply)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function gmInte.getPlayersFormat()
|
||||||
|
local players = {}
|
||||||
|
for k, v in pairs(player.GetAll()) do
|
||||||
|
table.insert(players, gmInte.getPlayerFormat(v))
|
||||||
|
end
|
||||||
|
return players
|
||||||
|
end
|
||||||
|
|
||||||
function gmInte.getServerFormat()
|
function gmInte.getServerFormat()
|
||||||
return {
|
return {
|
||||||
["hostname"] = GetHostName(),
|
["hostname"] = GetHostName(),
|
||||||
|
@ -24,6 +32,7 @@ function gmInte.getServerFormat()
|
||||||
["port"] = GetConVar("hostport"):GetInt(),
|
["port"] = GetConVar("hostport"):GetInt(),
|
||||||
["map"] = game.GetMap(),
|
["map"] = game.GetMap(),
|
||||||
["players"] = #player.GetAll(),
|
["players"] = #player.GetAll(),
|
||||||
|
["playersList"] = gmInte.getPlayersFormat(),
|
||||||
["maxPlayers"] = game.MaxPlayers(),
|
["maxPlayers"] = game.MaxPlayers(),
|
||||||
["gameMode"] = engine.ActiveGamemode(),
|
["gameMode"] = engine.ActiveGamemode(),
|
||||||
["uptime"] = math.Round(RealTime())
|
["uptime"] = math.Round(RealTime())
|
||||||
|
@ -51,18 +60,18 @@ end
|
||||||
function gmInte.getVectorFormat(vec)
|
function gmInte.getVectorFormat(vec)
|
||||||
if (!isvector(vec)) then return end
|
if (!isvector(vec)) then return end
|
||||||
return {
|
return {
|
||||||
["x"] = vec.x,
|
["x"] = math.Round(vec.x),
|
||||||
["y"] = vec.y,
|
["y"] = math.Round(vec.y),
|
||||||
["z"] = vec.z
|
["z"] = math.Round(vec.z)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.getAngleFormat(ang)
|
function gmInte.getAngleFormat(ang)
|
||||||
if (!isangle(ang)) then return end
|
if (!isangle(ang)) then return end
|
||||||
return {
|
return {
|
||||||
["p"] = ang.p,
|
["p"] = math.Round(ang.p),
|
||||||
["y"] = ang.y,
|
["y"] = math.Round(ang.y),
|
||||||
["r"] = ang.r
|
["r"] = math.Round(ang.r)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user