28WL Posted May 24, 2014 Share Posted May 24, 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 --ALWAYS SET CAMERA POSITION IN THE PLAYER'S HEAD addEventHandler ( "onClientPreRender", getRootElement ( ), function ( ) if FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", false ) end end end ) --MAKE SURE THE PLAYER AIMS WITH THE MOUSE addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and FPS_CAMERA then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setPedRotation ( player, findRotation ( x1, y1, x2, y2 ) ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 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 setElementAlpha ( player, 0 ) else setElementAlpha ( player, 255 ) end end --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 resetCamera ( ) end resetControls ( ) end ) Why I can't rotate mouse (view) after first person? I'm using First Person for DayZ server, is there might be some kind of problems??? login.lua: . .. ... fadeCamera(player, true) setCameraTarget(player, player) ... .. . I remember when there was no problems, but somehow it happened, that I could rotate mouse (view) in first person... Please, help me. Link to comment
28WL Posted May 28, 2014 Author Share Posted May 28, 2014 Somebody going to help me or not? I could give you some good free privileges for this help on my server. Link to comment
Backsage Posted May 29, 2014 Share Posted May 29, 2014 line 59: resetCamera ( ) isn't defined. If you do /debugscript 3, it will tell you that. I know what you're talking about. Mouse not moving the view. It is just stuck. I'm having same problem too and trying to figure out how to solve it. And xScatta isn't helping... But even after deleting the else resetCamera ( ), it still doesn't fix the problem. So I have no clue what it is. Link to comment
28WL Posted May 31, 2014 Author Share Posted May 31, 2014 1 guy helped me, everything OK, now there are about 260 lines of the script. Link to comment
Backsage Posted July 6, 2014 Share Posted July 6, 2014 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
28WL Posted July 7, 2014 Author Share Posted July 7, 2014 I can sell that script for a cheap price if you want. I edited a little bit to the better one . 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