Category: Player
/ View
Since engine version: 5.1 OC
SetPlayerZoomByViewRange
Description
Disabled or enabled locked view for one or all players. If the view is locked, the player cannot scroll around to explore the map.
Syntax
bool SetPlayerZoomByViewRange(int player, int range_x, int range_y, int flags);
Parameters
- player:
- Player whose zoom or zoom limits are to be adjusted. NO_OWNER for all players.
- range_x:
- Horizontal range that should be covered by the zoom. Zero to use range_y only. If both range_x and range_y are zero, a default range is assumed for range_x.
- range_y:
- Vertical range that should be covered by the zoom. Zero to use range_x only. If both range_x and range_y are nonzero, the number that yields the smaller zoom is used.
- flags:
- Flags controlling function behaviour:
Flag Description PLRZOOM_Direct The zoom does not scroll slowly towards the new value, but is set directly. PLRZOOM_NoIncrease The new zoom ranges are only to be set if they are smaller than the current values. PLRZOOM_NoDecrease The new zoom ranges are only to be set if they are greater than the current values. PLRZOOM_LimitMin Set the minimum limit for zooming. The player cannot zoom out further than this. PLRZOOM_LimitMax Set the maximum limit for zooming. The player cannot zoom in further than this.
Example
func InitializePlayer(int plr)
{
SetPlayerZoomByViewRange(plr, 1000, 0, PLRZOOM_LimitMin);
SetPlayerZoomByViewRange(plr, 1000, 0, PLRZOOM_LimitMax);
SetPlayerViewLock(plr, true);
return true;
}
Code for a scenario script: Players can see exactly 1000 pixels wide around their Clonk and cannot scroll further.


