12p Posted November 16, 2011 Share Posted November 16, 2011 Can you tell me what's not working if you use THIS code? Does it output something at the chat? Remember to press F2 to make this work! local player = getLocalPlayer ( ) local fpsmode = false bindKey ( "f2", "down", function ( ) fpsmode = not fpsmode toggle ( ) end ) function toggle ( ) if isPedInVehicle ( player ) and fpsmode then outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) addEventHandler ( "onClientPreRender", setFPSCamera ) else outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) setCameraTarget ( player ) removeEventHandler ( "onClientPreRender", setFPSCamera ) end end addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) Link to comment
Blaawee Posted November 16, 2011 Author Share Posted November 16, 2011 are you sure there is function called "setFPSCamera" ?? Not working, did you test it ? Link to comment
12p Posted November 16, 2011 Share Posted November 16, 2011 GOD. YOU HAVEN'T CHECKED MY DAMN CODE. That's why this doesn't work. You didn't copy any of the core functions!!! Here you have new code... local player = getLocalPlayer ( ) fpsmode = false addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) end end ) function setFPSCamera ( ) local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", true ) end end bindKey ( "f2", "down", function ( ) fpsmode = not fpsmode toggle ( ) end ) function toggle ( ) if isPedInVehicle ( player ) and fpsmode then outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) addEventHandler ( "onClientPreRender", setFPSCamera ) else outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) setCameraTarget ( player ) removeEventHandler ( "onClientPreRender", setFPSCamera ) end end addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) addEventHandler ( "onClientPlayerVehicleExit", player, toggle )[/lua] Link to comment
Blaawee Posted November 16, 2011 Author Share Posted November 16, 2011 Finley it's work but there's wrong , i can toggle FPS only i move the aim why ? Link to comment
12p Posted November 16, 2011 Share Posted November 16, 2011 (edited) local player = getLocalPlayer ( ) fpsmode = false addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) end end ) function setFPSCamera ( ) local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", true ) end end bindKey ( "f2", "down", function ( ) fpsmode = not fpsmode toggle ( ) end ) function toggle ( ) if isPedInVehicle ( player ) and fpsmode then outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) addEventHandler ( "onClientPreRender", root, setFPSCamera ) elseif not fpsmode then outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) setCameraTarget ( player ) removeEventHandler ( "onClientPreRender", root, setFPSCamera ) end end addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) ? I'm getting bored of giving you new code everytime you say "dont work", and don't even try to help me to help you (debugging). Edited November 16, 2011 by Guest Link to comment
Castillo Posted November 16, 2011 Share Posted November 16, 2011 Aren't you forgetting something Benxamix? addEventHandler ( "onClientPreRender", setFPSCamera ) You forgot about "root". Link to comment
Blaawee Posted November 16, 2011 Author Share Posted November 16, 2011 here is my edit : local player = getLocalPlayer ( ) fpsmode = false addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) end end ) function setFPSCamera ( ) local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", true ) end end bindKey ( "r", "down", function ( ) fpsmode = not fpsmode toggle ( ) end ) function toggle ( ) if isPedInVehicle ( player ) and fpsmode then addEventHandler ( "onClientPreRender", setFPSCamera ) else setCameraTarget ( player ) removeEventHandler ( "onClientPreRender", setFPSCamera ) end end addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) at line 27 @ addEventHandler Link to comment
12p Posted November 16, 2011 Share Posted November 16, 2011 I already edited this, but here you go (again): local player = getLocalPlayer ( ) fpsmode = false addEventHandler ( "onClientCursorMove", getRootElement ( ), function ( guiy1, guiy1, guix2, guiy2, x2, y2, z2 ) if not isCursorShowing ( ) and not isChatBoxInputActive ( ) and not isMainMenuActive ( ) and fpsmode and isPedInVehicle ( player ) then local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) end end ) function setFPSCamera ( ) local x1, y1, z1 = getPedBonePosition ( player, 6 ) setCameraMatrix ( x1, y1, z1 ) if not getControlState ( "aim_weapon" ) then setControlState ( "aim_weapon", true ) end end bindKey ( "f2", "down", function ( ) fpsmode = not fpsmode toggle ( ) end ) function toggle ( ) if isPedInVehicle ( player ) and fpsmode then outputChatBox ( "View Mode |on|", 0 , 255, 0 , true) addEventHandler ( "onClientPreRender", root, setFPSCamera ) elseif not fpsmode then outputChatBox ( "View Mode |OFF|", 255, 255, 255, true ) setCameraTarget ( player ) removeEventHandler ( "onClientPreRender", root, setFPSCamera ) end end addEventHandler ( "onClientPlayerVehicleEnter", player, toggle ) addEventHandler ( "onClientPlayerVehicleExit", player, toggle ) Link to comment
Blaawee Posted November 16, 2011 Author Share Posted November 16, 2011 now it's work thx all but there's little problume if you can help or not doesn't matter at least you make FPS work ,the problume is : when i toggle the FPS the camera only move to what aim goes , can i make camera move to what steering ? Link to comment
Jaysds1 Posted November 16, 2011 Share Posted November 16, 2011 Are you talking about the camera moving to the steering wheel? Link to comment
12p Posted November 16, 2011 Share Posted November 16, 2011 remove all the piece of code related to onClientCursorMove. That's the first step. Link to comment
Blaawee Posted November 17, 2011 Author Share Posted November 17, 2011 o.k i remove all code related to onClientCursorMove then what i have to do next Link to comment
12p Posted November 17, 2011 Share Posted November 17, 2011 https://wiki.multitheftauto.com/wiki/Get ... ceRotation getElementRotation 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