🤠 Wild Country Libs
Client API

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.

ParamTypeDescription
textstringLabel shown next to the key, e.g. "Talk [G]".
controlActionnumber | nilControl hash. Defaults to G.
ReturnsType
promptnumber — the prompt handle
SetPromptVisible(prompt, on)client

Shows or hides a prompt — toggles both enabled and visible together.

ParamType
promptnumber
onboolean
IsPromptCompleted(prompt)client

Whether the player has pressed/held the prompt's bound key.

ParamTypeReturns
promptnumberboolean
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)