-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcl_getpos.lua
More file actions
24 lines (21 loc) · 1.13 KB
/
Copy pathcl_getpos.lua
File metadata and controls
24 lines (21 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local function yuck(ply, cmd, tbl, str)
local num = tonumber(str)
if isnumber(num) then
local xa = math.Truncate(ply:GetPos().x, num)
local ya = math.Truncate(ply:GetPos().y, num)
local za = math.Truncate(ply:GetPos().z, num)
local pa = math.Truncate(ply:GetAngles().p, num)
local ya = math.Truncate(ply:GetAngles().y, num)
local ra = math.Truncate(ply:GetAngles().r, num)
print("Vector(" .. xa .. ", " .. ya .. ", " .. za .. ")\n" .. "Angle(" .. pa .. ", " .. ya .. ", " .. ra .. ")")
else
local x = math.Round(ply:GetPos().x)
local y = math.Round(ply:GetPos().y)
local z = math.Round(ply:GetPos().z)
local p = math.Round(ply:GetAngles().p) // Pitch
local y = math.Round(ply:GetAngles().y) // yw
local r = math.Round(ply:GetAngles().r) // Roll
print("Vector(" .. x .. ", " .. y .. ", " .. z .. ")\n" .. "Angle(" .. p .. ", " .. y .. ", " .. r .. ")")
end
end
concommand.Add("getpp", yuck, function() return {"providing a num truncates the pos and ang to that number of decimal places"} end, "pretty pos", FCVAR_NONE)