Options
All
  • Public
  • Public/Protected
  • All
Menu

Class with common world manipulations.

This class includes methods for creating entities and common world rendering.

You can create blips, entities, cameras and more.

abstract

Hierarchy

  • World

Index

Constructors

constructor

Properties

Static Private cloudHatDict

cloudHatDict: Map<CloudHat, string> = ...

Static Private currentCloudHat

currentCloudHat: CloudHat = CloudHat.Clear

Static Private weatherDict

weatherDict: string[] = ...

Accessors

Static Blackout

  • set Blackout(value: boolean): void
  • Disables all emissive textures, street/building/vehicle lights. "EMP" effect.

    Parameters

    • value: boolean

      On or off.

    Returns void

Static CloudHat

  • Get the current cloud hat.

    Returns CloudHat

    The current cloud hat type.

  • Set the current cloud hat.

    Parameters

    Returns void

    The current cloud hat type.

Static CloudHatOpacity

  • get CloudHatOpacity(): number
  • set CloudHatOpacity(value: number): void
  • Get the opacity of current cloud hat. Value is between 0-1.

    Returns number

    The current cloud opacity between 0.0 and 1.0

  • Set opacity of current cloud hat between 0-1.

    Parameters

    • value: number

      Opacity between 0.0 and 1.0

    Returns void

    The current cloud opacity between 0.0 and 1.0

Static CurrentDate

  • get CurrentDate(): Date
  • set CurrentDate(date: Date): void
  • Get the current date in the world.

    Returns Date

    The current date.

  • Set the current date of the world.

    Parameters

    • date: Date

    Returns void

    The current date.

Static NextWeather

  • Get the next weather type.

    Returns Weather

    The Weather type

  • Set weather type instantly. Similar to World.transitionToWeather with duration 0.

    Parameters

    Returns void

    The Weather type

Static RenderingCamera

  • get RenderingCamera(): Camera
  • set RenderingCamera(value: null | Camera): void
  • Get the current camera that's rendering.

    Returns Camera

    The camera that's currently used.

  • Set the rendering camera. World.RenderingCamera = null to reset.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const myCamera = World.createCamera(position, new Vector3(0,0,0), 180);
    World.RenderingCamera = myCamera;

    // Reset to default cam
    World.RenderingCamera = null;

    Parameters

    • value: null | Camera

      The camera to render.

    Returns void

    The camera that's currently used.

Static Weather

  • Get the current weather type.

    Returns Weather

    The current type of weather.

  • Set the current weather.

    Parameters

    • value: Weather

      Type of weather to set.

    Returns void

    The current type of weather.

Static WeatherTransition

  • get WeatherTransition(): [string | Weather, string | Weather, number]
  • set WeatherTransition(transition: [string | Weather, string | Weather, number]): void

Methods

Static CreateAmbientPickup

  • CreateAmbientPickup(type: PickupType, position: Vector3, model: Model, value: number): Promise<null | Prop>
  • Creates an ambient pickup.

    Parameters

    • type: PickupType

      The [[PickupType]] of the pickup.

    • position: Vector3

      The position where it should be spawned.

    • model: Model

      The model.

    • value: number

      The value tied to the pickup.

    Returns Promise<null | Prop>

    The pickup in form of a Prop.

Static CreatePickup

  • Create a pickup in a specific position in the world with a specified type and value.

    Parameters

    • type: PickupType

      The [[PickupType]] of pickup.

    • position: Vector3

      The position in the world it should be spawned.

    • model: Model

      The model of the spawned pickup.

    • value: number

      Give a value for the pickup when picked up.

    • Optional rotation: Vector3

      If set, create a rotating pickup with this rotation.

    Returns Promise<null | Pickup>

    Pickup object.

Static createBlip

  • Creates a blip at a given position and optionally radius.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const myStoreBlip = World.createBlip(position, 5.0);
    myStoreBlip.Sprite = BlipSprite.Store;

    Parameters

    • position: Vector3

      World coordinate of blip.

    • Optional radius: number

      (Optional) Radius of where blip should be shown.

    Returns Blip

    Blip object.

Static createCamera

  • createCamera(cameraType?: CameraTypes, active?: boolean): Camera
  • Creates a cam that defaults to {@link CameraTypes.Scripted}

    const cam = World.createCamera(CameraTypes.Spline, true);
    

    Parameters

    • cameraType: CameraTypes = CameraTypes.Scripted
    • active: boolean = true

      unknown

    Returns Camera

Static createCameraWithParams

  • createCameraWithParams(cameraType?: CameraTypes, position: Vector3, rotation: Vector3, fieldOfView: number): Camera
  • Creates a camera using 'DEFAULT_SCRIPTED_CAMERA'.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const myCamera = World.createCameraWithParams(position, new Vector3(0,0,0), 180);

    Parameters

    • cameraType: CameraTypes = CameraTypes.Scripted
    • position: Vector3

      World coordinate where the camera should render.

    • rotation: Vector3

      Rotation of camera relative to world.

    • fieldOfView: number

      Field of view angle of camera.

    Returns Camera

    Camera object.

Static createPed

  • createPed(model: Model, position: Vector3, heading?: number, isNetwork?: boolean): Promise<null | Ped>
  • Create a ped at a desired location.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const model = new Model("a_f_m_beach_01");
    const myPed = await World.createPed(model, position);

    Parameters

    • model: Model

      Ped model to be spawned.

    • position: Vector3

      World position (coordinates) of Ped spawn.

    • heading: number = 0

      Heading of Ped when spawning.

    • isNetwork: boolean = true

    Returns Promise<null | Ped>

    Ped object.

Static createProp

  • createProp(model: Model, position: Vector3, dynamic: boolean, placeOnGround: boolean, isNetwork?: boolean): Promise<null | Prop>
  • Spawns a Prop at the given position.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const model = new Model("prop_barrel_02a");
    const myBarrelProp = await World.createProp(model, position, false, true);

    Parameters

    • model: Model

      The Model to spawn (must be a Prop)

    • position: Vector3

      Location of Prop

    • dynamic: boolean

      If set to true, the Prop will have physics otherwise it's static.

    • placeOnGround: boolean

      If set to true, sets the Prop on the ground nearest to position.

    • isNetwork: boolean = true

    Returns Promise<null | Prop>

    Prop object.

Static createRandomPed

  • Creates a Ped with a random model.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const randomPed = World.createRandomPed(position);

    Parameters

    • position: Vector3

      World coordinate of Ped spawn.

    Returns Ped

    Ped object.

Static createRandomVehicle

  • createRandomVehicle(position: Vector3, heading?: number, isNetwork?: boolean): Promise<null | Vehicle>
  • Create a random vehicle at a desired location.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const randomVehicle = await World.createRandomVehicle(position);

    Parameters

    • position: Vector3

      World position (coordinates) of Vehicle spawn.

    • heading: number = 0

      Heading of Vehicle when spawning.

    • isNetwork: boolean = true

    Returns Promise<null | Vehicle>

    Vehicle object.

Static createVehicle

  • createVehicle(model: Model, position: Vector3, heading?: number, isNetwork?: boolean): Promise<null | Vehicle>
  • Create a vehicle at a desired location.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const model = new Model("adder");
    const myVehicle = await World.createVehicle(model, position);

    Parameters

    • model: Model

      Vehicle model to be spawned.

    • position: Vector3

      World position (coordinates) of Vehicle spawn.

    • heading: number = 0

      Heading of Vehicle when spawning.

    • isNetwork: boolean = true

    Returns Promise<null | Vehicle>

    Vehicle object.

Static destroyAllCameras

  • destroyAllCameras(): void
  • Destroys all existing cameras and sets your rendering camera back to GameplayCam.

    Returns void

Static drawLightWithRange

  • drawLightWithRange(pos: Vector3, color: Color, range: number, intensity: number): void
  • Creates a light in the world with a certain length (range).

    Parameters

    • pos: Vector3

      World coordinate where to draw the light.

    • color: Color

      RGB colors of the light.

    • range: number

      How far to draw the light.

    • intensity: number

      Intensity of the light ("alpha").

    Returns void

Static drawLine

  • Draws a line in the world. It's not possible to change thickness.

    Parameters

    • start: Vector3

      World coordinate of start position of line.

    • end: Vector3

      World coordinate of end position of line.

    • color: Color

      RGB color of line.

    Returns void

Static drawMarker

  • drawMarker(type: MarkerType, position: Vector3, direction: Vector3, rotation: Vector3, scale: Vector3, color: Color, bobUpAndDown?: boolean, faceCamera?: boolean, rotateY?: boolean, textureDict?: null | string, textureName?: null | string, drawOnEntity?: boolean): void
  • Draw a marker at a desired location. Careful! Must be drawn every tick.

    const position = new Vector3(-802.311, 175.056, 72.8446);
    const zeroVector = new Vector3(0,0,0);

    setTick(() => {
    World.drawMarker(MarkerType.ThickChevronUp, position, zeroVector, zeroVector, 1.0, new Color(255,0,0));
    })

    Parameters

    • type: MarkerType

      Type of marker.

    • position: Vector3

      Location of marker.

    • direction: Vector3

      Direction facing.

    • rotation: Vector3

      World rotation.

    • scale: Vector3

      Size of marker.

    • color: Color

      Color of marker.

    • bobUpAndDown: boolean = false

      Animated movement along marker's own X axis.

    • faceCamera: boolean = false

      Rendering marker facing rendering camera.

    • rotateY: boolean = false

      Rotate along Y axis.

    • textureDict: null | string = null

      Custom texture dictionary for custom marker.

    • textureName: null | string = null

      Custom texture name for custom marker.

    • drawOnEntity: boolean = false

      Render the marker on an entity.

    Returns void

Static drawPoly

  • Draw polygon in the world.

    Parameters

    • vertexA: Vector3

      World coordinate of first point.

    • vertexB: Vector3

      World coordinate of second point.

    • vertexC: Vector3

      World coordinate of third point.

    • color: Color

      RGB color of polygon.

    Returns void

Static drawSpotLight

  • drawSpotLight(pos: Vector3, dir: Vector3, color: Color, distance: number, brightness: number, roundness: number, radius: number, fadeOut: number): void
  • Creates a light in the world. More configurable than World.drawLightWithRange.

    Parameters

    • pos: Vector3

      World coordinate of spotlight.

    • dir: Vector3

      Direction to face spotlight.

    • color: Color

      RGB colors of spotlight.

    • distance: number

      The maximum distance the spotlight can reach.

    • brightness: number

      Brightness of the spotlight.

    • roundness: number

      "Smoothness" of the edge of the spotlight.

    • radius: number

      Radius size of spotlight.

    • fadeOut: number

      Falloff size of the spotlight's edge.

    Returns void

Static drawSpotLightWithShadow

  • drawSpotLightWithShadow(pos: Vector3, dir: Vector3, color: Color, distance: number, brightness: number, roundness: number, radius: number, fadeOut: number): void
  • Creates a light in the world. Same as World.drawSpotlight, but also draws shadows.

    Parameters

    • pos: Vector3

      World coordinate of spotlight.

    • dir: Vector3

      Direction to face spotlight.

    • color: Color

      RGB colors of spotlight.

    • distance: number

      The maximum distance the spotlight can reach.

    • brightness: number

      Brightness of the spotlight.

    • roundness: number

      "Smoothness" of the edge of the spotlight.

    • radius: number

      Radius size of spotlight.

    • fadeOut: number

      Falloff size of the spotlight's edge.

    Returns void

Static getAllPeds

  • getAllPeds(): Ped[]

Static getAllPedsInGamePool

  • getAllPedsInGamePool(): Ped[]

Static getAllPickups

Static getAllPickupsInGamePool

  • getAllPickupsInGamePool(): Pickup[]

Static getAllProps

  • getAllProps(): Prop[]

Static getAllPropsInGamePool

  • getAllPropsInGamePool(): Prop[]

Static getAllVehicles

Static getAllVehiclesInGamePool

  • getAllVehiclesInGamePool(): Vehicle[]

Static getClosestObject

  • getClosestObject(model: Model, coords: Vector3, radius?: number, isMission?: boolean): null | Prop
  • Gets the closest object of this model

    Parameters

    • model: Model
    • coords: Vector3
    • radius: number = 25.0
    • isMission: boolean = false

    Returns null | Prop

Static getClosestVehicle

  • Gets the cloest Vehicle to the current coords, or null if none are found

    Parameters

    Returns null | Vehicle

    the closest vehicle or null

Static raycast

  • Cast ("shoot") a ray in a certain direction to detect entities in the way.

    Parameters

    • source: Vector3

      Starting position of raycast.

    • direction: Vector3

      Direction to cast a ray to.

    • maxDistance: number

      Max distance to cast the ray.

    • options: IntersectOptions

      Possible entity types to detect.

    • ignoreEntity: Entity

      An entity to ignore (usually player's Ped).

    Returns RaycastResult

    RaycastResult object.

Static transitionToWeather

  • transitionToWeather(weather: Weather, duration: number): void
  • Transition to different weather type within a certain time.

    Parameters

    • weather: Weather

      Weather type to change to.

    • duration: number

      Time for full weather change (in milliseconds);

    Returns void

Generated using TypeDoc