isMainMenuActive | Multi Theft Auto: Wiki Skip to content

isMainMenuActive

Client-side
Server-side
Shared

This function returns whether the user is in the mainmenu or not.

OOP Syntax Help! I don't understand this!

  • Method:GuiElement.isMainMenuActive(...)
  • Variable: .mainMenuActive

Syntax

bool isMainMenuActive ( )

Returns

Returns true if the mainmenu is visible, false if not.

  • bool: result

Code Examples

client

This example counts how many seconds you have the menu open and displays the result after it is closed.

local lastStatus = false
local seconds = 0
setTimer(function()
local currentStatus = isMainMenuActive()
if (currentStatus and not lastStatus) then
seconds = 0
end
if (currentStatus) then
seconds = seconds + 1
end
if (not currentStatus and lastStatus) then
outputChatBox('You were in the menu for '..seconds..' seconds')
end
lastStatus = currentStatus
end, 1000, 0)

See Also

GUI Functions