Skip to content

interactions.getById

Returns the use with this ID, or undefined once it has ended.

Renamed in 0.28 from interactions.get; see renamed names.

interactions.getById(id: string): Interaction | undefined
Name Type Description
id string The use’s ID. It is a decimal string; keep it as a string, it can be larger than a JavaScript number holds exactly.

The Interaction, or undefined.

gamemodes/my-mode.ts
import { interactions, server } from "nativemp";
server.on("interactionStarted", ({ interaction }) => {
setTimeout(() => {
if (interactions.getById(interaction.id)) server.log(`player ${interaction.playerId} is still at it`);
}, 60_000);
});