Player:openUIView(playerid ,uiid)
API description The main function of this method: open a UI interface for Player
Parameters | Types | Info |
---|---|---|
playerid | number | player ID |
uiid | string | the ID of interface |
Return | value | type |
---|---|---|
Error Code 0 is Success | 0 or 1001 | number |
--When a player enters the game, execute this function local function player_enter(event) local uin=event.eventobjid--The mini account of the player entering the game local uiid="6986982063319417057"--The interface id to be opened, replace your UIid here Player:openUIView(uin,uiid)--Open the interface for the player end -- Register Event for Game.AnyPlayer.EnterGame ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.EnterGame]=],player_enter)
This Lua code executes when any player enters the game, opening a specific UI interface for them.
local function player_enter(event)
* Declares a function named player_enter that triggers when the event occurs * The event parameter contains game event data
local uin=event.eventobjid
* Extracts the player's account identifier from the event object * uin stores which player entered the game
local uiid="6986982063319417057"
* Defines the interface ID of the UI to display * Important: Replace this with your actual UI ID (placeholder shown)
Player:openUIView(uin,uiid)
* Calls the game's Player API to display a UI to the specific player * Parameters:
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.EnterGame]=],player_enter)
* Registers the player_enter function to handle Game.AnyPlayer.EnterGame events * Event details:
Key concepts demonstrated:
Result: Every player sees your specified UI when joining the game.
Remember to: