Skip to content

Instantly share code, notes, and snippets.

@x0rnn
Last active May 2, 2023 16:24
Show Gist options
  • Save x0rnn/9aecddcd32dc22aed6f0ba50cd1ad535 to your computer and use it in GitHub Desktop.
Save x0rnn/9aecddcd32dc22aed6f0ba50cd1ad535 to your computer and use it in GitHub Desktop.
-- convert VET/ETPro FOV to ETLegacy
function et_InitGame(levelTime, randomSeed, restart)
et.RegisterModname("fov.lua "..et.FindSelf())
end
function et_ClientCommand(id, cmd)
if et.trap_Argv(0) == "say" then
args = et.ConcatArgs(1)
local args_table = {}
cnt = 0
for i in string.gmatch(args, "%S+") do
table.insert(args_table, i)
cnt = cnt + 1
end
local function roundNum(num, n)
local mult = 10^(n or 0)
return math.floor(num * mult + 0.5) / mult
end
if string.lower(args_table[1]) == "!fov" then
if cnt ~= 2 then
et.trap_SendServerCommand(id, "chat \"Usage: ^7!fov ^3ETPro_FOV\"\n")
else
if tonumber(args_table[2]) == nil then
et.trap_SendServerCommand(id, "chat \"Usage: ^7!fov ^3ETPro_FOV\"\n")
else
if tonumber(args_table[2]) < 90 then
et.trap_SendServerCommand(id, "chat \"Value must be equal or above 90!\"\n")
else
if tonumber(args_table[2]) <= 91.31 then
et.trap_SendServerCommand(id, "chat \"Your ETLegacy FOV is: ^175\"\n")
else
local fov = math.atan(3/4*math.tan(math.pi*tonumber(args_table[2])/360))*360/math.pi
et.trap_SendServerCommand(id, "chat \"Your ETLegacy FOV is: ^1" .. roundNum(fov, 2) .. "\"\n")
end
end
end
end
end
end
return(0)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment