NativeHub
All NativesModelsArtifactsCFXVehicle

Not affiliated with Rockstar Games or Take-Two Interactive. FiveM and Cfx.re are trademarks of their respective owners. cfxnatives.dev is an independent community project.

Maintained by uz-scripts

© 2026 cfxnatives.dev

contact@cfxnatives.dev
HUDClient
Artifact25963
Data sourced from jgscripts artifact-db

SetWarningMessage

Docs
SetWarningMessage(entryLine1, instructionalKey, entryLine2, p3, p4, background, p6, showBg, errorCode)

Description

enum eInstructionalButtonTypes
{
    NONE = 0,
    SELECT = 1,
    OK = 2,
    YES = 4,
    BACK = 8,
    BACK_SELECT = 9,
    BACK_OK = 10,
    BACK_YES = 12,
    CANCEL = 16,
    CANCEL_SELECT = 17,
    CANCEL_OK = 18,
    CANCEL_YES = 20,
    NO = 32,
    NO_SELECT = 33,
    NO_OK = 34,
    YES_NO = 36,
    RETRY = 64,
    RETRY_SELECT = 65,
    RETRY_OK = 66,
    RETRY_YES = 68,
    RETRY_BACK = 72,
    RETRY_BACK_SELECT = 73,
    RETRY_BACK_OK = 74,
    RETRY_BACK_YES = 76,
    RETRY_CANCEL = 80,
    RETRY_CANCEL_SELECT = 81,
    RETRY_CANCEL_OK = 82,
    RETRY_CANCEL_YES = 84,
    SKIP = 256,
    SKIP_SELECT = 257,
    SKIP_OK = 258,
    SKIP_YES = 260,
    SKIP_BACK = 264,
    SKIP_BACK_SELECT = 265,
    SKIP_BACK_OK = 266,
    SKIP_BACK_YES = 268,
    SKIP_CANCEL = 272,
    SKIP_CANCEL_SELECT = 273,
    SKIP_CANCEL_OK = 274,
    SKIP_CANCEL_YES = 276,
    CONTINUE = 16384,
    BACK_CONTINUE = 16392,
    CANCEL_CONTINUE = 16400,
    LOADING_SPINNER = 134217728,
    SELECT_LOADING_SPINNER = 134217729,
    OK_LOADING_SPINNER = 134217730,
    YES_LOADING_SPINNER = 134217732,
    BACK_LOADING_SPINNER = 134217736,
    BACK_SELECT_LOADING_SPINNER = 134217737,
    BACK_OK_LOADING_SPINNER = 134217738,
    BACK_YES_LOADING_SPINNER = 134217740,
    CANCEL_LOADING_SPINNER = 134217744,
    CANCEL_SELECT_LOADING_SPINNER = 134217745,
    CANCEL_OK_LOADING_SPINNER = 134217746,
    CANCEL_YES_LOADING_SPINNER = 134217748
}

Note: this list is definitely NOT complete, but these are the ones I've been able to find before giving up because it's such a boring thing to look for 'good' combinations.

Result of the example code:
<https://i.imgur.com/imwoimm.png>

Parameters

NameTypeDescription
entryLine1char*The text label to display as the first line of the warning message.
instructionalKeyintThis is an enum, check the description for a list.
entryLine2char*The text label to display as the second line of the warning message.
p3BOOLPurpose unknown.
p4intPurpose unknown.
backgroundchar*Set to anything other than 0 or false (even any string) and it will draw a background. Setting it to 0 or false will draw no background.
p6char*Purpose unknown.
showBgBOOLPurpose unknown.
errorCodeintWhen not 0, adds a field displaying the value as 'error code' to the warning message.

Returns

void

This native does not return a value.

Examples

Official
-- Make the first line using custom text.
AddTextEntry("warning_message_first_line", "This is the first line.")

-- Make the second line using custom text.
AddTextEntry("warning_message_second_line", "This is the second line!")

-- Add an event handler for when the screen is dismissed.
AddEventHandler("optionSelected", function(selected)
    print(selected) -- do whatever you want with the selected choice.
    -- players can either press the physicial buttons, or they can click
    -- the instructional buttons with their mouse and it will trigger
    -- the event as well.
end)


-- Create a thread to loop this warning message.
CreateThread(function()
    while true do
        Wait(0)
        -- Display the warning message every tick.
        SetWarningMessage("warning_message_first_line", 82, "warning_message_second_line", 0, -1, true, 0, 0, 0)
        
        -- Check for key presses or instructional button clicks.
        -- Input group of 2 is required for this to work while the warning is being displayed.
        
        if (IsControlJustReleased(2, 201) or IsControlJustReleased(2, 217)) then -- any select/confirm key was pressed.
            TriggerEvent("optionSelected", "select")
            break
        elseif (IsControlJustReleased(2, 203)) then -- spacebar/x on controller (alt option) was pressed.
            TriggerEvent("optionSelected", "alt")
            break
        elseif (IsControlJustReleased(2, 202)) then -- any of the cancel/back buttons was pressed
            TriggerEvent("optionSelected", "cancel")
            break
        end
    end
end)

Server Artifacts

Data sourced from jgscripts artifact-db
Recommended25963
Known Issues24
25987-25988Node.js sandboxing seems to be causing issues for people - best to avoid for now
21547Multiple (unconfirmed) reports of server-sided natives throwing errors or causing crashes; best to avoid
17462Failed build, ignore
16276Multiple reports of issues loading JS within resources
14583-14716Crash when using the new onEntityBucketChange
14583-14862Timeouts due to latency units being in nanoseconds
13759-13890Mumble (voice) external connections blocked by default
13380-13458Server crashing due to integer encoding (PR#3235)
13079Failed Linux build (works OK if using Windows!)
12933-13045Still crashes (sometimes) when restarting resources due to Node.js 22
12913-12932Causes a crash when restarting Node.js 22
12767os.date() appends null terminator; can break Lua scripts
12651Failed Linux build, ignore
12509Failed build, ignore
12255Unconfirmed, but several reports of server-side issues that don't persist when downgrading; best to avoid
12160-12165Cannot use entity native calls in entityRemoved
12151Crashing if using newest title update (TU)
12092-12135SetPlayerModel may cause SIGSEGV crashes on some clients due to changes in player handling. 12031 and below works fine.
12078-12083Some clients will fail to connect with 'ReadBulk of header failed' error
10930Failed build, ignore
10268-10309sv_experimentalNetGameEventHandler enabled by default; can cause server crashing and reports of issues downgrading after upgrading
10191GetVehicleNumberPlateText server native broken, will cause issues with scripts involving vehicles
10072Crashing when players join
8509State bags not replicated to clients

CommunitySnippets

No snippets yet. Be the first to contribute!