script:ui_event:showelement
showElement
Customui:showElement(playerid, uiid, elementid [, effectid, time])
effectid and time is Optional Parameter
API Description Makes a hidden UI component visible, optionally with animation.
Parameters | Types | Info | Default |
---|---|---|---|
playerid | number | Player ID | - |
uiid | string | Parent UI ID | - |
elementid | string | Component ID to show | - |
effectid | number | Animation type (optional) | 0 |
time | number | Animation duration in s(optional) | 0 |
Return Value | Type |
---|---|
ErrorCode.OK (0) | number |
Examples
- showElement_Example.lua
-- Basic usage (instant show) local function clickblock(event) local playerid = event.eventobjid local uiid = "6986982063319417057" -- Replace with your UI ID local elementid = "6986982063319417057_1" -- Replace with component ID -- Show component immediately Customui:showElement(playerid, uiid, elementid) end -- Advanced usage (with fade animation) local function showWithFade(event) local playerid = event.eventobjid Customui:showElement(playerid, "6986982063319417057", "6986982063319417057_1", 1, 500) -- 500ms fade end ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], clickblock)
Animation Effects
effectid | Animation Type |
---|---|
0 | Instant |
10001 | Fade In |
10002 | Zoom In |
10003 | Zoom Out |
Common Patterns
- toggleVisibily.lua
-- Toggle visibility local visible = false function toggleElement(playerid, uiid, elementid) if visible then Customui:hideElement(playerid, uiid, elementid) else Customui:showElement(playerid, uiid, elementid, 10001, 2) -- Fade in end visible = not visible end
- sequential_reveal.lua
-- Sequential reveal function showTutorial(playerid) Customui:showElement(playerid, tutorialUI, element1, 10001, 2) threadpool:delay(2,function() Customui:showElement(playerid, tutorialUI, element2, 10001, 2) end) end
script/ui_event/showelement.txt · Last modified: 2025/05/23 04:05 by hhuxx