Native Prompts
The "[G] Talk" bottom-right prompt every RedM player already knows. This wraps RedM's own UiPrompt* natives — engine-level, not framework-level. VORP and RSG don't matter here at all; it's identical on both.
CreatePrompt(text, controlAction?)client
Creates a native UI prompt.
| Param | Type | Description |
|---|---|---|
| text | string | Label shown next to the key, e.g. "Talk [G]". |
| controlAction | number | nil | Control hash. Defaults to G. |
| Returns | Type |
|---|---|
| prompt | number — the prompt handle |
SetPromptVisible(prompt, on)client
Shows or hides a prompt — toggles both enabled and visible together.
| Param | Type |
|---|---|
| prompt | number |
| on | boolean |
IsPromptCompleted(prompt)client
Whether the player has pressed/held the prompt's bound key.
| Param | Type | Returns |
|---|---|---|
| prompt | number | boolean |
DeletePrompt(prompt)client
Safely deletes a prompt handle. Always call this once you're done with a prompt — it leaks for the rest of the session otherwise.
Full pattern — proximity-gated prompt
This is the exact loop used throughout wc_encounter: create a prompt once, show/hide it as the player crosses a distance threshold, poll for completion, clean up when done.
client — talk to an NPC within 3.5m
local prompt = wc:CreatePrompt("Talk [G]")
local inRange = false
CreateThread(function()
while true do
Wait(inRange and 0 or 300)
local near = wc:IsPlayerNearCoords(npcCoords, 3.5)
if near and not inRange then
inRange = true
wc:SetPromptVisible(prompt, true)
elseif not near and inRange then
inRange = false
wc:SetPromptVisible(prompt, false)
end
if inRange and wc:IsPromptCompleted(prompt) then
wc:SetPromptVisible(prompt, false)
wc:DeletePrompt(prompt)
break
end
end
end)