SetPlayerPrompt
A use prompt over a player - “[E] Talk” under their name, and the use key on them reaches the mode.
Everyone else within 3.5 m of the player sees [E] text under their name, and pressing the use key on them fires
OnPlayerInteractPlayer. "" or nil takes it off. At most 32 characters, shown as written (a text that starts with
@ is a text key of the game’s own, shown in the player’s language). One viewer can be shown their own prompt
over the player instead (SetPlayerPromptFor). The game’s own use key on a player goes first: no prompt shows over a
player who lies knocked out or is carried, or to a player who crouches (the game’s pickpocket).
With hidden set, nothing is drawn over the player’s head: the use key on them still fires OnPlayerInteractPlayer,
and the game’s own key hint in the corner of the screen still shows text, as it does for a person in single player.
Each call sets both the text and whether it is hidden.
Syntax
Section titled “Syntax”SetPlayerPrompt(pid, text, hidden)| Parameter | Type | |
|---|---|---|
pid |
number | the player the prompt hangs over |
text |
string | nil | the word; "" / nil = none |
hidden |
boolean | nil | true = no [E] text line over the head, the use key still works; false / nil = shown (default) |
Returns
Section titled “Returns”boolean - false when not connected
Example
Section titled “Example”-- every player can be talked tofunction OnPlayerSpawn(pid) SetPlayerPrompt(pid, "Talk") end
-- the use key on any player opens the mode's own menu, with nothing drawn over their headsfunction OnPlayerSpawn(pid) SetPlayerPrompt(pid, "Actions", true) endfunction OnPlayerInteractPlayer(pid, target) openPersonMenu(pid, target) endSee also
Section titled “See also”GetPlayerPrompt · IsPlayerPromptHidden · SetPlayerPromptFor · OnPlayerInteractPlayer · SetActorPrompt · the Players group of the index
