xScatta Posted May 27, 2014 Share Posted May 27, 2014 player = getLocalPlayer ( ) sw, sh = guiGetScreenSize ( ) mouse1_pressed = false FPS_CAMERA = false --FUNCTION MADE BY 'Doomed_Space_Marine', FIXED BY 'robhol' function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if FPS_CAMERA and not isCursorShowing() and not isChatBoxInputActive() then local x1, y1, z1 = getPedBonePosition ( player, 6 ) lol1 = x2 lol2 = y2 lol3 = z2 l1, l2, l3, m1, m2, m3 = getCameraMatrix() end end ) addEventHandler ( "onClientPreRender", getRootElement ( ), function ( ) if FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) local n, m, x3, y3, z3 = getCursorPosition() setCameraMatrix ( x1, y1, z1, lol1, lol2, lol3 ) end end ) --A SIMPLE WAY TO MAKE A KEY REPEATER --[[ bindKey ( "mouse1", "both", function ( k, state ) if state == "down" then mouse1_pressed = true else mouse1_pressed = false end end ) ]]-- --CONTROLS PART function resetControls ( ) --toggleControl ( "aim_weapon", not FPS_CAMERA ) --toggleControl ( "backwards", not FPS_CAMERA ) --toggleControl ( "sprint", not FPS_CAMERA ) --toggleControl ( "right", not FPS_CAMERA ) --toggleControl ( "left", not FPS_CAMERA ) --toggleControl ( "fire", not FPS_CAMERA ) --toggleControl ( "enter_vehicle", not FPS_CAMERA ) --toggleControl ( "enter_passenger", not FPS_CAMERA ) if FPS_CAMERA then else setElementAlpha ( player, 255 ) end end local x, y, z = getElementPosition(player) --DRAW A BEAUTIFUL CROSSHAIR IN THE MIDDLE OF THE SCREEN addEventHandler ( "onClientRender", getRootElement ( ), function ( ) if FPS_CAMERA then dxDrawImage ( ( sw / 2 ) - 4, ( sh / 2 ) - 4, 8, 8, "crosshair.png" ) end end ) addCommandHandler ( "fp", function ( ) FPS_CAMERA = not FPS_CAMERA if not FPS_CAMERA then setCameraTarget ( player ) else setCameraMatrix(x,y,z,0,0,3) end resetControls ( ) end ) The problem is when i move the camera don't stand still it moves so when i have camera at center then when i will change position then camera will try to look at position where the center WAS. CrystalMV said i must do something with 'roll' argument. Fast Reply please. Link to comment
Backsage Posted May 29, 2014 Share Posted May 29, 2014 Well, I'm having a similar problem. When I start the script and move the mouse, the camera don't move with it. I've been looking at the truefps script, but I can't figure out how to get it to work in that script and to make it work for vehicles. All I know is line 59: resetCamera ( ) isn't defined. Would be great if we could get some help. Link to comment
xScatta Posted May 29, 2014 Author Share Posted May 29, 2014 Already fixed it. Please close. Link to comment
Backsage Posted May 30, 2014 Share Posted May 30, 2014 How did you fix it? I would like to know. EDIT: For some reason, the script only works on MTA 1.4 and doesn't work on MTA 1.3.5. Weird. Thanks to 28WL and xScatta for not helping me. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now