Jump to content

Get Sniper Zoom %


Lestat

Recommended Posts

You can get the fov of the camera with getCameraMatrix, but the fov doesnt change when you zoom with sniper so its not that.

the position of the camera, the player and the target (lets say other player) doesnt change when you zoom with sniper.

So the camera doesn't move, the fov doesnt change. It has to be a zoom value. But it seems we cant get it xD

Link to comment
  • Moderators

There might be a way. (probably inaccurate)

Using:

getScreenFromWorldPosition

getWorldFromScreenPosition

Since you can convert pixels > units and units > pixels using those functions.

When you zoom in, you can see less units than when you zoom out. Etc.

Also it might be possible with only getWorldFromScreenPosition, if this returns a correct position. Then you can compare it with getPedTargetStart.

Link to comment
  • Moderators
Unfortunately that didn't work, but I could do what I wanted to do other way. Not as good but it works :P

Suggestion, we should be able to get the camera zoom when using sniper and camera.

Must have worked 1 of the 2 ways. The only thing you need is creativity and lua skills.

There is another thing you can do if you can't get a long with getScreenFromWorldPosition and getWorldFromScreenPosition.

By scripting an overwrite. Zooming in mta works with steps, there are an amount of steps you can zoom in/zoom out.

bindKey -- "zoom_in" "zoom_out" > function 
  
-- create a variable which contains the zoom status. 
  
setControlState ( "zoom_in", true) -- zoom in 
setControlState ( "zoom_in", false) 
-- increase variable zoom status 
  
setControlState ("zoom_out", true) -- zoom out 
setControlState ("zoom_out", false) 
-- de-increase variable zoom status 
  
toggleControl -- "zoom_in" "zoom_out"  > false 
  
  
-- onClientPreRender  -- check if aiming with sniper else reset the variable zoom status. 
  

I have made it like this before (an overwrite of zooming with sniper), so I can guaranty it will work.

Link to comment

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