Oakwood
  • Introduction
  • Server Setup
  • Public API
    • Events
    • Player
    • Vehicle
    • HUD
    • Camera
    • Chat
    • Vehicle-Player
    • Miscellaneous
  • Languages
    • NodeJS
  • Server API
  • Assets
    • Asset: Vehicle Models
    • Asset: Player models
  • Tutorials
    • Build Your Own Language Support
      • 1. Overview
      • 2. Connection
      • 3. Native Calls
      • 4. Events
      • 5. Wrap-up
Powered by GitBook
On this page
  • Fadeout
  • Countdown
  • Announce
  • Message

Was this helpful?

  1. Public API

HUD

This page describes the HUD API

Fadeout

hudFadeout(player, int, int, int)

Fades the screen to a specified color with a duration.

Remarks

Has to be called twice to cause blink effect, see example.

Arguments

Type

Description

player

Player ID

int

0 for fadeout, 1 to fade in

int

Transition duration

int

Color to fade into / fade out from

Returns

0 if successful, -1 if failed

oak.event('playerConnect', async pid => {
    console.log('[info] player connected', pid)

    // Cause a white blink effect
    oak.hudFadeout(pid, 1, 0.5, 0xFFFFFF)
    oak.hudFadeout(pid, 0, 0.5, 0xFFFFFF)

    oak.playerPositionSet(pid, [-1774.59301758, -4.88487052917, -2.40491962433])
    oak.playerHealthSet(pid, 200)
    oak.playerSpawn(pid)
})

Countdown

hudCountdown(player, int)

Displays a race countdown number.

Remarks

Call it in interval to actually count numbers down.

Arguments

Type

Description

player

Player ID

int

Race countdown stage

int

Transition duration

int

Color to fade into / fade out from

Returns

0 if successful, -1 if failed

// TODO

Announce

hudAnnounce(player, string, int)

Displays a splash/alert message in the centre of the screen.

Remarks

Arguments

Type

Description

player

Player ID

string

Text to display

int

Duration

Returns

0 if successful, -1 if failed

// TODO

Message

hudMessage(player, string, int)

Displays a message in the left bottom corner of the screen.

Remarks

Arguments

Type

Description

player

Player ID

string

Text to display

int

Color (RGBA)

Returns

0 if successful, -1 if failed

// TODO
PreviousVehicleNextCamera

Last updated 5 years ago

Was this helpful?