RenderTargetSurface
Defined in: client/api.d.ts:770
An offscreen surface registered with the engine’s texture registry. Pass its name to Material.setTexture to make any world material draw it.
Methods
Section titled “Methods”captureScreen()
Section titled “captureScreen()”captureScreen():
boolean
Defined in: client/api.d.ts:826
Copies the frame the game is about to show into the target, before any M2O overlay is composited onto it. This is the security-camera-showing-your-own-view effect.
Returns
Section titled “Returns”boolean
clear()
Section titled “clear()”clear(
color?):boolean
Defined in: client/api.d.ts:821
Wipes the target.
Parameters
Section titled “Parameters”color?
Section titled “color?”The colour to wipe with; transparent by default.
Returns
Section titled “Returns”boolean
destroy()
Section titled “destroy()”destroy():
boolean
Defined in: client/api.d.ts:855
Releases this handle. Clear any material sampler still bound to its name first, because the surface goes back to a pool and may be handed to another target.
Returns
Section titled “Returns”boolean
draw()
Section titled “draw()”draw(
commands,options?):boolean
Defined in: client/api.d.ts:815
Replaces the target’s contents. The painting itself happens on the next frame, so calling this every tick is what animates a screen.
Parameters
Section titled “Parameters”commands
Section titled “commands”The frame to draw; it replaces whatever the target showed.
options?
Section titled “options?”Returns
Section titled “Returns”boolean
drawModel()
Section titled “drawModel()”drawModel(
options):boolean
Defined in: client/api.d.ts:838
Experimental. Shows one model alone, lit by the world, in an opaque target (create it with { alpha: false }). Returns false while the model streams in, so call it every tick; changing rotation between calls turns it. stopWorld removes it.
Parameters
Section titled “Parameters”options
Section titled “options”model is the registry name used by Vehicle.spawn, setModel or Prop.create; rotation is Euler angles in radians; pitch and fov are degrees.
distance?
Section titled “distance?”number
number
"vehicle" | "ped" | "prop"
string
pitch?
Section titled “pitch?”number
rotation?
Section titled “rotation?”Returns
Section titled “Returns”boolean
probePixel()
Section titled “probePixel()”probePixel(
x,y):boolean
Defined in: client/api.d.ts:850
Asks for one pixel to be read back to the CPU. The copy runs on the next present, so read it with probedPixel a frame later. Combined with captureScreen this is how a script inspects what the game actually drew.
Parameters
Section titled “Parameters”number
Pixel column inside the target.
number
Pixel row inside the target.
Returns
Section titled “Returns”boolean
renderWorld()
Section titled “renderWorld()”renderWorld(
options?):boolean
Defined in: client/api.d.ts:832
Experimental. Renders the game world into an opaque target (create it with { alpha: false }) through a second engine render destination until stopWorld. Returns false until the target is ready and on the call that creates the view, so call it every tick; that is also how the view moves.
Parameters
Section titled “Parameters”options?
Section titled “options?”Without position and target the view copies the gameplay camera.
number
position?
Section titled “position?”target?
Section titled “target?”Returns
Section titled “Returns”boolean
stopWorld()
Section titled “stopWorld()”stopWorld():
boolean
Defined in: client/api.d.ts:843
Experimental. Detaches the view started by renderWorld or drawModel and removes any model it showed.
Returns
Section titled “Returns”boolean
Properties
Section titled “Properties”destroyed
Section titled “destroyed”
readonlydestroyed:boolean
Defined in: client/api.d.ts:804
Whether this handle is no longer valid.
height
Section titled “height”
readonlyheight:number
Defined in: client/api.d.ts:784
Target height in pixels.
readonlyid:number
Defined in: client/api.d.ts:774
Opaque render target identifier.
readonlyname:bigint
Defined in: client/api.d.ts:789
The texture name a material sampler binds, for Material.setTexture.
readonlypath:string
Defined in: client/api.d.ts:794
The virtual-file-system style name the texture is registered under. Anything that takes a texture path rather than a name, such as a Render2D texture node, can bind the target through this.
probedPixel
Section titled “probedPixel”
readonlyprobedPixel:number|null
Defined in: client/api.d.ts:809
The last pixel read back by probePixel, packed as ARGB, or null if none has completed.
readonlyready:boolean
Defined in: client/api.d.ts:799
Whether the surface exists on the GPU yet. The engine creates it a frame or two after create, and it goes false again across an alt-tab.
readonlywidth:number
Defined in: client/api.d.ts:779
Target width in pixels.
