Skip to content

Cameras, input, and storage

Client helpers control local presentation and never replace server authority.

ts
const camera = vimp.cameras.create(
  'vehicle-preview',
  { x: 100, y: -1900, z: 24 },
  { x: -15, y: 0, z: 140 },
  60,
)

camera.setActive(true)
vimp.cameras.renderScriptCams(true, true, 500)
vimp.cursor.show()
vimp.storage.setItem('garage:lastModel', 'adder')

Cameras

Create script cameras with position, rotation, and field of view, activate one, then enable script camera rendering. Destroy cameras when leaving the feature and restore gameplay rendering with renderScriptCams(false).

Input and cursor

keyDown and keyUp carry Win32 virtual-key codes. Track pressed state to avoid toggling an interface repeatedly from key repeat. Coordinate cursor visibility with browser focus and hide it on every close path.

Storage

Client storage is namespaced to the current server and accepts JSON-compatible values. getItem returns null for both a missing key and a stored null; use hasItem when that distinction matters.

Treat storage as a local preference cache. The client can edit it, so balances, permissions, inventory, and progression must remain server-side.

VIMP developer documentation