<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/Scripting_the_GUI_-_Tutorial_2?action=history&amp;feed=atom</id>
	<title>Scripting the GUI - Tutorial 2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/Scripting_the_GUI_-_Tutorial_2?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;action=history"/>
	<updated>2026-05-13T23:38:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=60929&amp;oldid=prev</id>
		<title>Surge: /* Detecting the clicks */</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=60929&amp;oldid=prev"/>
		<updated>2018-11-26T12:03:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Detecting the clicks&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:03, 26 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l92&quot;&gt;Line 92:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 92:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We could add [[onClientGUIClick]] events for every button individually, as we have done in previous tutorials; Or, alternatively,  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We could add [[onClientGUIClick]] events for every button individually, as we have done in previous tutorials; Or, alternatively,  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;we could add a single [[onClientGUIClick]] &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;handle &lt;/del&gt;for the window (which is the parent of all our other keypad GUI elements), filter our results to include only the buttons we want and trigger our own custom event.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;we could add a single [[onClientGUIClick]] &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;handler &lt;/ins&gt;for the window (which is the parent of all our other keypad GUI elements), filter our results to include only the buttons we want and trigger our own custom event.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-60344:rev-60929 --&gt;
&lt;/table&gt;</summary>
		<author><name>Surge</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=60344&amp;oldid=prev</id>
		<title>Surge at 22:38, 5 November 2018</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=60344&amp;oldid=prev"/>
		<updated>2018-11-05T22:38:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:38, 5 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l341&quot;&gt;Line 341:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 341:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:GUI_Tutorials]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:GUI_Tutorials]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[hu:Scripting the GUI - Tutorial 2]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22284:rev-60344 --&gt;
&lt;/table&gt;</summary>
		<author><name>Surge</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22284&amp;oldid=prev</id>
		<title>R3mp at 01:29, 15 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22284&amp;oldid=prev"/>
		<updated>2010-01-15T01:29:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:29, 15 January 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l179&quot;&gt;Line 179:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 179:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Note how when we are clearing the display, we simply call updateDisplay() with no arguments. We do not need to pass 'nil' to it as all parameters (and variables) are nil by default.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Serverside Verification==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Serverside Verification==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l186&quot;&gt;Line 186:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 187:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now that we have completed the keypad clicking logic, we need to move on to verifying the code entered into the keypad.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now that we have completed the keypad clicking logic, we need to move on to verifying the code entered into the keypad.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To do this, we need to have the correct code stored somewhere on the server, which we can check the players code against.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To do this, we need to have the correct code stored somewhere on the server, which we can check the players code against.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''Do not store sensitive information, such as keycodes or passwords, in a clientside file. All clientside files will be downloaded to the clients computer and can be accessed and read by anyone who has joined your server.'''&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For the purposes of this tutorial we will simply store the code in a serverside table, however it can be done any number of ways (such as serverside xml files or MySQL databases).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For the purposes of this tutorial we will simply store the code in a serverside table, however it can be done any number of ways (such as serverside xml files or MySQL databases).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22196:rev-22284 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22196&amp;oldid=prev</id>
		<title>R3mp at 01:04, 6 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22196&amp;oldid=prev"/>
		<updated>2010-01-06T01:04:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:04, 6 January 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l336&quot;&gt;Line 336:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 336:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For further GUI tutorials, see [[Scripting the GUI - Tutorial 3|Tutorial 3 (Scrolling News Feed)]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For further GUI tutorials, see [[Scripting the GUI - Tutorial 3|Tutorial 3 (Scrolling News Feed)]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:GUI_Tutorials]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22185:rev-22196 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22185&amp;oldid=prev</id>
		<title>R3mp at 21:19, 5 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22185&amp;oldid=prev"/>
		<updated>2010-01-05T21:19:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:19, 5 January 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l334&quot;&gt;Line 334:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 334:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You should now have a working example of a GUI Keypad controlling an A51 Gate.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You should now have a working example of a GUI Keypad controlling an A51 Gate.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;For further GUI tutorials, see [[Scripting the GUI - Tutorial 3|Tutorial 3 (Scrolling News Feed)]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22176&amp;oldid=prev</id>
		<title>Sebassje: /* Creating the gate */</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22176&amp;oldid=prev"/>
		<updated>2010-01-03T21:43:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Creating the gate&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:43, 3 January 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l272&quot;&gt;Line 272:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 272:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;''If you are unsure of map file syntax, please see the [&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;http://wiki.multitheftauto.com/wiki/&lt;/del&gt;Writing_Gamemodes| Writing Gamemodes Tutorial] or check the [[Object]] page for help.''&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;''If you are unsure of map file syntax, please see the [&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/ins&gt;Writing_Gamemodes| Writing Gamemodes Tutorial&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/ins&gt;] or check the [[Object]] page for help.''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;map&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;map&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22163:rev-22176 --&gt;
&lt;/table&gt;</summary>
		<author><name>Sebassje</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22163&amp;oldid=prev</id>
		<title>R3mp at 20:25, 3 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22163&amp;oldid=prev"/>
		<updated>2010-01-03T20:25:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:25, 3 January 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''Note that this tutorial assumes you are familiar with all the content covered in the [[Introduction to Scripting GUI|GUI Scripting Introduction]].'''&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''Note that this tutorial assumes you are familiar with all the content covered in the [[Introduction to Scripting GUI|GUI Scripting Introduction]].'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Image:Gui_keypad_tutorial.png|thumb|GUI Keypad]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Setting up the Keypad==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Setting up the Keypad==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-22160:rev-22163 --&gt;
&lt;/table&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22160&amp;oldid=prev</id>
		<title>R3mp: Created page with ''''Scripting the GUI - Tutorial 2 (Gates + Keypads)'''  In this tutorial we will look at creating GUI keypads with combination codes for map-defined object gates. We will be usin…'</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_the_GUI_-_Tutorial_2&amp;diff=22160&amp;oldid=prev"/>
		<updated>2010-01-03T20:21:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;#039;&amp;#039;&amp;#039;Scripting the GUI - Tutorial 2 (Gates + Keypads)&amp;#039;&amp;#039;&amp;#039;  In this tutorial we will look at creating GUI keypads with combination codes for map-defined object gates. We will be usin…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Scripting the GUI - Tutorial 2 (Gates + Keypads)'''&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will look at creating GUI keypads with combination codes for map-defined object gates.&lt;br /&gt;
We will be using serverside keycodes, with some client - server interaction to verify the codes and report the outcome.&lt;br /&gt;
&lt;br /&gt;
'''Note that this tutorial assumes you are familiar with all the content covered in the [[Introduction to Scripting GUI|GUI Scripting Introduction]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up the Keypad==&lt;br /&gt;
To begin, open up a clientside lua file (if you have been following the [[Introduction to Scripting GUI|GUI Scripting Introduction]], this is gui.lua) to work with.&lt;br /&gt;
&lt;br /&gt;
===Creating the GUI===&lt;br /&gt;
By now, GUI creation should seem relatively straight forward, so we will not go over this in too much detail.&lt;br /&gt;
As in [[Scripting the GUI - Tutorial 1|Tutorial 1]] we will be using '''absolute''' values in this tutorial.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createKeypad()&lt;br /&gt;
	-- get the screen width and height&lt;br /&gt;
	local sWidth, sHeight = guiGetScreenSize()&lt;br /&gt;
&lt;br /&gt;
	-- create the window, using some maths to find the centre of the screen&lt;br /&gt;
	local Width,Height = 142,276&lt;br /&gt;
	local X = (sWidth/2) - (Width/2)&lt;br /&gt;
	local Y = (sHeight/2) - (Height/2)&lt;br /&gt;
	keypadWindow = guiCreateWindow(X,Y,Width,Height,&amp;quot;Keypad&amp;quot;,false)&lt;br /&gt;
	&lt;br /&gt;
	-- don't allow people to resize the keypad&lt;br /&gt;
	guiWindowSetSizable(keypadWindow,false)&lt;br /&gt;
&lt;br /&gt;
	-- create buttons labeled 0-9, &amp;quot;*&amp;quot;, &amp;quot;#&amp;quot;, &amp;quot;Enter&amp;quot; and &amp;quot;C&amp;quot; (clear)&lt;br /&gt;
	keypadButton1 = guiCreateButton(13,68,37,36,&amp;quot;1&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton2 = guiCreateButton(53,68,37,36,&amp;quot;2&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton3 = guiCreateButton(93,68,37,36,&amp;quot;3&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton4 = guiCreateButton(13,108,37,36,&amp;quot;4&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton5 = guiCreateButton(53,108,37,36,&amp;quot;5&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton6 = guiCreateButton(93,108,37,36,&amp;quot;6&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton7 = guiCreateButton(13,148,37,36,&amp;quot;7&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton8 = guiCreateButton(53,148,37,36,&amp;quot;8&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton9 = guiCreateButton(93,148,37,36,&amp;quot;9&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButtonAsterix = guiCreateButton(13,188,37,36,&amp;quot;*&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButton0 = guiCreateButton(53,188,37,36,&amp;quot;0&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButtonHash = guiCreateButton(93,188,37,36,&amp;quot;#&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButtonExit = guiCreateButton(13,228,37,36,&amp;quot;Exit&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButtonEnter = guiCreateButton(53,228,37,36,&amp;quot;Enter&amp;quot;,false,keypadWindow)&lt;br /&gt;
	keypadButtonClear = guiCreateButton(93,228,37,36,&amp;quot;Clear&amp;quot;,false,keypadWindow)&lt;br /&gt;
&lt;br /&gt;
	-- create a gridlist to act as a backdrop on the kaypad display&lt;br /&gt;
	keypadGridlistDisplay = guiCreateGridList(13,25,117,33,false,keypadWindow)&lt;br /&gt;
	guiGridListSetSelectionMode(keypadGridlistDisplay,2)&lt;br /&gt;
	guiSetAlpha(keypadGridlistDisplay,0.6)&lt;br /&gt;
	-- create a label so we can write text on the keypad display&lt;br /&gt;
	keypadLabelDisplay = guiCreateLabel(14,26,115,30,&amp;quot;Enter Keycode.&amp;quot;,false,keypadWindow)&lt;br /&gt;
	guiLabelSetColor(keypadLabelDisplay,255,000,000)&lt;br /&gt;
	guiLabelSetVerticalAlign(keypadLabelDisplay,&amp;quot;center&amp;quot;)&lt;br /&gt;
	guiLabelSetHorizontalAlign(keypadLabelDisplay,&amp;quot;center&amp;quot;,false)&lt;br /&gt;
	&lt;br /&gt;
	guiSetVisible(keypadWindow,false)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- create the GUI when the resource starts&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;,getResourceRootElement(getThisResource()),createKeypad)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As you can see, the keypad consists of 10 numerical keys (0-9), two character keys (* and #), a clear key, an exit key and an enter key.&lt;br /&gt;
This means the codes used on the keypad can contain any of these characters (0123456789*#).&lt;br /&gt;
&lt;br /&gt;
===Managing the display===&lt;br /&gt;
We will begin by writing a small function to control the display on the keypad.&lt;br /&gt;
This is done by encapsulating several methods of changing the text into a single function,&lt;br /&gt;
which will enable us to easily add/remove text from the display later on.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function updateDisplay(text)&lt;br /&gt;
	-- if we are passing some text&lt;br /&gt;
	if text then&lt;br /&gt;
		-- if its a digit or * or #, then append it to the end of the display&lt;br /&gt;
		if tonumber(text) or text == &amp;quot;*&amp;quot; or text == &amp;quot;#&amp;quot; then&lt;br /&gt;
			guiSetText(keypadLabelDisplay,guiGetText(keypadLabelDisplay) .. text)&lt;br /&gt;
		-- otherwise replace the display with the new text&lt;br /&gt;
		else&lt;br /&gt;
			guiSetText(keypadLabelDisplay,text)&lt;br /&gt;
		end	&lt;br /&gt;
	-- if we pass nil, clear the display entirely&lt;br /&gt;
	else&lt;br /&gt;
		guiSetText(keypadLabelDisplay,&amp;quot;&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
We can now simply call updateDisplay(our text) to change the text on the display, or updateDisplay(nil) to clear it.&lt;br /&gt;
&lt;br /&gt;
===Detecting the clicks===&lt;br /&gt;
With so many buttons that do very similar tasks on our keypad, there are two methods available to us for detecting when a player clicks on them.&lt;br /&gt;
&lt;br /&gt;
We could add [[onClientGUIClick]] events for every button individually, as we have done in previous tutorials; Or, alternatively, &lt;br /&gt;
we could add a single [[onClientGUIClick]] handle for the window (which is the parent of all our other keypad GUI elements), filter our results to include only the buttons we want and trigger our own custom event.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the purposes of this tutorial and in the interest of outlining multiple approaches, we will explore the second method, though either one is an acceptable solution.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientGUIClick&amp;quot;,keypadWindow,processKeypadClicks,true)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Notice the final argument is set to 'true'. This means that clicks on any other elements in the same branch of the tree will also trigger this event handle (eg. clicks on our buttons).'''&lt;br /&gt;
&lt;br /&gt;
Add this line of code into your createKeypad function, after your GUI has been created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we are detecting all clicks on our GUI, we need to filter out the ones we do not want (ie: clicks on the window or display) and trigger our custom event:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function processKeypadClicks(button,state)&lt;br /&gt;
	if button == &amp;quot;left&amp;quot; and state == &amp;quot;up&amp;quot; then&lt;br /&gt;
		-- if the source of this event is a gui button&lt;br /&gt;
		if getElementType(source) == &amp;quot;gui-button&amp;quot; then&lt;br /&gt;
			-- trigger our custom event and send the keypad id of this keypad as an argument&lt;br /&gt;
			triggerEvent(&amp;quot;onKeypadButtonClicked&amp;quot;,source,getElementData(keypadWindow,&amp;quot;keypadID&amp;quot;))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As you can see, we are now triggering our custom event &amp;quot;onKeypadButtonClicked&amp;quot; whenever a button is clicked on the keypad.&lt;br /&gt;
Also note we use element data &amp;quot;keypadID&amp;quot; to differentiate between keypads. This data will need to be set whenever the player is shown a new keypad.&lt;br /&gt;
We will cover this in more detail later.&lt;br /&gt;
&lt;br /&gt;
===Handling the clicks===&lt;br /&gt;
Much like when using [[triggerServerEvent]] in previous tutorials, we now need to define the event, only this time it is purely clientside:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;onKeypadButtonClicked&amp;quot;,false)&lt;br /&gt;
addEventHandler(&amp;quot;onKeypadButtonClicked&amp;quot;,root,&lt;br /&gt;
	function(keypadID)&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note the second argument in [[addEvent]] is set to false, indicating that this event cannot be triggered from the server.&lt;br /&gt;
Also note, the function we are using in the [[addEventHandler]] does not have a name. If you contract it down and remove the spacing, you get:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onKeypadButtonClicked&amp;quot;,root,function() ... end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This simply means instead of storing the pointer to the function in a variable, we are passing it directly as an argument.&lt;br /&gt;
Doing it this way cleans up the code and will often make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Now that the event has been created, we can fill in the code logic that will control our button presses.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;onKeypadButtonClicked&amp;quot;,false)&lt;br /&gt;
addEventHandler(&amp;quot;onKeypadButtonClicked&amp;quot;,root,&lt;br /&gt;
	function(keypadID)&lt;br /&gt;
		-- clear the display if this is the first time its being used&lt;br /&gt;
		if guiGetText(keypadLabelDisplay) == &amp;quot;Enter Keycode.&amp;quot; or guiGetText(keypadLabelDisplay) == &amp;quot;Invalid Keycode.&amp;quot; then&lt;br /&gt;
			updateDisplay()&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
		-- if its the clear button&lt;br /&gt;
		if guiGetText(source) == &amp;quot;Clear&amp;quot; then&lt;br /&gt;
			-- clear the display&lt;br /&gt;
			updateDisplay()&lt;br /&gt;
		&lt;br /&gt;
		-- if its the enter button&lt;br /&gt;
		elseif guiGetText(source) == &amp;quot;Enter&amp;quot; then&lt;br /&gt;
			-- get the currently entered code from the display&lt;br /&gt;
			local code = guiGetText(keypadLabelDisplay)&lt;br /&gt;
			&lt;br /&gt;
			-- if they have entered a code&lt;br /&gt;
			if code then&lt;br /&gt;
				-- trigger the server so we can verify their code&lt;br /&gt;
				triggerServerEvent(&amp;quot;verifyKeypadCode&amp;quot;,getLocalPlayer(),code,keypadID)&lt;br /&gt;
			end&lt;br /&gt;
		&lt;br /&gt;
		-- if its the exit button&lt;br /&gt;
		elseif guiGetText(source) == &amp;quot;Exit&amp;quot; then&lt;br /&gt;
			-- hide the keypad and reset the display text ready for next time&lt;br /&gt;
			guiSetVisible(keypadWindow,false)&lt;br /&gt;
			updateDisplay(&amp;quot;Enter Keycode.&amp;quot;)&lt;br /&gt;
			showCursor(false,false)&lt;br /&gt;
			&lt;br /&gt;
		-- otherwise, it must be a character button&lt;br /&gt;
		else&lt;br /&gt;
			updateDisplay(guiGetText(source))	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Serverside Verification==&lt;br /&gt;
For this part of the tutorial, you will need to open up a serverside lua file from your resource to work with.&lt;br /&gt;
&lt;br /&gt;
===Defining the keycode===&lt;br /&gt;
Now that we have completed the keypad clicking logic, we need to move on to verifying the code entered into the keypad.&lt;br /&gt;
To do this, we need to have the correct code stored somewhere on the server, which we can check the players code against.&lt;br /&gt;
&lt;br /&gt;
For the purposes of this tutorial we will simply store the code in a serverside table, however it can be done any number of ways (such as serverside xml files or MySQL databases).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local keypadCodes = {&lt;br /&gt;
	[&amp;quot;a51MainGateKeypadCode&amp;quot;] = &amp;quot;4455*#&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This table stores an entry called &amp;quot;a51MainGateKeypadCode&amp;quot; with the code 4455*#&lt;br /&gt;
&lt;br /&gt;
'''This is the keycode that you will use to open the gate later on in this tutorial.'''&lt;br /&gt;
&lt;br /&gt;
===Verifying the code===&lt;br /&gt;
Now that we have a keycode to verify against, we can write our serverside event:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;verifyKeypadCode&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;verifyKeypadCode&amp;quot;,root,function(code,keypadID)&lt;br /&gt;
	if code then&lt;br /&gt;
		-- using the table we created earlier, check if the code supplied is the same as the code for this gate&lt;br /&gt;
		if code == keypadCodes[keypadID] then&lt;br /&gt;
			-- if it is, tell the client that it was successful&lt;br /&gt;
			triggerClientEvent(client,&amp;quot;onKeypadVerificationSuccessful&amp;quot;,client,keypadID)&lt;br /&gt;
		else&lt;br /&gt;
			-- if it is not, tell the client that it was not successful&lt;br /&gt;
			triggerClientEvent(client,&amp;quot;onKeypadVerificationFailed&amp;quot;,client,keypadID)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Here we use our table and the keypadID supplied by the player to check if the codes match.&lt;br /&gt;
&lt;br /&gt;
If you are not using a table to store the codes, then you will need to replace 'keypadCodes[keypadID]' with your own storage method.&lt;br /&gt;
Once it is verified (or not), we can trigger the client so the appropriate information can be shown on the keypad display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Receiving the result==&lt;br /&gt;
We have now finished the serverside section of the tutorial, so you will need to open up the clientside lua file from your resource &lt;br /&gt;
that you were previously working on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once our code has been verified, the server will send back the response to the client.&lt;br /&gt;
In just the same way as client -&amp;gt; server interaction, we now need to add the event that the server is going to trigger on the client.&lt;br /&gt;
&lt;br /&gt;
===Catching and processing the result===&lt;br /&gt;
First we will add the event for when the verification is successful:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;onKeypadVerificationSuccessful&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;onKeypadVerificationSuccessful&amp;quot;,root,&lt;br /&gt;
	function()&lt;br /&gt;
		-- hide the keypad and reset the display text ready for next time&lt;br /&gt;
		guiSetVisible(keypadWindow,false)&lt;br /&gt;
		updateDisplay(&amp;quot;Enter Keycode.&amp;quot;)&lt;br /&gt;
		showCursor(false,false)&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally we can add the event for when the verification is unsuccessful:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;onKeypadVerificationFailed&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;onKeypadVerificationFailed&amp;quot;,root,&lt;br /&gt;
	function()&lt;br /&gt;
		-- update the display text to show the code was invalid&lt;br /&gt;
		updateDisplay(&amp;quot;Invalid Keycode.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This completes the keypad section of the tutorial.&lt;br /&gt;
&lt;br /&gt;
For an example of how to implement this into a working gate system, carry on reading the next section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Applying the Keypad==&lt;br /&gt;
For the keypad to have any use, we need something to use it on.&lt;br /&gt;
For this tutorial we will be using gates, and as mentioned earlier we will create a main gate into A51.&lt;br /&gt;
&lt;br /&gt;
===Creating the gate===&lt;br /&gt;
First of all, we need to create the gate object.&lt;br /&gt;
For the purposes of this example, we will be using a map file to store the object. &lt;br /&gt;
While this is the recommended method for defining objects, it is not the only way to approach it.&lt;br /&gt;
&lt;br /&gt;
Navigate to your resource folder and make a new file called gate.map, then add your new map file to your meta.xml using:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map src=&amp;quot;gate.map&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''If you are unsure of map file syntax, please see the [http://wiki.multitheftauto.com/wiki/Writing_Gamemodes| Writing Gamemodes Tutorial] or check the [[Object]] page for help.''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;object id=&amp;quot;a51MainGateKeypadCode&amp;quot; model=&amp;quot;971&amp;quot; posX=&amp;quot;96.736&amp;quot; posY=&amp;quot;1918.352&amp;quot; posZ=&amp;quot;20.694&amp;quot; rotX=&amp;quot;0&amp;quot; rotY=&amp;quot;0&amp;quot; rotZ=&amp;quot;270.40&amp;quot; newPosX=&amp;quot;96.751&amp;quot; newPosY=&amp;quot;1914.474&amp;quot; newPosZ=&amp;quot;20.694&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This will create a gate object across the A51 entrance. The object will have position and rotation data, as well as its newPosX,newPosY and newPosZ information that we need to be able to move it.&lt;br /&gt;
&lt;br /&gt;
'''Note that the object id is the same as the table entry we created earlier to hold the access code.'''&lt;br /&gt;
This is one possible method that could be accessed to link this gate with that particular keycode.&lt;br /&gt;
&lt;br /&gt;
===Opening the keypad===&lt;br /&gt;
Back in the clientside lua file again, we can now work on linking the gate and the keypad.&lt;br /&gt;
&lt;br /&gt;
Now that we have our gate, we need a way of accessing the keypad to open it.&lt;br /&gt;
For the purposes of this tutorial we will use a simple command, however you could just as easily use a colshape or button press.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;a51gate&amp;quot;,function()&lt;br /&gt;
	guiSetVisible(keypadWindow,true)&lt;br /&gt;
	showCursor(true,true)&lt;br /&gt;
	setElementData(keypadWindow,&amp;quot;keypadID&amp;quot;,&amp;quot;a51MainGateKeypadCode&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that we set the element data &amp;quot;keypadID&amp;quot;.&lt;br /&gt;
This is very important because it allows us to keep track of which gate we are trying to open (in this case, the &amp;quot;a51MainGateKeypadCode&amp;quot; gate).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Opening the gate===&lt;br /&gt;
With our gate created and our keypad ready, all thats left now is to open the gate.&lt;br /&gt;
Having created custom events earlier for successfully and unsuccessfully verifying the code, this now becomes very easy to do.&lt;br /&gt;
All we do is add an event handler for our custom &amp;quot;success&amp;quot; event, and using the keypadID we defined earlier we can move the gate inside it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onKeypadVerificationSuccessful&amp;quot;,root,&lt;br /&gt;
	-- keypadID is sent back from the server&lt;br /&gt;
	function(keypadID)&lt;br /&gt;
		-- get the gate object (this is where the id=&amp;quot;a51MainGateKeypadCode&amp;quot; tag in the map file becomes useful)&lt;br /&gt;
		local gate = getElementByID(keypadID)&lt;br /&gt;
&lt;br /&gt;
		-- if we found the object&lt;br /&gt;
		if gate then&lt;br /&gt;
			-- get the new position (as we defined in the map file)&lt;br /&gt;
			local x = tonumber(getElementData(gate,&amp;quot;newPosX&amp;quot;))&lt;br /&gt;
			local y = tonumber(getElementData(gate,&amp;quot;newPosY&amp;quot;))&lt;br /&gt;
			local z = tonumber(getElementData(gate,&amp;quot;newPosZ&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
			-- move the gate&lt;br /&gt;
			moveObject(gate,1500,x,y,z)&lt;br /&gt;
			&lt;br /&gt;
			-- get the original position&lt;br /&gt;
			x = tonumber(getElementData(gate,&amp;quot;posX&amp;quot;))&lt;br /&gt;
			y = tonumber(getElementData(gate,&amp;quot;posY&amp;quot;))&lt;br /&gt;
			z = tonumber(getElementData(gate,&amp;quot;posZ&amp;quot;))	&lt;br /&gt;
			&lt;br /&gt;
			-- set a timer to close the gate in 5 seconds&lt;br /&gt;
			setTimer(moveObject,5000,1,gate,1500,x,y,z)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note how by using the keypadID sent back from the server, we can use if statements and checks against the id to control any number of gates from the same function.&lt;br /&gt;
&lt;br /&gt;
You should now have a working example of a GUI Keypad controlling an A51 Gate.&lt;/div&gt;</summary>
		<author><name>R3mp</name></author>
	</entry>
</feed>