<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lordazamath</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lordazamath"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Lordazamath"/>
	<updated>2026-05-06T12:47:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiCreateCheckBox&amp;diff=24011</id>
		<title>GuiCreateCheckBox</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiCreateCheckBox&amp;diff=24011"/>
		<updated>2010-07-10T05:55:59Z</updated>

		<summary type="html">&lt;p&gt;Lordazamath: Removed from category &amp;quot;Needs example&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function creates a [[Element/GUI/Checkbox|checkbox]].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element guiCreateCheckBox ( float x, float y, float width, float height, string text, bool selected, bool relative, [element parent = nil] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
[[Image:Checkbox.png|thumb|Test Checkbox]]&lt;br /&gt;
*'''x:''' A float of the 2D x position of the checkbox on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''y:''' A float of the 2D y position of the checkbox on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''width:''' A float of the width of the text field next to the checkbox. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''height:''' A float of the height of the text field next to the checkbox. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''text:''' The text to be displayed next to the checkbox.&lt;br /&gt;
*'''selected:''' A boolean representing whether the checkbox created should be selected by default.&lt;br /&gt;
*'''relative:''' This is whether sizes and positioning are relative. If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing measures relative to the parent.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''parent:''' This is the parent that the checkbox is attached to. If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns [[element]] of the checkbox if it was created succesfully, ''false'' otherwise. &lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
This example creates a GUI window with a checked and an unchecked checkbox and adds a command to toggle their visibility&lt;br /&gt;
&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function drawGUI()&lt;br /&gt;
	local guiWindow = guiCreateWindow(100,100,200,100,&amp;quot;Checkbox test area&amp;quot;,false,false) -- create the container window&lt;br /&gt;
	local checkedBox = guiCreateCheckBox(20,30,150,20,&amp;quot;Checked checkbox&amp;quot;,true,false,guiWindow) -- note the parameter after header, it will make the checkbox be checked&lt;br /&gt;
	local uncheckedBox = guiCreateCheckBox(20,60,150,20,&amp;quot;Unchecked checkbox&amp;quot;,false,false,guiWindow) -- not here though&lt;br /&gt;
	guiSetVisible(guiWindow,false) -- set it invisible just in case&lt;br /&gt;
	return guiWindow -- we return the guiWindow&lt;br /&gt;
end&lt;br /&gt;
function cmdGUI(cmd)&lt;br /&gt;
	if not checkBoxWindow then -- if it hasn't been declared yet&lt;br /&gt;
		checkBoxWindow = drawGUI() -- we draw the gui window&lt;br /&gt;
		guiSetVisible(checkBoxWindow,true) -- we set it visible again. Strictly speaking it's not necessary, could have omitted both this and the upper guiSetVisible, but this is needed if you want to cache a window without actually showing it&lt;br /&gt;
	else -- if we actually have run this function before and declared checkBoxWindow&lt;br /&gt;
		guiSetVisible(checkBoxWindow, not guiGetVisible(checkBoxWindow)) -- we just toggle the visibility. If it was visible, not visible returns false and thus sets it's visibility false, effectivly hiding it	&lt;br /&gt;
	end&lt;br /&gt;
	showCursor(not isCursorShowing()) -- similar to above visibility&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;guiwindow&amp;quot;,cmdGUI) -- trigger cmdGUI function with this command&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>Lordazamath</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileExists&amp;diff=24010</id>
		<title>FileExists</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileExists&amp;diff=24010"/>
		<updated>2010-07-10T05:54:13Z</updated>

		<summary type="html">&lt;p&gt;Lordazamath: Removed from category &amp;quot;Needs example&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This functions checks whether a specified file exists inside a resource.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool fileExists ( string filePath )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''filePath:''' The [[filepath]] of the file, whose existence is going to be checked, in the following format: '''&amp;quot;:resourceName/path&amp;quot;'''. 'resourceName' is the name of the resource the file is checked to be in, and 'path' is the path from the root directory of the resource to the file.&lt;br /&gt;
:For example, if you want to check whether a file named 'myfile.txt' exists in the resource 'mapcreator', it can be done from another resource this way: ''fileExists(&amp;quot;:mapcreator/myfile.txt&amp;quot;)''.&lt;br /&gt;
:If the file, whose existence is going to be checked, is in the current resource, only the file path is necessary, e.g. ''fileExists(&amp;quot;myfile.txt&amp;quot;)''.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the file exists, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example checks if a file exists in a resource directory&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkExistingFile(player,cmd,filename,resourcename)&lt;br /&gt;
	if not filename then -- if the player didn't include a filename&lt;br /&gt;
		outputChatBox(&amp;quot;ERROR: Syntax '/checkfile filename resourcename(optional)'.&amp;quot;,player) -- display error&lt;br /&gt;
		return false  -- stop function&lt;br /&gt;
	end&lt;br /&gt;
	if not resourcename then -- if the player didn't specify the resource he wants to check, use current resource&lt;br /&gt;
		resourcename = getResourceName(resource) --every resource has a predefined global variable called resource that contains the resource pointer for that resource, in other words, the value that getThisResource() function returns.&lt;br /&gt;
	else&lt;br /&gt;
		if not getResourceFromName(resourcename) then -- if a resource with that name doesn't exist, output error and stop function&lt;br /&gt;
			outputChatBox(&amp;quot;ERROR: Resource &amp;quot;..resourcename..&amp;quot; doesn't exist.&amp;quot;,player) -- output error message&lt;br /&gt;
			return false -- stop the function here&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- as it hasn't stopped anywhere, we have both correct resourcename and filename&lt;br /&gt;
	local exists = fileExists((&amp;quot;:%s/%s&amp;quot;):format(resourcename,filename)) -- using shorter format of string.format, see StringLibraryTutorial in lua wiki for that&lt;br /&gt;
	if exists then&lt;br /&gt;
		outputChatBox((&amp;quot;The file %q in resource %q exists&amp;quot;):format(filename,resourcename))&lt;br /&gt;
	else&lt;br /&gt;
		outputChatBox((&amp;quot;The file %q in resource %q doesn't exist&amp;quot;):format(filename,resourcename))&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;exists&amp;quot;,checkExistingFile)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>Lordazamath</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileExists&amp;diff=24009</id>
		<title>FileExists</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileExists&amp;diff=24009"/>
		<updated>2010-07-10T05:52:30Z</updated>

		<summary type="html">&lt;p&gt;Lordazamath: /* Example */ added example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This functions checks whether a specified file exists inside a resource.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool fileExists ( string filePath )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''filePath:''' The [[filepath]] of the file, whose existence is going to be checked, in the following format: '''&amp;quot;:resourceName/path&amp;quot;'''. 'resourceName' is the name of the resource the file is checked to be in, and 'path' is the path from the root directory of the resource to the file.&lt;br /&gt;
:For example, if you want to check whether a file named 'myfile.txt' exists in the resource 'mapcreator', it can be done from another resource this way: ''fileExists(&amp;quot;:mapcreator/myfile.txt&amp;quot;)''.&lt;br /&gt;
:If the file, whose existence is going to be checked, is in the current resource, only the file path is necessary, e.g. ''fileExists(&amp;quot;myfile.txt&amp;quot;)''.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the file exists, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example checks if a file exists in a resource directory&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkExistingFile(player,cmd,filename,resourcename)&lt;br /&gt;
	if not filename then -- if the player didn't include a filename&lt;br /&gt;
		outputChatBox(&amp;quot;ERROR: Syntax '/checkfile filename resourcename(optional)'.&amp;quot;,player) -- display error&lt;br /&gt;
		return false  -- stop function&lt;br /&gt;
	end&lt;br /&gt;
	if not resourcename then -- if the player didn't specify the resource he wants to check, use current resource&lt;br /&gt;
		resourcename = getResourceName(resource) --every resource has a predefined global variable called resource that contains the resource pointer for that resource, in other words, the value that getThisResource() function returns.&lt;br /&gt;
	else&lt;br /&gt;
		if not getResourceFromName(resourcename) then -- if a resource with that name doesn't exist, output error and stop function&lt;br /&gt;
			outputChatBox(&amp;quot;ERROR: Resource &amp;quot;..resourcename..&amp;quot; doesn't exist.&amp;quot;,player) -- output error message&lt;br /&gt;
			return false -- stop the function here&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- as it hasn't stopped anywhere, we have both correct resourcename and filename&lt;br /&gt;
	local exists = fileExists((&amp;quot;:%s/%s&amp;quot;):format(resourcename,filename)) -- using shorter format of string.format, see StringLibraryTutorial in lua wiki for that&lt;br /&gt;
	if exists then&lt;br /&gt;
		outputChatBox((&amp;quot;The file %q in resource %q exists&amp;quot;):format(filename,resourcename))&lt;br /&gt;
	else&lt;br /&gt;
		outputChatBox((&amp;quot;The file %q in resource %q doesn't exist&amp;quot;):format(filename,resourcename))&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;exists&amp;quot;,checkExistingFile)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;br /&gt;
[[Category:Needs_Example]]&lt;/div&gt;</summary>
		<author><name>Lordazamath</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiCreateCheckBox&amp;diff=24008</id>
		<title>GuiCreateCheckBox</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiCreateCheckBox&amp;diff=24008"/>
		<updated>2010-07-10T05:37:22Z</updated>

		<summary type="html">&lt;p&gt;Lordazamath: /* Example */  Instead of asking for an example, why not do it yourself?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function creates a [[Element/GUI/Checkbox|checkbox]].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element guiCreateCheckBox ( float x, float y, float width, float height, string text, bool selected, bool relative, [element parent = nil] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
[[Image:Checkbox.png|thumb|Test Checkbox]]&lt;br /&gt;
*'''x:''' A float of the 2D x position of the checkbox on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''y:''' A float of the 2D y position of the checkbox on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''width:''' A float of the width of the text field next to the checkbox. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''height:''' A float of the height of the text field next to the checkbox. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''text:''' The text to be displayed next to the checkbox.&lt;br /&gt;
*'''selected:''' A boolean representing whether the checkbox created should be selected by default.&lt;br /&gt;
*'''relative:''' This is whether sizes and positioning are relative. If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing measures relative to the parent.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''parent:''' This is the parent that the checkbox is attached to. If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns [[element]] of the checkbox if it was created succesfully, ''false'' otherwise. &lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
This example creates a GUI window with a checked and an unchecked checkbox and adds a command to toggle their visibility&lt;br /&gt;
&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function drawGUI()&lt;br /&gt;
	local guiWindow = guiCreateWindow(100,100,200,100,&amp;quot;Checkbox test area&amp;quot;,false,false) -- create the container window&lt;br /&gt;
	local checkedBox = guiCreateCheckBox(20,30,150,20,&amp;quot;Checked checkbox&amp;quot;,true,false,guiWindow) -- note the parameter after header, it will make the checkbox be checked&lt;br /&gt;
	local uncheckedBox = guiCreateCheckBox(20,60,150,20,&amp;quot;Unchecked checkbox&amp;quot;,false,false,guiWindow) -- not here though&lt;br /&gt;
	guiSetVisible(guiWindow,false) -- set it invisible just in case&lt;br /&gt;
	return guiWindow -- we return the guiWindow&lt;br /&gt;
end&lt;br /&gt;
function cmdGUI(cmd)&lt;br /&gt;
	if not checkBoxWindow then -- if it hasn't been declared yet&lt;br /&gt;
		checkBoxWindow = drawGUI() -- we draw the gui window&lt;br /&gt;
		guiSetVisible(checkBoxWindow,true) -- we set it visible again. Strictly speaking it's not necessary, could have omitted both this and the upper guiSetVisible, but this is needed if you want to cache a window without actually showing it&lt;br /&gt;
	else -- if we actually have run this function before and declared checkBoxWindow&lt;br /&gt;
		guiSetVisible(checkBoxWindow, not guiGetVisible(checkBoxWindow)) -- we just toggle the visibility. If it was visible, not visible returns false and thus sets it's visibility false, effectivly hiding it	&lt;br /&gt;
	end&lt;br /&gt;
	showCursor(not isCursorShowing()) -- similar to above visibility&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;guiwindow&amp;quot;,cmdGUI) -- trigger cmdGUI function with this command&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;br /&gt;
[[Category:Needs Example]]&lt;/div&gt;</summary>
		<author><name>Lordazamath</name></author>
	</entry>
</feed>