Jump to content

What's wrong with my code?


Mirou123

Recommended Posts

Posted

Hello I'm new in LUA I tryed to create this small script I want it to change the camera's look at position

function SetCameraLookAt() 
                local screenx, screeny, worldx, worldy, worldz = getCursorPosition() 
                local cx,cy,cz,clx,xly,clz = GetCameraMatrix(playerid) 
                SetCameraMatrix(cx ,cy ,cz ,worldx, worldy, worldz) 
        end 
end 
  
addEventHandler( "onClientCursorMove", getRootElement( ),SetCameraLookAt) 

I can't see what's wrong with this code I hope you can help oh by the way in the code before this one I set the camera's position to a location using SetCameraMatrix and I used showCursor.One last thing,this is a client side script

Posted

It would be more helpful if you didn't just say "it's not working" but say what is it doing instead (e.g what's the error message if there is one).

By the way, there is no function called "SetCameraMatrix", use setCameraMatrix.

And playerid is not defined, use getLocalPlayer.

Edit: oh, and "GetCameraMatrix" is also wrong.

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...