local function camera()
-- lookat needs to be called before pos
set_camera_lookat(0, 2, 1.5)
set_camera_pos(3, 2, 1.1)
set_fov(120)
-- return 1 to disable the clients camera functions
-- NOTE WASD and arrows are not possible to disable today
return 1
end
add_hook("camera", "fovcam", camera)
local FOV = 120 --Variable that can be used throughout the script
local function camera()
set_fov(FOV) --Sets camera Field Of Veiw
end
local function keypress(key)
PresetB = 10 --Variable that can only be used in the "keypress" function
PresetV = 120
echo(key) --Prints the key code, usefull for finding keys
if(key == 109) then -- If the key pressed is 109 (M)
FOV = FOV + 1 --then Add one to FOV
echo(FOV) --and print FOV
elseif(key == 110) then --If it isn't 109 (M) then check its 110 (N)
FOV = FOV - 1
echo(FOV)
elseif(key == 118) then
FOV = PresetB
echo("Preset Key: " .. key .. ". FOV: " .. FOV) -- Use .. to seperate Variables and text.
elseif(key == 98) then
FOV = PresetV
echo("Preset Key: " .. key .. ". FOV: " .. FOV)
elseif key == string.byte('P') then -- If the key pressed is C
echo(key)
end --Ends the If
end --Ends the function
add_hook("key_down","FunCam", keypress) --Hooks to check for keys.
add_hook("camera", "FunCam", camera) --Hooks the Camera.
if(key == 109) then -- If the key pressed is 109 (M)
FOV = FOV + 1 --then Add one to FOV
echo(FOV) --and print FOV
If M, which is key 109, is pressed, increase your FOV by 1.I think I can make a free range camera, but I have not room for controls. I need WSAD freed up, and take Q and E too.
It should be relatively easy, but I can't really test it without a set of controls I can use.
____ _____ __ __ _ _ ___ _ _
( _ \( _ )( )( )( \( )/ __)( \/ )
) _ < )(_)( )(__)( ) (( (__ \ /
(____/(_____)(______)(_)\_)\___) (__)