MRI Qbox BrasilMRI Qbox
OverextendedOx LibModulesPointsJavaScript

Cliente

Points

Verificação de distância simples e centralizada, com suporte a callbacks ao entrar, sair e permanecer no alcance de coordenadas definidas.

Point<T>({ coords, distance, onEnter, onExit, nearby, args });
  • coords: number[]
  • distance: number
  • onEnter?: function
  • onExit?: function
  • nearby?: function
  • args?: T
import { Point, cache } from "@overextended/ox_lib/client";

function nearby(this: Point<{ dunak: string }>) {
  // @ts-ignore
  DrawMarker(
    2,
    this.coords.x,
    this.coords.y,
    this.coords.z,
    0,
    0,
    0,
    0,
    180,
    0,
    1,
    1,
    1,
    200,
    20,
    20,
    50,
    false,
    true,
    2,
    false,
    null,
    null,
    false,
  );

  if (this.currentDistance && this.currentDistance < 1 && IsControlJustReleased(0, 38)) {
    console.log("Dentro do marker", this.id);
    console.log(this.args?.dunak);
  }
}

const point = new Point({
  coords: GetEntityCoords(cache.ped, false),
  distance: 5,
  nearby: nearby,
  args: {
    dunak: "nerd",
  },
});

point.onEnter = () => {
  console.log("Entrou no alcance do ponto", point.id);
};

point.onExit = () => {
  console.log("Saiu do alcance do ponto", point.id);
};

On this page

Usamos cookies para anúncios e métricas. Veja a política de privacidade.