Skip to content

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.

function OnPlayerInteract(pid, id)
-- ...
end
Parameter Type
pid number the player
id number the point’s or the prop’s entity id

nothing

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"})
end
end

CreateInteraction · SetEntityPrompt · OnPlayerInteractActor · OnPlayerInteractDoor · the Props group of the index