~~NOTOC~~ ====== hideUIView ====== [[developer_center:developer_editor:script:ui_event|From Customui Class]] Player:hideUIView(playerid, uiid) API Description The main function of this method: hide a UI interface for a player. ^ Parameters ^ Types ^ Info ^ | playerid | number | Player ID | | uiid | string | The ID of the interface to hide | ^ Return Value ^ Type | | ErrorCode.OK (0) | number | ==== Examples ==== -- When a player clicks a block, execute this function local function clickblock(event) local uin = event.eventobjid -- The player ID who clicked the block local uiid = "6986982063319417057" -- Replace with your actual UI ID Player:hideUIView(uin, uiid) -- Hide the interface for the player end -- Register event for Player.ClickBlock ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], clickblock) ==== Lua Code Explanation: Click Block Event Handler ==== This Lua code triggers when a player clicks a block, hiding a specified UI interface. === Function Definition === local function clickblock(event) Declares a function named clickblock for the Player.ClickBlock event. event parameter contains game event data. === Getting Player ID === local uin = event.eventobjid Extracts the player’s account ID from the event object. === UI Configuration === local uiid = "6986982063319417057" Defines the interface ID to hide. **Important:** Replace this placeholder with your actual UI ID. === Hiding the Interface === Player:hideUIView(uin, uiid) Calls the Player API to hide the UI for the target player. Parameters: * uin → Player’s account ID. * uiid → Interface ID to hide. === Event Registration === ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], clickblock) Binds the clickblock function to the Player.ClickBlock event. === Educational Notes === Key concepts demonstrated: * Player interaction events (block clicks). * UI management (hiding interfaces dynamically). * Event-driven scripting in Lua. **Result:** The specified UI hides when a player clicks any block. === Important Note === Remember to: * Replace "6986982063319417057" with your real UI ID. * Ensure the UI was previously opened (e.g., via [[script:ui_event:openuiview|openUIView]]).