Author Topic: How to access toggleZoom?  (Read 1138 times)

My friend is working on a weapons which is trying to access "toggleZoom".
Code: [Select]
toggleZoom(1);
But when he tries to call the function, the console says that there isnt anything by the name toggleZoom?

Is there any other way to access it?
If not, is there any other way to store the player's original FOV in a varialbe?

The strange thing is, that it works perfectly as a console command when entered the same way as i meantioned before.
« Last Edit: April 28, 2015, 09:50:27 AM by The 1 »

My friend is working on a weapons which is trying to access "toggleZoom".
Code: [Select]
toggleZoom(1);
But when he tries to call the function, the console says that there isnt anything by the name toggleZoom?

Is there any other way to access it?

The strange thing is, that it works perfectly as a console command when entered the same way as i meantioned before.
toggleZoom is a client sided function. Which means that the server can't use it. When entered as a console command it's being entered on the client side.
If not, is there any other way to store the player's original FOV in a varialbe?
I really don't think so. That's why there's a weapons mod with a /fixFov command. So you can set what fov you're set to when you un-ironsight.
There is, actually. The fixfov command is just the creators of the command being lazy butts. %client.player.getCameraFOV()
Most people have their default fov set to 90 anyways.

Use %client.setControlCameraFov(90); to change someone's fov server sided.
« Last Edit: April 28, 2015, 10:30:22 AM by jes00 »

I really don't think so. That's why there's a weapons mod with a /fixFov command. So you can set what fov you're set to when you un-ironsight. Most people have their default fov set to 90 anyways.

Use %client.setControlCameraFov(90); to change someone's fov server sided.
There is, actually. The fixfov command is just the creators of the command being lazy butts. %client.player.getCameraFOV()

There is, actually. The fixfov command is just the creators of the command being lazy butts. %client.player.getCameraFOV()

That method exists but none of the weapons use it before changing the field of view?
« Last Edit: April 28, 2015, 05:09:42 PM by Hime »

That method exists but none of the weapons use it before changing the field of view?
Yep. Not sure why too, it's a fairly easy command to find, it's obviously named too.

When would be a convenient time to get it?
As soon as the script awakens, or to create a boolean to check wether the player is aiming and only getting the current FOV if he's not?

When would be a convenient time to get it?
As soon as the script awakens, or to create a boolean to check wether the player is aiming and only getting the current FOV if he's not?
Right before you change the FOV so you can actually change it back to the original after the user un-scopes or whatever it is

I'd get the preferred fov on player spawn
Otherwise, what if the player is already zooming (holding zoom key or some other zoom weapon) when they switch to your?