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.
Signature
Section titled “Signature”server.on("interactionStarted", ({ interaction }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
interaction |
Interaction |
The use. |
Example
Section titled “Example”Your own interactive object gives $50.
import { players, server } from "nativemp";
let cashMachine = 0; // the ID objects.create returnedserver.on("interactionStarted", ({ interaction }) => { if (interaction.interactionKind === "script-object" && interaction.objectId === cashMachine) { void players.giveMoney(interaction.playerId, 50); }});Related
Section titled “Related”interactionEnded: the use endedplayerStartInteractionRequest: decide whether a player may use itinteractions.stop: end a use