OnPlayerInteract
A player pressed the use key on an interaction point or a prop with a prompt.
Fires for an interaction point or a prop with a prompt when a player in its world, within reach, presses the use key while the game shows its hint. Nothing else happens by itself: what the use does is yours to write.
Syntax
Section titled “Syntax”function OnPlayerInteract(pid, id) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
id |
number | the point’s or the prop’s entity id |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”local board = CreateInteraction(1281.5, 1096.2, 27.1, "Read the notices")function OnPlayerInteract(pid, id) if id == board then ShowPlayerDialogue(pid, 1, "Notice board", "Wanted: a smith's apprentice. Ask at the forge.", {"Close"}) endendSee also
Section titled “See also”CreateInteraction · SetEntityPrompt · OnPlayerInteractActor · OnPlayerInteractDoor · the Props group of the index
