mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
fix: add verification for api format
This commit is contained in:
parent
75001c3ddc
commit
c53952f163
|
@ -1,4 +1,5 @@
|
||||||
function gmInte.getPlayerFormat(ply)
|
function gmInte.getPlayerFormat(ply)
|
||||||
|
if (!IsValid(ply) || !ply:IsPlayer()) then return end
|
||||||
return {
|
return {
|
||||||
["steamID"] = ply:SteamID(),
|
["steamID"] = ply:SteamID(),
|
||||||
["steamID64"] = ply:SteamID64(),
|
["steamID64"] = ply:SteamID64(),
|
||||||
|
@ -29,6 +30,7 @@ function gmInte.getServerFormat()
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.getWeaponFormat(weapon)
|
function gmInte.getWeaponFormat(weapon)
|
||||||
|
if (!IsValid(weapon) || !weapon:IsWeapon()) then return end
|
||||||
return {
|
return {
|
||||||
["class"] = weapon:GetClass(),
|
["class"] = weapon:GetClass(),
|
||||||
["printName"] = weapon:GetPrintName()
|
["printName"] = weapon:GetPrintName()
|
||||||
|
@ -36,6 +38,7 @@ function gmInte.getWeaponFormat(weapon)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.getEntityFormat(ent)
|
function gmInte.getEntityFormat(ent)
|
||||||
|
if (!IsValid(ent)) then return end
|
||||||
return {
|
return {
|
||||||
["class"] = ent:GetClass(),
|
["class"] = ent:GetClass(),
|
||||||
["model"] = ent:GetModel(),
|
["model"] = ent:GetModel(),
|
||||||
|
@ -45,6 +48,7 @@ function gmInte.getEntityFormat(ent)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.getVectorFormat(vec)
|
function gmInte.getVectorFormat(vec)
|
||||||
|
if (!isvector(vec)) then return end
|
||||||
return {
|
return {
|
||||||
["x"] = vec.x,
|
["x"] = vec.x,
|
||||||
["y"] = vec.y,
|
["y"] = vec.y,
|
||||||
|
@ -53,6 +57,7 @@ function gmInte.getVectorFormat(vec)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.getAngleFormat(ang)
|
function gmInte.getAngleFormat(ang)
|
||||||
|
if (!isangle(ang)) then return end
|
||||||
return {
|
return {
|
||||||
["p"] = ang.p,
|
["p"] = ang.p,
|
||||||
["y"] = ang.y,
|
["y"] = ang.y,
|
||||||
|
@ -61,6 +66,7 @@ function gmInte.getAngleFormat(ang)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.getTeamFormat(teamID)
|
function gmInte.getTeamFormat(teamID)
|
||||||
|
if (!isnumber(teamID)) then return end
|
||||||
return {
|
return {
|
||||||
["id"] = teamID,
|
["id"] = teamID,
|
||||||
["name"] = team.GetName(teamID)
|
["name"] = team.GetName(teamID)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user