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.
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 |
Shows or hides a prompt — toggles both enabled and visible together.
| Param | Type |
|---|---|
| prompt | number |
| on | boolean |
Whether the player has pressed/held the prompt's bound key.
| Param | Type | Returns |
|---|---|---|
| prompt | number | boolean |
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.
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)
Real Wild County example — stagecoach clerk ticket prompt
local prompt = wc:CreatePrompt("Buy Ticket [G]")
wc:WatchPrompt(prompt, clerkPed, 2.5, function()
wc:DeletePrompt(prompt)
TriggerServerEvent('wc_stagecoach:buyTicket')
end)
For simple one-off cases, WatchPrompt already wraps the loop above — reach for it first, and only hand-roll the raw prompt loop when you need control the wrapper doesn't expose.
Common mistakes
- Never calling
DeletePrompt— the prompt handle leaks for the rest of the client session. Always delete it once you're done, especially in a loop that creates prompts repeatedly (e.g. per-NPC). - Leaving a prompt visible after the interaction completes — call
SetPromptVisible(prompt, false)before deleting. - Polling
IsPromptCompletedatWait(0)every frame regardless of range — throttle to a slower tick (e.g. 250-300ms) while out of range, like the pattern above, to avoid unnecessary work. - Creating a fresh prompt every tick instead of once —
CreatePromptshould run once per interaction point, not inside your polling loop.
Troubleshooting
- If the prompt never appears: confirm
SetPromptVisible(prompt, true)is actually being called — prompts are invisible and disabled by default until you show them. - If
IsPromptCompletednever returns true: check you're not accidentally re-creating the prompt handle every frame, which resets its internal completion state. - If prompts pile up in the corner over a session: you're missing
DeletePromptcalls somewhere — audit every code path that creates one.