OnPlayerInteractActor
The player pressed the use key on an actor that has a prompt - return false to stop its shop opening.
Fires for an actor with a prompt (a shop gives it “Trade”) when a player within
3.5 m, facing it, presses the use key. An actor with a shop then opens it on the player unless the callback returns
false; an actor with a prompt of the mode’s own does nothing but call this - a talk, a quest, a guard’s challenge
are the mode’s to write here.
Syntax
Section titled “Syntax”function OnPlayerInteractActor(pid, id) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
id |
number | the actor |
Returns
Section titled “Returns”false stops the actor’s shop from opening; anything else lets it
Example
Section titled “Example”function OnPlayerInteractActor(pid, id) if GetEntityData(id, "role") == "guard" then SendClientMessage(pid, COLOR_WHITE, GetEntityName(id) .. " says: Move along.") elseif GetEntityData(id, "role") == "merchant" and not GetPlayerData(pid, "member") then SendClientMessage(pid, COLOR_RED, "The guild's store is for members.") return false endendSee also
Section titled “See also”SetActorPrompt · SetActorShop · OpenShop · CreateActor · the NPC actors group of the index
