Skip to content

interactionStarted

Tells your gamemode that a player started using something after playerStartInteractionRequest allowed it. The use is now in interactions.listAll. The game has already charged the money and given the health; do not give them again here.

server.on("interactionStarted", ({ interaction }) => void)
Name Type Description
interaction Interaction The use.

Your own interactive object gives $50.

gamemodes/my-mode.ts
import { players, server } from "nativemp";
let cashMachine = 0; // the ID objects.create returned
server.on("interactionStarted", ({ interaction }) => {
if (interaction.interactionKind === "script-object" && interaction.objectId === cashMachine) {
void players.giveMoney(interaction.playerId, 50);
}
});