Render(JS) Tick(CSharp)

From RAGE Multiplayer Wiki
(Redirected from Render)

Client-Side Event

 C#  JavaScript


C# Server-Side: OnUpdate

C# Syntax

This event is invoked every tick on the client-side

public delegate void TickDelegate(List<TickNametagData> nametags);

Parameters

  • nametags nametags, expects List<Events.TickNametagData> type.

Example

The below example sends the players position in chat everytime the Tick event is invoked

Events.Tick += Tick;
public void Tick(List<Events.TickNametagData> nametags)
{
    Vector3 position = nametags.Find(n => n.Player.IsLocal == true).Player.Position;
    RAGE.Chat.Output($"You are at X[{position.X}] Y[{position.Y}] Z[{position.Z}]");
}


JavaScript Syntax

This event is invoked every frame on client-side, it is not accessible on the server. It is similar to the OnUpdate in C# server-side Code where the function/event is called every tick on the server.

Parameters

  • nametags (Optional)

Example

mp.events.add('render', () => {
    mp.game.graphics.drawText('This is called every frame.', [0.5, 0.005], {
      font: 4,
      color: [255, 255, 255, 255],
      scale: [1.0, 1.0],
      outline: true
    });
});


See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint