local pos_x, pos_y, pos_z = 100, 100, 100
local function keypress(key)
if(key == 274) then
pos_z = poz_z -1
elseif(key == 273) then
pos_z = pos_z +1
elseif(key == 275) then
pos_x = pos_x +1
elseif(key == 276) then
pos_x = pos_x -1
end
end
local function CamMove()
set_camera_pos (pos_x, pos_y, pos_z)
end
add_hook("key_down","FreeRoam", keypress)
add_hook("draw3D","FreeRoam", CamMove)
I think you can see what it does, well not does because it doesnt work. Halp?
local Camx = 0
local Camy = 0
local Camz = 0
local CamMinusX, CamPlusX, CamMinusZ, CamPlusZ = 0,0,0,0
local function keypress(key)
if(key == 274) then
CamMinusZ = 1
elseif(key == 273) then
CamPlusZ = 1
elseif(key == 275) then
CamMinusX = 1
elseif(key == 276) then
CamPlusX = 1
end
while (CamMinusX == 1) do
Camx = Camx -1
end
while (CamPlusX == 1) do
Camx = Camx +1
end
while (CamMinusZ == 1) do
Camz = Camz -1
end
while (CamPlusZ == 1) do
Camz = Camz +1
end
end
local function keyrelease(key)
if(key == 274) then
CamMinusZ = 0
elseif(key == 273) then
CamPlusZ = 0
elseif(key == 275) then
CamMinusX = 0
elseif(key == 276) then
CamPlusX = 0
end
end
local function camera()
set_camera_pos(Camx, Camy, Camz)
end
local function cameramove()
set_camera_pos(Camx, Camy, Camz)
end
add_hook("key_down","FreeRoam", keypress)
add_hook("key_up","FreeRoam", keyrelease)
add_hook("draw3d","FreeRoam", camera)
add_hook("camera","FreeRoam", cameramove)
--back = 274
--forward = 273
--right = 275
--left = 276
local Camx = 0
local Camy = 0
local Camz = 0
local CamMinusX, CamPlusX, CamMinusZ, CamPlusZ = 0,0,0,0
local function keypress(key)
if(key == 274) then
CamMinusZ = 1
elseif(key == 273) then
CamPlusZ = 1
elseif(key == 275) then
CamMinusX = 1
elseif(key == 276) then
CamPlusX = 1
end
if(CamMinusX == 1) then
Camx = Camx -1
end
if(CamPlusX == 1) then
Camx = Camx +1
end
if(CamMinusZ == 1) then
Camz = Camz -1
end
if(CamPlusZ == 1) then
Camz = Camz +1
end
if key == string.byte('X') then SavePos() end
if key == string.byte('Z') then LoadPos() end
end
function SavePos()
echo("X: " .. Camx)
echo("Z: " .. Camz)
SaveSettings = io.open("Settings.cam","w")
SaveSettings:write(Camx, "/n")
SaveSettings:write(Camy, "/n")
SaveSettings:write(Camz, "/n")
echo("Saved as: " .. input)
end
function LoadPos()
LoadSettings = io.open("Settings.cam","r")
XX = modin:read("1")
YY = modin:read("2")
XX = modin:read("3")
echo(XX.. "," .. YY .. "," .. ZZ)
Camx = XX
Camz = ZZ
Camy = YY
end
local function keyrelease(key)
if(key == 274) then
CamMinusZ = 0
elseif(key == 273) then
CamPlusZ = 0
elseif(key == 275) then
CamMinusX = 0
elseif(key == 276) then
CamPlusX = 0
end
end
local function camera()
set_camera_pos(Camx, Camy, Camz)
end
local function cameramove()
return 1
end
add_hook("key_down","FreeRoam", keypress)
add_hook("key_up","FreeRoam", keyrelease)
add_hook("draw3d","FreeRoam", camera)
add_hook("camera","FreeRoam", cameramove)
--back = 274
--forward = 273
--right = 275
--left = 276