IsMTAWindowActive: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client function}} {{Needs checking|This function includes debug window?}} This function returns whether the any system windows that take focus are active. This includes the ch...)
 
mNo edit summary
 
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
{{Needs checking|This function includes debug window?}}
This function returns whether any system windows that take focus are active. This includes:
This function returns whether the any system windows that take focus are active. This includes the chatbox input, console window and main menu.
* Chatbox input
* Console window
* Main menu
* Transferbox
To get the status of the debug view, see [[isDebugViewActive]].
 
{{Note|You cannot rely on this function to get the focus state of the MTA window - use [[isMTAWindowFocused]] instead}}


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool isChatBoxInputActive ()
bool isMTAWindowActive ()
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[GUI_widgets|GuiElement]].isMTAWindowActive}}


===Returns===
===Returns===
Returns ''true'' if the chatbox is receiving input, ''false'' if not active.
Returns ''true'' if the focus is on the MTA window, ''false'' if it isn't.


==Example==  
==Example==
This example does...
This piece of script will kill a player if he has any of the above system windows open
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function dontAllowAnyOpenWindow ()
blabhalbalhb --abababa
if isMTAWindowActive () then
--This line does this...
setElementHealth ( getLocalPlayer(), 0.0 )
mooo
end
end
setTimer ( dontAllowAnyOpenWindow, 50, 0 )
</syntaxhighlight>
</syntaxhighlight>
==See Also==
==See Also==
{{GUI_functions}}
{{GUI_functions}}
[[Category:Needs Example]]
[[ru:isMTAWindowActive]]
{{GUI_events}}

Latest revision as of 15:04, 8 October 2022

This function returns whether any system windows that take focus are active. This includes:

  • Chatbox input
  • Console window
  • Main menu
  • Transferbox

To get the status of the debug view, see isDebugViewActive.


[[{{{image}}}|link=|]] Note: You cannot rely on this function to get the focus state of the MTA window - use isMTAWindowFocused instead

Syntax

bool isMTAWindowActive ()

OOP Syntax Help! I don't understand this!

Method: GuiElement.isMTAWindowActive(...)


Returns

Returns true if the focus is on the MTA window, false if it isn't.

Example

This piece of script will kill a player if he has any of the above system windows open

function dontAllowAnyOpenWindow ()
	if isMTAWindowActive ()	then
		 setElementHealth ( getLocalPlayer(), 0.0 )
	end	 
end
setTimer ( dontAllowAnyOpenWindow, 50, 0 )

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows

Input

GUI