<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/DgsMenuSetItemCommand?action=history&amp;feed=atom</id>
	<title>DgsMenuSetItemCommand - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/DgsMenuSetItemCommand?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;action=history"/>
	<updated>2026-05-04T16:47:12Z</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=DgsMenuSetItemCommand&amp;diff=82209&amp;oldid=prev</id>
		<title>Mohab at 04:51, 10 July 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;diff=82209&amp;oldid=prev"/>
		<updated>2025-07-10T04:51:28Z</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 04:51, 10 July 2025&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-l72&quot;&gt;Line 72:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 72:&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;==Author==&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;==Author==&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;[[User:Mohab|Mohab]].&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;[[User:Mohab|Mohab]].&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:DGS_functions]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-82200:rev-82209 --&gt;
&lt;/table&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;diff=82200&amp;oldid=prev</id>
		<title>Mohab: Created page with &quot;{{client function}} __NOTOC__ This function changes the command identifier of an existing menu item. The command is used to identify the item when it's selected.  ==Syntax== &lt;syntaxhighlight lang=&quot;lua&quot;&gt; bool dgsMenuSetItemCommand ( element menu, int uniqueID, string command ) &lt;/syntaxhighlight&gt;  ===Required Arguments=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem) *'''command:''' Th...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;diff=82200&amp;oldid=prev"/>
		<updated>2025-07-10T04:40:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{client function}} __NOTOC__ This function changes the command identifier of an existing menu item. The command is used to identify the item when it&amp;#039;s selected.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool dgsMenuSetItemCommand ( element menu, int uniqueID, string command ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *&amp;#039;&amp;#039;&amp;#039;menu:&amp;#039;&amp;#039;&amp;#039; The DGS menu element containing the item *&amp;#039;&amp;#039;&amp;#039;uniqueID:&amp;#039;&amp;#039;&amp;#039; The unique ID of the menu item (returned by &lt;a href=&quot;/wiki/DgsMenuAddItem&quot; title=&quot;DgsMenuAddItem&quot;&gt;dgsMenuAddItem&lt;/a&gt;) *&amp;#039;&amp;#039;&amp;#039;command:&amp;#039;&amp;#039;&amp;#039; Th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function changes the command identifier of an existing menu item. The command is used to identify the item when it's selected.&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 dgsMenuSetItemCommand ( element menu, int uniqueID, string command )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element containing the item&lt;br /&gt;
*'''uniqueID:''' The unique ID of the menu item (returned by [[dgsMenuAddItem]])&lt;br /&gt;
*'''command:''' The new command identifier for this item&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the command was set successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
loadstring(exports.dgs:dgsImportFunction())()-- load functions&lt;br /&gt;
&lt;br /&gt;
-- Create a menu with some items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 150, 120, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;save&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Load&amp;quot;, &amp;quot;load&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Toggle&amp;quot;, &amp;quot;mode_normal&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Change the toggle item command based on current state&lt;br /&gt;
local isAdvancedMode = false&lt;br /&gt;
&lt;br /&gt;
function toggleMode()&lt;br /&gt;
    isAdvancedMode = not isAdvancedMode&lt;br /&gt;
&lt;br /&gt;
    if isAdvancedMode then&lt;br /&gt;
        dgsMenuSetItemCommand(menu, item3, &amp;quot;mode_advanced&amp;quot;)&lt;br /&gt;
        dgsMenuSetItemText(menu, item3, &amp;quot;Advanced Mode&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;Switched to advanced mode&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        dgsMenuSetItemCommand(menu, item3, &amp;quot;mode_normal&amp;quot;)&lt;br /&gt;
        dgsMenuSetItemText(menu, item3, &amp;quot;Normal Mode&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;Switched to normal mode&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Handle menu selections&lt;br /&gt;
addEventHandler(&amp;quot;onDgsMenuSelect&amp;quot;, menu, function(subMenu, uniqueID)&lt;br /&gt;
    if uniqueID == -1 then return end&lt;br /&gt;
&lt;br /&gt;
    local command = dgsMenuGetItemCommand(source, uniqueID)&lt;br /&gt;
    if command == &amp;quot;save&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Saving...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;load&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Loading...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;mode_normal&amp;quot; or command == &amp;quot;mode_advanced&amp;quot; then&lt;br /&gt;
        toggleMode()&lt;br /&gt;
    end&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
{{Note|The menu automatically resizes when item commands are changed}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuGetItemCommand]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuSetItemText]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;br /&gt;
&lt;br /&gt;
[[Category:DGS_functions]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
</feed>