Zuher Laith Posted January 26, 2016 Share Posted January 26, 2016 Greetings .. I'am looking for a way to make First-Person Mod in a Car In bindkey .. here is what i tried: local x, y, z, x1, y1, z1 local fpcam = false bindKey( "j", "down", function() if fpcam then setCameraTarget(getLocalPlayer(), getLocalPlayer()) end fpcam = not fpcam end ) addEventHandler("onClientPreRender", root, function() if fpcam then x, y, z = getPedBonePosition(getLocalPlayer(), 6) setCameraMatrix(x, y, z, x + x1, y + y1, z + z1) dxDrawImage(screenWidth/2-10, screenHeight/2-10, 20, 20, "images/aimer.png") local tarX, tarY, tarZ = getWorldFromScreenPosition(screenWidth/2, screenHeight/2, 30) setPedAimTarget(getLocalPlayer(), tarX, tarY, tarZ) end end ) addEventHandler("onClientCursorMove", root, function( _, _, _, _, wx, wy, wz ) local cx, cy, cz = getCameraMatrix() x1 = ( wx - cx ) / 300 y1 = ( wy - cy ) / 300 z1 = ( wz - cz ) / 300 end ) So this Code Works Great .. Except it Use's onClientCursorMove .. Which is ANNOYING .. I Want to Change it On Steering Wheel Right/Left Just like That: function getPointFromDistanceRotation(x,y,dist,angle) local a=math.rad(90-angle) local dx=math.cos(a)*dist local dy=math.sin(a)*dist return x+dx,y+dy end if getControlState"left" or getControlState"right" then local _,_,Zrot=getElementRotation(getPedOccupiedVehicle(getLocalPlayer())) wx,wy=getPointFromDistanceRotation(cx,cy,((cx-wx)^2+(cy-wy)^2)^0.5,Zrot) end There is Similar Topic Old & Already Asked, but Unsolved So , any way to make this works please ? .. Link to comment
Overkillz Posted January 26, 2016 Share Posted January 26, 2016 Im not sure if this function will work for you, but some weeks ago, I was having problems attaching elements to vehicle, the camera was moved when elements were attached, then an user recommend me to use setCameraClip Sorry if this didnt help u. Regards. Link to comment
Zuher Laith Posted January 26, 2016 Author Share Posted January 26, 2016 Im not sure if this function will work for you, but some weeks ago, I was having problems attaching elements to vehicle, the camera was moved when elements were attached, then an user recommend me to use setCameraClip Sorry if this didnt help u. Regards. I See .. It's really Helpful, but might be not the Right Topic for it . Link to comment
Zuher Laith Posted January 27, 2016 Author Share Posted January 27, 2016 Still Unsolved .. Link to comment
</Mr.Tn6eL> Posted January 27, 2016 Share Posted January 27, 2016 getCamera attachElements Link to comment
Zuher Laith Posted January 27, 2016 Author Share Posted January 27, 2016 getCamera attachElements Any How-to or Additional Information ? ساعد خويك 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