Object-oriented library for UI prompts in RedM.
- Simplified prompt creation with the
Uiprompt
andUipromptGroup
classes - Callbacks for prompt events such as
onControlJustPressed
andonHoldModeJustCompleted
- Automatic cleanup of prompts
- Create a folder called
uiprompt
in your resources directory. - Copy
fxmanifest.lua
anduiprompt.lua
to this folder. - Add
start uiprompt
toserver.cfg
.
In any resources where you want to use this library, add @uiprompt/uiprompt.lua
as a client script in fxmanifest.lua
:
fx_version "cerulean"
game "rdr3"
rdr3_warning "I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships."
client_scripts {
"@uiprompt/uiprompt.lua",
"client.lua"
}
local promptGroup = UipromptGroup:new("Test")
local prompt1 = Uiprompt:new(`INPUT_DYNAMIC_SCENARIO`, "Test 1", promptGroup)
prompt1:setHoldMode(true)
local prompt2 = Uiprompt:new(`INPUT_RELOAD`, "Test 2", promptGroup)
prompt2:setHoldMode(true)
promptGroup:setOnHoldModeJustCompleted(function(group, prompt)
TriggerEvent("chat:addMessage", {args={"You held " .. prompt:getText() .. "!"}})
end)
UipromptManager:startEventThread()
Further documentation and code examples are provided here: https://kibook.github.io/redm-uiprompt