Jump to content

freeze camera


Xwad

Recommended Posts

You can use this, you just have to trigger the event onClientIsFreezed when the player is being freezed. :D

addEvent("onClientIsFreezed", true)
addEvent("onClientIsUnFrozen", true)

local freezed = false
local fx, fy, fz, ftx, fty, ftz

function saveXYZ()
  fx, fy, fz, ftx, fty, ftz = getCameraMatrix()
  freezed = true
end
addEventHandler("onClientIsFreezed", root, saveXYZ )

function unfroze()
  freezed = false
  fx, fy, fz, ftx, fty, ftz = nil, nil, nil, nil, nil, nil
end
addEventHandler("onClientIsUnFrozen", root, unfroze)

function check()
  if ( freezed == true ) then
    local nx, ny, nz, ntx, nty, ntz = getCameraMatrix()
    if ( nx ~= fx ) or ( ny ~= fy ) or ( nz ~= fz ) or ( ntx ~= ftx ) or ( nty ~= fty ) or ( ntz ~= ftz ) then
      setCameraMatrix( fx, fy, fz, ftx, fty, ftz )
    end
  end
end
addEventHandler("onClientRender", root, check )

 

Edited by Simple01
Added unfrozen function + Fixed spelling error
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...