<?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=Mohab</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=Mohab"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Mohab"/>
	<updated>2026-04-18T00:37:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82302</id>
		<title>SetAccountSerial</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82302"/>
		<updated>2025-07-26T08:09:13Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23232|This function sets the serial number for a specified player account. It allows administrators to update or assign a new [[serial]] to registered accounts.}}&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 setAccountSerial ( account theAccount, string serial )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[account]]:setSerial|serial|}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theAccount:''' The account element to set the serial for&lt;br /&gt;
*'''serial:''' A valid 32-character hexadecimal string representing the new serial number&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the serial was successfully set, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Simple example: Set a serial for a player's account&lt;br /&gt;
local player = getPlayerFromName(&amp;quot;John&amp;quot;)&lt;br /&gt;
local account = getPlayerAccount(player)&lt;br /&gt;
local newSerial = &amp;quot;A1B2C3D4E5F6789012345678901234AB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if setAccountSerial(account, newSerial) then&lt;br /&gt;
    outputChatBox(&amp;quot;Serial updated successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to update serial!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Advanced example: Administrative command system&lt;br /&gt;
function changePlayerSerial(player, newSerial)&lt;br /&gt;
    local account = getPlayerAccount(player)&lt;br /&gt;
    if account and not isGuestAccount(account) then&lt;br /&gt;
        if setAccountSerial(account, newSerial) then&lt;br /&gt;
            outputChatBox(&amp;quot;Serial number updated successfully!&amp;quot;, player, 0, 255, 0)&lt;br /&gt;
            return true&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Failed to update serial number. Invalid format!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
            return false&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;You must be logged into a registered account.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Command to set a player's account serial&lt;br /&gt;
addCommandHandler(&amp;quot;setserial&amp;quot;, function(player, cmd, targetPlayer, newSerial)&lt;br /&gt;
    if not targetPlayer or not newSerial then&lt;br /&gt;
        outputChatBox(&amp;quot;Usage: /setserial &amp;lt;player&amp;gt; &amp;lt;32-char-hex-serial&amp;gt;&amp;quot;, player)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local target = getPlayerFromName(targetPlayer)&lt;br /&gt;
    if target then&lt;br /&gt;
        if string.len(newSerial) == 32 and string.match(newSerial, &amp;quot;^[A-Fa-f0-9]+$&amp;quot;) then&lt;br /&gt;
            changePlayerSerial(target, newSerial)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Serial must be 32 hexadecimal characters!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Player not found!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getAccountSerial]]&lt;br /&gt;
*[[getAccountsBySerial]]&lt;br /&gt;
*[[addAccount]]&lt;br /&gt;
*[[removeAccount]]&lt;br /&gt;
*[[isGuestAccount]]&lt;br /&gt;
*[[getPlayerAccount]]&lt;br /&gt;
{{Account functions}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82301</id>
		<title>SetAccountSerial</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82301"/>
		<updated>2025-07-26T08:02:34Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23232|This function sets the serial number for a specified player account. It allows administrators to update or assign a new [[serial]] to registered accounts.}}&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 setAccountSerial ( account theAccount, string serial )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theAccount:''' The account element to set the serial for&lt;br /&gt;
*'''serial:''' A valid 32-character hexadecimal string representing the new serial number&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the serial was successfully set, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Simple example: Set a serial for a player's account&lt;br /&gt;
local player = getPlayerFromName(&amp;quot;John&amp;quot;)&lt;br /&gt;
local account = getPlayerAccount(player)&lt;br /&gt;
local newSerial = &amp;quot;A1B2C3D4E5F6789012345678901234AB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if setAccountSerial(account, newSerial) then&lt;br /&gt;
    outputChatBox(&amp;quot;Serial updated successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to update serial!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Advanced example: Administrative command system&lt;br /&gt;
function changePlayerSerial(player, newSerial)&lt;br /&gt;
    local account = getPlayerAccount(player)&lt;br /&gt;
    if account and not isGuestAccount(account) then&lt;br /&gt;
        if setAccountSerial(account, newSerial) then&lt;br /&gt;
            outputChatBox(&amp;quot;Serial number updated successfully!&amp;quot;, player, 0, 255, 0)&lt;br /&gt;
            return true&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Failed to update serial number. Invalid format!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
            return false&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;You must be logged into a registered account.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Command to set a player's account serial&lt;br /&gt;
addCommandHandler(&amp;quot;setserial&amp;quot;, function(player, cmd, targetPlayer, newSerial)&lt;br /&gt;
    if not targetPlayer or not newSerial then&lt;br /&gt;
        outputChatBox(&amp;quot;Usage: /setserial &amp;lt;player&amp;gt; &amp;lt;32-char-hex-serial&amp;gt;&amp;quot;, player)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local target = getPlayerFromName(targetPlayer)&lt;br /&gt;
    if target then&lt;br /&gt;
        if string.len(newSerial) == 32 and string.match(newSerial, &amp;quot;^[A-Fa-f0-9]+$&amp;quot;) then&lt;br /&gt;
            changePlayerSerial(target, newSerial)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Serial must be 32 hexadecimal characters!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Player not found!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getAccountSerial]]&lt;br /&gt;
*[[getAccountsBySerial]]&lt;br /&gt;
*[[addAccount]]&lt;br /&gt;
*[[removeAccount]]&lt;br /&gt;
*[[isGuestAccount]]&lt;br /&gt;
*[[getPlayerAccount]]&lt;br /&gt;
{{Account functions}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82300</id>
		<title>SetAccountSerial</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82300"/>
		<updated>2025-07-26T08:02:15Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23232|This function sets the serial number for a specified player account. It allows administrators to update or assign a [[serial]] to registered accounts.}}&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 setAccountSerial ( account theAccount, string serial )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theAccount:''' The account element to set the serial for&lt;br /&gt;
*'''serial:''' A valid 32-character hexadecimal string representing the new serial number&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the serial was successfully set, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Simple example: Set a serial for a player's account&lt;br /&gt;
local player = getPlayerFromName(&amp;quot;John&amp;quot;)&lt;br /&gt;
local account = getPlayerAccount(player)&lt;br /&gt;
local newSerial = &amp;quot;A1B2C3D4E5F6789012345678901234AB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if setAccountSerial(account, newSerial) then&lt;br /&gt;
    outputChatBox(&amp;quot;Serial updated successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to update serial!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Advanced example: Administrative command system&lt;br /&gt;
function changePlayerSerial(player, newSerial)&lt;br /&gt;
    local account = getPlayerAccount(player)&lt;br /&gt;
    if account and not isGuestAccount(account) then&lt;br /&gt;
        if setAccountSerial(account, newSerial) then&lt;br /&gt;
            outputChatBox(&amp;quot;Serial number updated successfully!&amp;quot;, player, 0, 255, 0)&lt;br /&gt;
            return true&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Failed to update serial number. Invalid format!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
            return false&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;You must be logged into a registered account.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Command to set a player's account serial&lt;br /&gt;
addCommandHandler(&amp;quot;setserial&amp;quot;, function(player, cmd, targetPlayer, newSerial)&lt;br /&gt;
    if not targetPlayer or not newSerial then&lt;br /&gt;
        outputChatBox(&amp;quot;Usage: /setserial &amp;lt;player&amp;gt; &amp;lt;32-char-hex-serial&amp;gt;&amp;quot;, player)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local target = getPlayerFromName(targetPlayer)&lt;br /&gt;
    if target then&lt;br /&gt;
        if string.len(newSerial) == 32 and string.match(newSerial, &amp;quot;^[A-Fa-f0-9]+$&amp;quot;) then&lt;br /&gt;
            changePlayerSerial(target, newSerial)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Serial must be 32 hexadecimal characters!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Player not found!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getAccountSerial]]&lt;br /&gt;
*[[getAccountsBySerial]]&lt;br /&gt;
*[[addAccount]]&lt;br /&gt;
*[[removeAccount]]&lt;br /&gt;
*[[isGuestAccount]]&lt;br /&gt;
*[[getPlayerAccount]]&lt;br /&gt;
{{Account functions}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82299</id>
		<title>SetAccountSerial</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetAccountSerial&amp;diff=82299"/>
		<updated>2025-07-26T08:00:16Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{server function}} __NOTOC__ {{New feature/item|3.0161|1.6.0|23232|This function sets the serial number for a specified player account. It allows administrators to update or assign a new 32-character hexadecimal serial identifier to registered accounts.}}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool setAccountSerial ( account theAccount, string serial ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''theAccount:''' The account element to set the serial for *'''serial:...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23232|This function sets the serial number for a specified player account. It allows administrators to update or assign a new 32-character hexadecimal serial identifier to registered accounts.}}&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 setAccountSerial ( account theAccount, string serial )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theAccount:''' The account element to set the serial for&lt;br /&gt;
*'''serial:''' A valid 32-character hexadecimal string representing the new serial number&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the serial was successfully set, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Simple example: Set a serial for a player's account&lt;br /&gt;
local player = getPlayerFromName(&amp;quot;John&amp;quot;)&lt;br /&gt;
local account = getPlayerAccount(player)&lt;br /&gt;
local newSerial = &amp;quot;A1B2C3D4E5F6789012345678901234AB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if setAccountSerial(account, newSerial) then&lt;br /&gt;
    outputChatBox(&amp;quot;Serial updated successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to update serial!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Advanced example: Administrative command system&lt;br /&gt;
function changePlayerSerial(player, newSerial)&lt;br /&gt;
    local account = getPlayerAccount(player)&lt;br /&gt;
    if account and not isGuestAccount(account) then&lt;br /&gt;
        if setAccountSerial(account, newSerial) then&lt;br /&gt;
            outputChatBox(&amp;quot;Serial number updated successfully!&amp;quot;, player, 0, 255, 0)&lt;br /&gt;
            return true&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Failed to update serial number. Invalid format!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
            return false&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;You must be logged into a registered account.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Command to set a player's account serial&lt;br /&gt;
addCommandHandler(&amp;quot;setserial&amp;quot;, function(player, cmd, targetPlayer, newSerial)&lt;br /&gt;
    if not targetPlayer or not newSerial then&lt;br /&gt;
        outputChatBox(&amp;quot;Usage: /setserial &amp;lt;player&amp;gt; &amp;lt;32-char-hex-serial&amp;gt;&amp;quot;, player)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local target = getPlayerFromName(targetPlayer)&lt;br /&gt;
    if target then&lt;br /&gt;
        if string.len(newSerial) == 32 and string.match(newSerial, &amp;quot;^[A-Fa-f0-9]+$&amp;quot;) then&lt;br /&gt;
            changePlayerSerial(target, newSerial)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Serial must be 32 hexadecimal characters!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Player not found!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getAccountSerial]]&lt;br /&gt;
*[[getAccountsBySerial]]&lt;br /&gt;
*[[addAccount]]&lt;br /&gt;
*[[removeAccount]]&lt;br /&gt;
*[[isGuestAccount]]&lt;br /&gt;
*[[getPlayerAccount]]&lt;br /&gt;
{{Account functions}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ResetVehicleModelAudioSettings&amp;diff=82294</id>
		<title>ResetVehicleModelAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ResetVehicleModelAudioSettings&amp;diff=82294"/>
		<updated>2025-07-25T18:01:16Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function resets all audio settings for a specific vehicle model back to their original GTA San Andreas values. This will undo any modifications made with [[setVehicleModelAudioSetting]].}}&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 resetVehicleModelAudioSettings ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to reset audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio settings were successfully reset, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only works with standard vehicle models and cannot reset audio settings for allocated vehicles. Changes only affect newly created vehicles. Existing vehicles will retain their current audio settings.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify engine sound for Infernus (model 411)&lt;br /&gt;
setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 200)&lt;br /&gt;
setVehicleModelAudioSetting(411, &amp;quot;hornHigh&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
-- Reset all audio settings back to original&lt;br /&gt;
resetVehicleModelAudioSettings(411)&lt;br /&gt;
&lt;br /&gt;
-- New vehicles will now use original audio settings&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
{{Vehicle functions|client}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82293</id>
		<title>SetVehicleModelAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82293"/>
		<updated>2025-07-25T18:01:06Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a specific vehicle model. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&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 setVehicleModelAudioSetting ( int modelID, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect newly created vehicles. Existing vehicles will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
{{Tip|This function modifies the audio settings for a '''specific vehicle model''', affecting all newly created vehicles of that model. In contrast, [[setVehicleAudioSetting]] modifies the audio settings for a '''specific vehicle instance'''. Changes made with this function do not affect vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Engine Sound Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for Infernus (model 411)&lt;br /&gt;
setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Custom Horn Settings===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for Sultan (model 560)&lt;br /&gt;
local modelID = 560&lt;br /&gt;
&lt;br /&gt;
-- Set horn properties&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Sultan horn settings customized!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Spawn a Sultan to test the new horn&lt;br /&gt;
local testVehicle = createVehicle(modelID, 100, 100, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Radio and Door Sound Configuration===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for Elegy (model 562)&lt;br /&gt;
local elegytModel = 562&lt;br /&gt;
&lt;br /&gt;
-- Set radio properties&lt;br /&gt;
local radioSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
local radioTypeSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
&lt;br /&gt;
-- Set door sound&lt;br /&gt;
local doorSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&lt;br /&gt;
if radioSuccess and radioTypeSuccess and doorSuccess then&lt;br /&gt;
    outputChatBox(&amp;quot;Elegy audio settings configured successfully!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Create vehicle to test settings&lt;br /&gt;
    local elegy = createVehicle(elegytModel, 200, 200, 3)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Some audio settings failed to apply.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Batch Audio Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to apply custom audio profile to multiple vehicles&lt;br /&gt;
function applyCustomAudioProfile(models, profile)&lt;br /&gt;
    local successCount = 0&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local modelSuccess = true&lt;br /&gt;
        &lt;br /&gt;
        for property, value in pairs(profile) do&lt;br /&gt;
            if not setVehicleModelAudioSetting(modelID, property, value) then&lt;br /&gt;
                modelSuccess = false&lt;br /&gt;
                outputChatBox(&amp;quot;Failed to set &amp;quot; .. property .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if modelSuccess then&lt;br /&gt;
            successCount = successCount + 1&lt;br /&gt;
            outputChatBox(&amp;quot;Audio profile applied to model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return successCount&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Define custom audio profile&lt;br /&gt;
local sportCarProfile = {&lt;br /&gt;
    [&amp;quot;engineOnSoundBankID&amp;quot;] = 200,&lt;br /&gt;
    [&amp;quot;engineOffSoundBankID&amp;quot;] = 180,&lt;br /&gt;
    [&amp;quot;hornHigh&amp;quot;] = 1.8,&lt;br /&gt;
    [&amp;quot;hornVolumeDelta&amp;quot;] = 1.5,&lt;br /&gt;
    [&amp;quot;radioType&amp;quot;] = 3&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Apply to multiple sports cars&lt;br /&gt;
local sportsCars = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modifiedCount = applyCustomAudioProfile(sportsCars, sportCarProfile)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Modified audio for &amp;quot; .. modifiedCount .. &amp;quot; vehicle models&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
{{Vehicle functions|client}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82292</id>
		<title>GetVehicleModelAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82292"/>
		<updated>2025-07-25T18:00:57Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function retrieves audio properties for a specific vehicle model. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleModelAudioSettings ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to retrieve audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''table'' containing audio settings if successful, ''false'' otherwise. The returned table contains the following properties:&lt;br /&gt;
*'''sound-type''' - Sound effect type&lt;br /&gt;
*'''engine-on-soundbank-id''' - Engine startup sound bank ID (0-410)&lt;br /&gt;
*'''engine-off-soundbank-id''' - Engine shutdown sound bank ID (0-410)&lt;br /&gt;
*'''bass-setting''' - Bass settings&lt;br /&gt;
*'''bass-eq''' - Bass equalizer&lt;br /&gt;
*'''field-c''' - Field C parameter&lt;br /&gt;
*'''horn-ton''' - Horn tone&lt;br /&gt;
*'''horn-high''' - Horn high frequency&lt;br /&gt;
*'''engine-upgrade''' - Engine upgrade sound effect&lt;br /&gt;
*'''door-sound''' - Door sound effects&lt;br /&gt;
*'''radio-num''' - Radio number&lt;br /&gt;
*'''radio-type''' - Radio type&lt;br /&gt;
*'''vehicle-type-for-audio''' - Audio vehicle type&lt;br /&gt;
*'''horn-volume-delta''' - Horn volume delta&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only works with standard vehicle models. For custom models, it will return the audio settings of the parent model.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Retrieve and display the engine-on sound bank ID for Infernus (model 411)&lt;br /&gt;
local settings = getVehicleModelAudioSettings(411)&lt;br /&gt;
if settings then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine sound ID: &amp;quot; .. tostring(settings[&amp;quot;engine-on-soundbank-id&amp;quot;]))&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to retrieve audio settings.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
{{Vehicle functions|client}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleAudioSetting&amp;diff=82291</id>
		<title>SetVehicleAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleAudioSetting&amp;diff=82291"/>
		<updated>2025-07-25T18:00:49Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a '''specific vehicle instance'''. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&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 setVehicleAudioSetting ( element vehicle, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''vehicle:''' The vehicle element to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This function modifies the audio settings for a '''specific vehicle instance''', while [[setVehicleModelAudioSetting]] modifies the audio settings for all vehicles of a specific model. Changes made with setVehicleModelAudioSetting only affect newly created vehicles of that model, while changes made with setVehicleModelAudioSetting affect all newly created vehicles of that model.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect the specified vehicle instance. Other vehicles of the same model will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for a specific vehicle&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for a specific vehicle&lt;br /&gt;
local vehicle = createVehicle(560, 100, 100, 3)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for a specific vehicle&lt;br /&gt;
local vehicle = createVehicle(562, 200, 200, 3)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
{{Vehicle functions|client}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleAudioSettings&amp;diff=82290</id>
		<title>GetVehicleAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleAudioSettings&amp;diff=82290"/>
		<updated>2025-07-25T18:00:31Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function retrieves the current audio properties for a specific vehicle instance. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings that may have been customized for this particular vehicle.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleAudioSettings ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theVehicle:''' The vehicle element to retrieve audio settings from&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''table'' containing audio settings if successful, ''false'' otherwise. The returned table contains the following properties:&lt;br /&gt;
*'''sound-type''' - Sound effect type (integer)&lt;br /&gt;
*'''engine-on-soundbank-id''' - Engine startup sound bank ID (0-410)&lt;br /&gt;
*'''engine-off-soundbank-id''' - Engine shutdown sound bank ID (0-410)&lt;br /&gt;
*'''bass-setting''' - Bass settings (float)&lt;br /&gt;
*'''bass-eq''' - Bass equalizer (float)&lt;br /&gt;
*'''field-c''' - Field C parameter (float)&lt;br /&gt;
*'''horn-ton''' - Horn tone (float)&lt;br /&gt;
*'''horn-high''' - Horn high frequency (float)&lt;br /&gt;
*'''engine-upgrade''' - Engine upgrade sound effect (float)&lt;br /&gt;
*'''door-sound''' - Door sound effects (float)&lt;br /&gt;
*'''radio-num''' - Radio number (float)&lt;br /&gt;
*'''radio-type''' - Radio type (float)&lt;br /&gt;
*'''vehicle-type-for-audio''' - Audio vehicle type (float)&lt;br /&gt;
*'''horn-volume-delta''' - Horn volume delta (float)&lt;br /&gt;
&lt;br /&gt;
{{Note|This function returns the current audio settings for the specific vehicle instance. If the vehicle has custom audio settings applied via [[setVehicleAudioSetting]], those will be returned. Otherwise, it returns the default model audio settings.}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|Sound bank IDs above 410 may cause crashes. The valid range is 0-410 for engine sound bank properties.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get the player's current vehicle and display its audio settings&lt;br /&gt;
local player = getLocalPlayer()&lt;br /&gt;
local vehicle = getPedOccupiedVehicle(player)&lt;br /&gt;
&lt;br /&gt;
if vehicle then&lt;br /&gt;
    local settings = getVehicleAudioSettings(vehicle)&lt;br /&gt;
    if settings then&lt;br /&gt;
        outputChatBox(&amp;quot;=== Vehicle Audio Settings ===&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;Sound Type: &amp;quot; .. tostring(settings[&amp;quot;sound-type&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Engine On Sound Bank: &amp;quot; .. tostring(settings[&amp;quot;engine-on-soundbank-id&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Engine Off Sound Bank: &amp;quot; .. tostring(settings[&amp;quot;engine-off-soundbank-id&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Horn Tone: &amp;quot; .. tostring(settings[&amp;quot;horn-ton&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Horn High: &amp;quot; .. tostring(settings[&amp;quot;horn-high&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Door Sound: &amp;quot; .. tostring(settings[&amp;quot;door-sound&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Radio Type: &amp;quot; .. tostring(settings[&amp;quot;radio-type&amp;quot;]))&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to retrieve vehicle audio settings.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;You must be in a vehicle to use this command.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
{{Vehicle functions|client}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ResetVehicleAudioSettings&amp;diff=82289</id>
		<title>ResetVehicleAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ResetVehicleAudioSettings&amp;diff=82289"/>
		<updated>2025-07-25T17:58:54Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function resets the audio properties of a specific vehicle instance back to its model's default settings. Any custom audio settings that were applied to the vehicle using [[setVehicleAudioSetting]] will be removed, restoring the original sound characteristics.}}&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 resetVehicleAudioSettings ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theVehicle:''' The vehicle element to reset audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the vehicle audio settings were successfully reset, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only affects the specific vehicle instance, not the vehicle model's default settings. After calling this function, the vehicle will use the default audio settings for its model.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Reset audio settings for the player's current vehicle&lt;br /&gt;
local player = getLocalPlayer()&lt;br /&gt;
local vehicle = getPedOccupiedVehicle(player)&lt;br /&gt;
&lt;br /&gt;
if vehicle then&lt;br /&gt;
    local success = resetVehicleAudioSettings(vehicle)&lt;br /&gt;
    if success then&lt;br /&gt;
        outputChatBox(&amp;quot;Vehicle audio settings have been reset to default.&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to reset vehicle audio settings.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;You must be in a vehicle to use this command.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
{{Client vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ResetVehicleAudioSettings&amp;diff=82288</id>
		<title>ResetVehicleAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ResetVehicleAudioSettings&amp;diff=82288"/>
		<updated>2025-07-25T17:51:13Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{client function}} __NOTOC__ {{New feature/item|3.0161|1.6.0|23140|This function resets the audio properties of a specific vehicle instance back to its model's default settings. Any custom audio settings that were applied to the vehicle using setVehicleAudioSetting will be removed, restoring the original sound characteristics.}}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool resetVehicleAudioSettings ( vehicle theVehicle ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments===...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function resets the audio properties of a specific vehicle instance back to its model's default settings. Any custom audio settings that were applied to the vehicle using [[setVehicleAudioSetting]] will be removed, restoring the original sound characteristics.}}&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 resetVehicleAudioSettings ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theVehicle:''' The vehicle element to reset audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the vehicle audio settings were successfully reset, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only affects the specific vehicle instance, not the vehicle model's default settings. After calling this function, the vehicle will use the default audio settings for its model.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Reset audio settings for the player's current vehicle&lt;br /&gt;
local player = getLocalPlayer()&lt;br /&gt;
local vehicle = getPedOccupiedVehicle(player)&lt;br /&gt;
&lt;br /&gt;
if vehicle then&lt;br /&gt;
    local success = resetVehicleAudioSettings(vehicle)&lt;br /&gt;
    if success then&lt;br /&gt;
        outputChatBox(&amp;quot;Vehicle audio settings have been reset to default.&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to reset vehicle audio settings.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;You must be in a vehicle to use this command.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Client_Functions]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleAudioSettings&amp;diff=82287</id>
		<title>GetVehicleAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleAudioSettings&amp;diff=82287"/>
		<updated>2025-07-25T17:47:35Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{client function}} __NOTOC__ {{New feature/item|3.0161|1.6.0|23140|This function retrieves the current audio properties for a specific vehicle instance. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings that may have been customized for this particular vehicle.}}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; table getVehicleAudioSettings ( vehicle theVehicle ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Ar...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function retrieves the current audio properties for a specific vehicle instance. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings that may have been customized for this particular vehicle.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleAudioSettings ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theVehicle:''' The vehicle element to retrieve audio settings from&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''table'' containing audio settings if successful, ''false'' otherwise. The returned table contains the following properties:&lt;br /&gt;
*'''sound-type''' - Sound effect type (integer)&lt;br /&gt;
*'''engine-on-soundbank-id''' - Engine startup sound bank ID (0-410)&lt;br /&gt;
*'''engine-off-soundbank-id''' - Engine shutdown sound bank ID (0-410)&lt;br /&gt;
*'''bass-setting''' - Bass settings (float)&lt;br /&gt;
*'''bass-eq''' - Bass equalizer (float)&lt;br /&gt;
*'''field-c''' - Field C parameter (float)&lt;br /&gt;
*'''horn-ton''' - Horn tone (float)&lt;br /&gt;
*'''horn-high''' - Horn high frequency (float)&lt;br /&gt;
*'''engine-upgrade''' - Engine upgrade sound effect (float)&lt;br /&gt;
*'''door-sound''' - Door sound effects (float)&lt;br /&gt;
*'''radio-num''' - Radio number (float)&lt;br /&gt;
*'''radio-type''' - Radio type (float)&lt;br /&gt;
*'''vehicle-type-for-audio''' - Audio vehicle type (float)&lt;br /&gt;
*'''horn-volume-delta''' - Horn volume delta (float)&lt;br /&gt;
&lt;br /&gt;
{{Note|This function returns the current audio settings for the specific vehicle instance. If the vehicle has custom audio settings applied via [[setVehicleAudioSetting]], those will be returned. Otherwise, it returns the default model audio settings.}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|Sound bank IDs above 410 may cause crashes. The valid range is 0-410 for engine sound bank properties.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get the player's current vehicle and display its audio settings&lt;br /&gt;
local player = getLocalPlayer()&lt;br /&gt;
local vehicle = getPedOccupiedVehicle(player)&lt;br /&gt;
&lt;br /&gt;
if vehicle then&lt;br /&gt;
    local settings = getVehicleAudioSettings(vehicle)&lt;br /&gt;
    if settings then&lt;br /&gt;
        outputChatBox(&amp;quot;=== Vehicle Audio Settings ===&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;Sound Type: &amp;quot; .. tostring(settings[&amp;quot;sound-type&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Engine On Sound Bank: &amp;quot; .. tostring(settings[&amp;quot;engine-on-soundbank-id&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Engine Off Sound Bank: &amp;quot; .. tostring(settings[&amp;quot;engine-off-soundbank-id&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Horn Tone: &amp;quot; .. tostring(settings[&amp;quot;horn-ton&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Horn High: &amp;quot; .. tostring(settings[&amp;quot;horn-high&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Door Sound: &amp;quot; .. tostring(settings[&amp;quot;door-sound&amp;quot;]))&lt;br /&gt;
        outputChatBox(&amp;quot;Radio Type: &amp;quot; .. tostring(settings[&amp;quot;radio-type&amp;quot;]))&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to retrieve vehicle audio settings.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;You must be in a vehicle to use this command.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Client_Functions]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82286</id>
		<title>GetVehicleModelAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82286"/>
		<updated>2025-07-25T17:34:41Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Simplify examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function retrieves audio properties for a specific vehicle model. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleModelAudioSettings ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to retrieve audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''table'' containing audio settings if successful, ''false'' otherwise. The returned table contains the following properties:&lt;br /&gt;
*'''sound-type''' - Sound effect type&lt;br /&gt;
*'''engine-on-soundbank-id''' - Engine startup sound bank ID (0-410)&lt;br /&gt;
*'''engine-off-soundbank-id''' - Engine shutdown sound bank ID (0-410)&lt;br /&gt;
*'''bass-setting''' - Bass settings&lt;br /&gt;
*'''bass-eq''' - Bass equalizer&lt;br /&gt;
*'''field-c''' - Field C parameter&lt;br /&gt;
*'''horn-ton''' - Horn tone&lt;br /&gt;
*'''horn-high''' - Horn high frequency&lt;br /&gt;
*'''engine-upgrade''' - Engine upgrade sound effect&lt;br /&gt;
*'''door-sound''' - Door sound effects&lt;br /&gt;
*'''radio-num''' - Radio number&lt;br /&gt;
*'''radio-type''' - Radio type&lt;br /&gt;
*'''vehicle-type-for-audio''' - Audio vehicle type&lt;br /&gt;
*'''horn-volume-delta''' - Horn volume delta&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only works with standard vehicle models. For custom models, it will return the audio settings of the parent model.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Retrieve and display the engine-on sound bank ID for Infernus (model 411)&lt;br /&gt;
local settings = getVehicleModelAudioSettings(411)&lt;br /&gt;
if settings then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine sound ID: &amp;quot; .. tostring(settings[&amp;quot;engine-on-soundbank-id&amp;quot;]))&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to retrieve audio settings.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleAudioSetting&amp;diff=82285</id>
		<title>SetVehicleAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleAudioSetting&amp;diff=82285"/>
		<updated>2025-07-25T17:31:54Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{client function}} __NOTOC__ {{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a '''specific vehicle instance'''. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool setVehicleAudioSetting ( element vehicle, string property, float value ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''vehicle:''' The vehicle el...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a '''specific vehicle instance'''. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&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 setVehicleAudioSetting ( element vehicle, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''vehicle:''' The vehicle element to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Tip|This function modifies the audio settings for a '''specific vehicle instance''', while [[setVehicleModelAudioSetting]] modifies the audio settings for all vehicles of a specific model. Changes made with setVehicleModelAudioSetting only affect newly created vehicles of that model, while changes made with setVehicleModelAudioSetting affect all newly created vehicles of that model.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect the specified vehicle instance. Other vehicles of the same model will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for a specific vehicle&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for a specific vehicle&lt;br /&gt;
local vehicle = createVehicle(560, 100, 100, 3)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for a specific vehicle&lt;br /&gt;
local vehicle = createVehicle(562, 200, 200, 3)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
setVehicleAudioSetting(vehicle, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82284</id>
		<title>SetVehicleModelAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82284"/>
		<updated>2025-07-25T17:30:48Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a specific vehicle model. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&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 setVehicleModelAudioSetting ( int modelID, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect newly created vehicles. Existing vehicles will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
{{Tip|This function modifies the audio settings for a '''specific vehicle model''', affecting all newly created vehicles of that model. In contrast, [[setVehicleAudioSetting]] modifies the audio settings for a '''specific vehicle instance'''. Changes made with this function do not affect vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Engine Sound Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for Infernus (model 411)&lt;br /&gt;
setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Custom Horn Settings===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for Sultan (model 560)&lt;br /&gt;
local modelID = 560&lt;br /&gt;
&lt;br /&gt;
-- Set horn properties&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Sultan horn settings customized!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Spawn a Sultan to test the new horn&lt;br /&gt;
local testVehicle = createVehicle(modelID, 100, 100, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Radio and Door Sound Configuration===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for Elegy (model 562)&lt;br /&gt;
local elegytModel = 562&lt;br /&gt;
&lt;br /&gt;
-- Set radio properties&lt;br /&gt;
local radioSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
local radioTypeSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
&lt;br /&gt;
-- Set door sound&lt;br /&gt;
local doorSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&lt;br /&gt;
if radioSuccess and radioTypeSuccess and doorSuccess then&lt;br /&gt;
    outputChatBox(&amp;quot;Elegy audio settings configured successfully!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Create vehicle to test settings&lt;br /&gt;
    local elegy = createVehicle(elegytModel, 200, 200, 3)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Some audio settings failed to apply.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Batch Audio Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to apply custom audio profile to multiple vehicles&lt;br /&gt;
function applyCustomAudioProfile(models, profile)&lt;br /&gt;
    local successCount = 0&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local modelSuccess = true&lt;br /&gt;
        &lt;br /&gt;
        for property, value in pairs(profile) do&lt;br /&gt;
            if not setVehicleModelAudioSetting(modelID, property, value) then&lt;br /&gt;
                modelSuccess = false&lt;br /&gt;
                outputChatBox(&amp;quot;Failed to set &amp;quot; .. property .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if modelSuccess then&lt;br /&gt;
            successCount = successCount + 1&lt;br /&gt;
            outputChatBox(&amp;quot;Audio profile applied to model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return successCount&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Define custom audio profile&lt;br /&gt;
local sportCarProfile = {&lt;br /&gt;
    [&amp;quot;engineOnSoundBankID&amp;quot;] = 200,&lt;br /&gt;
    [&amp;quot;engineOffSoundBankID&amp;quot;] = 180,&lt;br /&gt;
    [&amp;quot;hornHigh&amp;quot;] = 1.8,&lt;br /&gt;
    [&amp;quot;hornVolumeDelta&amp;quot;] = 1.5,&lt;br /&gt;
    [&amp;quot;radioType&amp;quot;] = 3&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Apply to multiple sports cars&lt;br /&gt;
local sportsCars = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modifiedCount = applyCustomAudioProfile(sportsCars, sportCarProfile)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Modified audio for &amp;quot; .. modifiedCount .. &amp;quot; vehicle models&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82283</id>
		<title>SetVehicleModelAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82283"/>
		<updated>2025-07-25T17:28:59Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a specific vehicle model. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&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 setVehicleModelAudioSetting ( int modelID, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect newly created vehicles. Existing vehicles will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
{{Tip|This function modifies the audio settings for a '''specific vehicle model''', affecting all newly created vehicles of that model. In contrast, [[setVehicleAudioSetting]] modifies the audio settings for a '''specific vehicle instance'''. Changes made with this function do not affect vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Engine Sound Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for Infernus (model 411)&lt;br /&gt;
local success = setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
if success then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine sound modified successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to modify engine sound.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Create an Infernus to hear the new sound&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Custom Horn Settings===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for Sultan (model 560)&lt;br /&gt;
local modelID = 560&lt;br /&gt;
&lt;br /&gt;
-- Set horn properties&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Sultan horn settings customized!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Spawn a Sultan to test the new horn&lt;br /&gt;
local testVehicle = createVehicle(modelID, 100, 100, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Radio and Door Sound Configuration===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for Elegy (model 562)&lt;br /&gt;
local elegytModel = 562&lt;br /&gt;
&lt;br /&gt;
-- Set radio properties&lt;br /&gt;
local radioSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
local radioTypeSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
&lt;br /&gt;
-- Set door sound&lt;br /&gt;
local doorSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&lt;br /&gt;
if radioSuccess and radioTypeSuccess and doorSuccess then&lt;br /&gt;
    outputChatBox(&amp;quot;Elegy audio settings configured successfully!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Create vehicle to test settings&lt;br /&gt;
    local elegy = createVehicle(elegytModel, 200, 200, 3)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Some audio settings failed to apply.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Batch Audio Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to apply custom audio profile to multiple vehicles&lt;br /&gt;
function applyCustomAudioProfile(models, profile)&lt;br /&gt;
    local successCount = 0&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local modelSuccess = true&lt;br /&gt;
        &lt;br /&gt;
        for property, value in pairs(profile) do&lt;br /&gt;
            if not setVehicleModelAudioSetting(modelID, property, value) then&lt;br /&gt;
                modelSuccess = false&lt;br /&gt;
                outputChatBox(&amp;quot;Failed to set &amp;quot; .. property .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if modelSuccess then&lt;br /&gt;
            successCount = successCount + 1&lt;br /&gt;
            outputChatBox(&amp;quot;Audio profile applied to model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return successCount&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Define custom audio profile&lt;br /&gt;
local sportCarProfile = {&lt;br /&gt;
    [&amp;quot;engineOnSoundBankID&amp;quot;] = 200,&lt;br /&gt;
    [&amp;quot;engineOffSoundBankID&amp;quot;] = 180,&lt;br /&gt;
    [&amp;quot;hornHigh&amp;quot;] = 1.8,&lt;br /&gt;
    [&amp;quot;hornVolumeDelta&amp;quot;] = 1.5,&lt;br /&gt;
    [&amp;quot;radioType&amp;quot;] = 3&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Apply to multiple sports cars&lt;br /&gt;
local sportsCars = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modifiedCount = applyCustomAudioProfile(sportsCars, sportCarProfile)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Modified audio for &amp;quot; .. modifiedCount .. &amp;quot; vehicle models&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ResetVehicleModelAudioSettings&amp;diff=82282</id>
		<title>ResetVehicleModelAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ResetVehicleModelAudioSettings&amp;diff=82282"/>
		<updated>2025-07-25T17:03:19Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{client function}} __NOTOC__ {{New feature/item|3.0161|1.6.0|23140|This function resets all audio settings for a specific vehicle model back to their original GTA San Andreas values. This will undo any modifications made with setVehicleModelAudioSetting.}}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool resetVehicleModelAudioSettings ( int modelID ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''modelID:''' The vehicle model ID to reset audio settings for  ===Return...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function resets all audio settings for a specific vehicle model back to their original GTA San Andreas values. This will undo any modifications made with [[setVehicleModelAudioSetting]].}}&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 resetVehicleModelAudioSettings ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to reset audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio settings were successfully reset, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only works with standard vehicle models and cannot reset audio settings for allocated vehicles. Changes only affect newly created vehicles. Existing vehicles will retain their current audio settings.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify engine sound for Infernus (model 411)&lt;br /&gt;
setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 200)&lt;br /&gt;
setVehicleModelAudioSetting(411, &amp;quot;hornHigh&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
-- Reset all audio settings back to original&lt;br /&gt;
resetVehicleModelAudioSettings(411)&lt;br /&gt;
&lt;br /&gt;
-- New vehicles will now use original audio settings&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82281</id>
		<title>GetVehicleModelAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82281"/>
		<updated>2025-07-25T17:01:14Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function retrieves audio properties for a specific vehicle model. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleModelAudioSettings ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to retrieve audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''table'' containing audio settings if successful, ''false'' otherwise. The returned table contains the following properties:&lt;br /&gt;
*'''sound-type''' - Sound effect type&lt;br /&gt;
*'''engine-on-soundbank-id''' - Engine startup sound bank ID (0-410)&lt;br /&gt;
*'''engine-off-soundbank-id''' - Engine shutdown sound bank ID (0-410)&lt;br /&gt;
*'''bass-setting''' - Bass settings&lt;br /&gt;
*'''bass-eq''' - Bass equalizer&lt;br /&gt;
*'''field-c''' - Field C parameter&lt;br /&gt;
*'''horn-ton''' - Horn tone&lt;br /&gt;
*'''horn-high''' - Horn high frequency&lt;br /&gt;
*'''engine-upgrade''' - Engine upgrade sound effect&lt;br /&gt;
*'''door-sound''' - Door sound effects&lt;br /&gt;
*'''radio-num''' - Radio number&lt;br /&gt;
*'''radio-type''' - Radio type&lt;br /&gt;
*'''vehicle-type-for-audio''' - Audio vehicle type&lt;br /&gt;
*'''horn-volume-delta''' - Horn volume delta&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only works with standard vehicle models. For custom models, it will return the audio settings of the parent model.}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Audio Settings Retrieval===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get audio settings for Infernus (model 411)&lt;br /&gt;
local audioSettings = getVehicleModelAudioSettings(411)&lt;br /&gt;
if audioSettings then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine on sound bank: &amp;quot; .. audioSettings[&amp;quot;engine-on-soundbank-id&amp;quot;])&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine off sound bank: &amp;quot; .. audioSettings[&amp;quot;engine-off-soundbank-id&amp;quot;])&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus horn tone: &amp;quot; .. audioSettings[&amp;quot;horn-ton&amp;quot;])&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to retrieve audio settings for Infernus&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Compare Audio Settings Between Models===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Compare audio settings between different vehicle models&lt;br /&gt;
local models = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modelNames = {&amp;quot;Infernus&amp;quot;, &amp;quot;Super GT&amp;quot;, &amp;quot;Turismo&amp;quot;, &amp;quot;Alpha&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;=== Vehicle Audio Comparison ===&amp;quot;)&lt;br /&gt;
for i, modelID in ipairs(models) do&lt;br /&gt;
    local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
    if audioSettings then&lt;br /&gt;
        outputChatBox(modelNames[i] .. &amp;quot;:&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;  Engine On Bank: &amp;quot; .. audioSettings[&amp;quot;engine-on-soundbank-id&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;  Engine Off Bank: &amp;quot; .. audioSettings[&amp;quot;engine-off-soundbank-id&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;  Horn Volume Delta: &amp;quot; .. audioSettings[&amp;quot;horn-volume-delta&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;  Radio Type: &amp;quot; .. audioSettings[&amp;quot;radio-type&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;---&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Audio Settings Inspector===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to display all audio properties of a vehicle model&lt;br /&gt;
function inspectVehicleAudio(modelID)&lt;br /&gt;
    local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
    if not audioSettings then&lt;br /&gt;
        outputChatBox(&amp;quot;Invalid model ID or failed to retrieve audio settings&amp;quot;)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    outputChatBox(&amp;quot;=== Audio Settings for Model &amp;quot; .. modelID .. &amp;quot; ===&amp;quot;)&lt;br /&gt;
    for property, value in pairs(audioSettings) do&lt;br /&gt;
        outputChatBox(property .. &amp;quot;: &amp;quot; .. tostring(value))&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Example usage&lt;br /&gt;
inspectVehicleAudio(411) -- Inspect Infernus audio settings&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Audio Profile Backup System===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to backup audio settings for multiple models&lt;br /&gt;
function backupAudioSettings(models)&lt;br /&gt;
    local backup = {}&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
        if audioSettings then&lt;br /&gt;
            backup[modelID] = audioSettings&lt;br /&gt;
            outputChatBox(&amp;quot;Backed up audio settings for model &amp;quot; .. modelID)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Failed to backup audio settings for model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return backup&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Function to display backup information&lt;br /&gt;
function displayBackupInfo(backup)&lt;br /&gt;
    outputChatBox(&amp;quot;=== Audio Settings Backup ===&amp;quot;)&lt;br /&gt;
    for modelID, settings in pairs(backup) do&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot; has &amp;quot; .. table.size(settings) .. &amp;quot; audio properties&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Example usage&lt;br /&gt;
local sportsCars = {411, 506, 451, 602}&lt;br /&gt;
local audioBackup = backupAudioSettings(sportsCars)&lt;br /&gt;
displayBackupInfo(audioBackup)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 5: Audio Settings Validation===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to validate audio settings and check for potential issues&lt;br /&gt;
function validateAudioSettings(modelID)&lt;br /&gt;
    local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
    if not audioSettings then&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot;: Invalid model or failed to retrieve settings&amp;quot;)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local issues = {}&lt;br /&gt;
    &lt;br /&gt;
    -- Check engine sound bank IDs&lt;br /&gt;
    if audioSettings[&amp;quot;engine-on-soundbank-id&amp;quot;] &amp;gt; 410 then&lt;br /&gt;
        table.insert(issues, &amp;quot;Engine-on sound bank ID exceeds safe limit (410)&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if audioSettings[&amp;quot;engine-off-soundbank-id&amp;quot;] &amp;gt; 410 then&lt;br /&gt;
        table.insert(issues, &amp;quot;Engine-off sound bank ID exceeds safe limit (410)&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Check for unusual values&lt;br /&gt;
    if audioSettings[&amp;quot;horn-volume-delta&amp;quot;] &amp;lt; 0 then&lt;br /&gt;
        table.insert(issues, &amp;quot;Horn volume delta is negative&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if #issues &amp;gt; 0 then&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot; audio issues found:&amp;quot;)&lt;br /&gt;
        for _, issue in ipairs(issues) do&lt;br /&gt;
            outputChatBox(&amp;quot;  - &amp;quot; .. issue)&lt;br /&gt;
        end&lt;br /&gt;
        return false&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot; audio settings are valid&amp;quot;)&lt;br /&gt;
        return true&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Validate audio settings for multiple models&lt;br /&gt;
local modelsToCheck = {411, 560, 562, 451}&lt;br /&gt;
for _, modelID in ipairs(modelsToCheck) do&lt;br /&gt;
    validateAudioSettings(modelID)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82280</id>
		<title>SetVehicleModelAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82280"/>
		<updated>2025-07-25T17:01:01Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a specific vehicle model. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&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 setVehicleModelAudioSetting ( int modelID, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect newly created vehicles. Existing vehicles will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Engine Sound Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for Infernus (model 411)&lt;br /&gt;
local success = setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
if success then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine sound modified successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to modify engine sound.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Create an Infernus to hear the new sound&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Custom Horn Settings===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for Sultan (model 560)&lt;br /&gt;
local modelID = 560&lt;br /&gt;
&lt;br /&gt;
-- Set horn properties&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Sultan horn settings customized!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Spawn a Sultan to test the new horn&lt;br /&gt;
local testVehicle = createVehicle(modelID, 100, 100, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Radio and Door Sound Configuration===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for Elegy (model 562)&lt;br /&gt;
local elegytModel = 562&lt;br /&gt;
&lt;br /&gt;
-- Set radio properties&lt;br /&gt;
local radioSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
local radioTypeSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
&lt;br /&gt;
-- Set door sound&lt;br /&gt;
local doorSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&lt;br /&gt;
if radioSuccess and radioTypeSuccess and doorSuccess then&lt;br /&gt;
    outputChatBox(&amp;quot;Elegy audio settings configured successfully!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Create vehicle to test settings&lt;br /&gt;
    local elegy = createVehicle(elegytModel, 200, 200, 3)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Some audio settings failed to apply.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Batch Audio Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to apply custom audio profile to multiple vehicles&lt;br /&gt;
function applyCustomAudioProfile(models, profile)&lt;br /&gt;
    local successCount = 0&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local modelSuccess = true&lt;br /&gt;
        &lt;br /&gt;
        for property, value in pairs(profile) do&lt;br /&gt;
            if not setVehicleModelAudioSetting(modelID, property, value) then&lt;br /&gt;
                modelSuccess = false&lt;br /&gt;
                outputChatBox(&amp;quot;Failed to set &amp;quot; .. property .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if modelSuccess then&lt;br /&gt;
            successCount = successCount + 1&lt;br /&gt;
            outputChatBox(&amp;quot;Audio profile applied to model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return successCount&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Define custom audio profile&lt;br /&gt;
local sportCarProfile = {&lt;br /&gt;
    [&amp;quot;engineOnSoundBankID&amp;quot;] = 200,&lt;br /&gt;
    [&amp;quot;engineOffSoundBankID&amp;quot;] = 180,&lt;br /&gt;
    [&amp;quot;hornHigh&amp;quot;] = 1.8,&lt;br /&gt;
    [&amp;quot;hornVolumeDelta&amp;quot;] = 1.5,&lt;br /&gt;
    [&amp;quot;radioType&amp;quot;] = 3&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Apply to multiple sports cars&lt;br /&gt;
local sportsCars = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modifiedCount = applyCustomAudioProfile(sportsCars, sportCarProfile)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Modified audio for &amp;quot; .. modifiedCount .. &amp;quot; vehicle models&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 5: Engine Sound Bank Validation===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to safely set engine sound with validation&lt;br /&gt;
function setEngineSound(modelID, bankID, isEngineOn)&lt;br /&gt;
    -- Validate sound bank ID (must be &amp;lt;= 410)&lt;br /&gt;
    if bankID &amp;gt; 410 then&lt;br /&gt;
        outputChatBox(&amp;quot;Error: Sound bank ID must be 410 or lower&amp;quot;)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local property = isEngineOn and &amp;quot;engineOnSoundBankID&amp;quot; or &amp;quot;engineOffSoundBankID&amp;quot;&lt;br /&gt;
    local success = setVehicleModelAudioSetting(modelID, property, bankID)&lt;br /&gt;
    &lt;br /&gt;
    if success then&lt;br /&gt;
        local stateText = isEngineOn and &amp;quot;on&amp;quot; or &amp;quot;off&amp;quot;&lt;br /&gt;
        outputChatBox(&amp;quot;Engine &amp;quot; .. stateText .. &amp;quot; sound set to bank &amp;quot; .. bankID .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to set engine sound for model &amp;quot; .. modelID)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return success&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Example usage&lt;br /&gt;
setEngineSound(411, 250, true)  -- Set engine on sound&lt;br /&gt;
setEngineSound(411, 230, false) -- Set engine off sound&lt;br /&gt;
setEngineSound(411, 450, true)  -- This will fail due to validation&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82279</id>
		<title>GetVehicleModelAudioSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleModelAudioSettings&amp;diff=82279"/>
		<updated>2025-07-25T16:56:19Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{client function}} __NOTOC__ {{New feature/item|3.0161|1.6.0|23140|This function retrieves audio properties for a specific vehicle model. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; table getVehicleModelAudioSettings ( int modelID ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''modelID:''' The vehicle model ID to retrieve audio settings...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function retrieves audio properties for a specific vehicle model. It allows inspection of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleModelAudioSettings ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to retrieve audio settings for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''table'' containing audio settings if successful, ''false'' otherwise. The returned table contains the following properties:&lt;br /&gt;
*'''sound-type''' - Sound effect type&lt;br /&gt;
*'''engine-on-soundbank-id''' - Engine startup sound bank ID (0-410)&lt;br /&gt;
*'''engine-off-soundbank-id''' - Engine shutdown sound bank ID (0-410)&lt;br /&gt;
*'''bass-setting''' - Bass settings&lt;br /&gt;
*'''bass-eq''' - Bass equalizer&lt;br /&gt;
*'''field-c''' - Field C parameter&lt;br /&gt;
*'''horn-ton''' - Horn tone&lt;br /&gt;
*'''horn-high''' - Horn high frequency&lt;br /&gt;
*'''engine-upgrade''' - Engine upgrade sound effect&lt;br /&gt;
*'''door-sound''' - Door sound effects&lt;br /&gt;
*'''radio-num''' - Radio number&lt;br /&gt;
*'''radio-type''' - Radio type&lt;br /&gt;
*'''vehicle-type-for-audio''' - Audio vehicle type&lt;br /&gt;
*'''horn-volume-delta''' - Horn volume delta&lt;br /&gt;
&lt;br /&gt;
{{Note|This function only works with standard vehicle models. For custom models, it will return the audio settings of the parent model.}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Audio Settings Retrieval===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Get audio settings for Infernus (model 411)&lt;br /&gt;
local audioSettings = getVehicleModelAudioSettings(411)&lt;br /&gt;
if audioSettings then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine on sound bank: &amp;quot; .. audioSettings[&amp;quot;engine-on-soundbank-id&amp;quot;])&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine off sound bank: &amp;quot; .. audioSettings[&amp;quot;engine-off-soundbank-id&amp;quot;])&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus horn tone: &amp;quot; .. audioSettings[&amp;quot;horn-ton&amp;quot;])&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to retrieve audio settings for Infernus&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Compare Audio Settings Between Models===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Compare audio settings between different vehicle models&lt;br /&gt;
local models = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modelNames = {&amp;quot;Infernus&amp;quot;, &amp;quot;Super GT&amp;quot;, &amp;quot;Turismo&amp;quot;, &amp;quot;Alpha&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;=== Vehicle Audio Comparison ===&amp;quot;)&lt;br /&gt;
for i, modelID in ipairs(models) do&lt;br /&gt;
    local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
    if audioSettings then&lt;br /&gt;
        outputChatBox(modelNames[i] .. &amp;quot;:&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;  Engine On Bank: &amp;quot; .. audioSettings[&amp;quot;engine-on-soundbank-id&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;  Engine Off Bank: &amp;quot; .. audioSettings[&amp;quot;engine-off-soundbank-id&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;  Horn Volume Delta: &amp;quot; .. audioSettings[&amp;quot;horn-volume-delta&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;  Radio Type: &amp;quot; .. audioSettings[&amp;quot;radio-type&amp;quot;])&lt;br /&gt;
        outputChatBox(&amp;quot;---&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Audio Settings Inspector===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to display all audio properties of a vehicle model&lt;br /&gt;
function inspectVehicleAudio(modelID)&lt;br /&gt;
    local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
    if not audioSettings then&lt;br /&gt;
        outputChatBox(&amp;quot;Invalid model ID or failed to retrieve audio settings&amp;quot;)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    outputChatBox(&amp;quot;=== Audio Settings for Model &amp;quot; .. modelID .. &amp;quot; ===&amp;quot;)&lt;br /&gt;
    for property, value in pairs(audioSettings) do&lt;br /&gt;
        outputChatBox(property .. &amp;quot;: &amp;quot; .. tostring(value))&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Example usage&lt;br /&gt;
inspectVehicleAudio(411) -- Inspect Infernus audio settings&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Audio Profile Backup System===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to backup audio settings for multiple models&lt;br /&gt;
function backupAudioSettings(models)&lt;br /&gt;
    local backup = {}&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
        if audioSettings then&lt;br /&gt;
            backup[modelID] = audioSettings&lt;br /&gt;
            outputChatBox(&amp;quot;Backed up audio settings for model &amp;quot; .. modelID)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Failed to backup audio settings for model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return backup&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Function to display backup information&lt;br /&gt;
function displayBackupInfo(backup)&lt;br /&gt;
    outputChatBox(&amp;quot;=== Audio Settings Backup ===&amp;quot;)&lt;br /&gt;
    for modelID, settings in pairs(backup) do&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot; has &amp;quot; .. table.size(settings) .. &amp;quot; audio properties&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Example usage&lt;br /&gt;
local sportsCars = {411, 506, 451, 602}&lt;br /&gt;
local audioBackup = backupAudioSettings(sportsCars)&lt;br /&gt;
displayBackupInfo(audioBackup)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 5: Audio Settings Validation===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to validate audio settings and check for potential issues&lt;br /&gt;
function validateAudioSettings(modelID)&lt;br /&gt;
    local audioSettings = getVehicleModelAudioSettings(modelID)&lt;br /&gt;
    if not audioSettings then&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot;: Invalid model or failed to retrieve settings&amp;quot;)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local issues = {}&lt;br /&gt;
    &lt;br /&gt;
    -- Check engine sound bank IDs&lt;br /&gt;
    if audioSettings[&amp;quot;engine-on-soundbank-id&amp;quot;] &amp;gt; 410 then&lt;br /&gt;
        table.insert(issues, &amp;quot;Engine-on sound bank ID exceeds safe limit (410)&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if audioSettings[&amp;quot;engine-off-soundbank-id&amp;quot;] &amp;gt; 410 then&lt;br /&gt;
        table.insert(issues, &amp;quot;Engine-off sound bank ID exceeds safe limit (410)&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Check for unusual values&lt;br /&gt;
    if audioSettings[&amp;quot;horn-volume-delta&amp;quot;] &amp;lt; 0 then&lt;br /&gt;
        table.insert(issues, &amp;quot;Horn volume delta is negative&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if #issues &amp;gt; 0 then&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot; audio issues found:&amp;quot;)&lt;br /&gt;
        for _, issue in ipairs(issues) do&lt;br /&gt;
            outputChatBox(&amp;quot;  - &amp;quot; .. issue)&lt;br /&gt;
        end&lt;br /&gt;
        return false&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Model &amp;quot; .. modelID .. &amp;quot; audio settings are valid&amp;quot;)&lt;br /&gt;
        return true&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Validate audio settings for multiple models&lt;br /&gt;
local modelsToCheck = {411, 560, 562, 451}&lt;br /&gt;
for _, modelID in ipairs(modelsToCheck) do&lt;br /&gt;
    validateAudioSettings(modelID)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[setVehicleModelAudioSetting]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
&lt;br /&gt;
''author: Mohab''&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82278</id>
		<title>SetVehicleModelAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82278"/>
		<updated>2025-07-25T16:52:27Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23140|This function sets audio properties for a specific vehicle model. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.}}&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 setVehicleModelAudioSetting ( int modelID, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect newly created vehicles. Existing vehicles will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Engine Sound Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for Infernus (model 411)&lt;br /&gt;
local success = setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
if success then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine sound modified successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to modify engine sound.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Create an Infernus to hear the new sound&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Custom Horn Settings===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for Sultan (model 560)&lt;br /&gt;
local modelID = 560&lt;br /&gt;
&lt;br /&gt;
-- Set horn properties&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Sultan horn settings customized!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Spawn a Sultan to test the new horn&lt;br /&gt;
local testVehicle = createVehicle(modelID, 100, 100, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Radio and Door Sound Configuration===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for Elegy (model 562)&lt;br /&gt;
local elegytModel = 562&lt;br /&gt;
&lt;br /&gt;
-- Set radio properties&lt;br /&gt;
local radioSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
local radioTypeSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
&lt;br /&gt;
-- Set door sound&lt;br /&gt;
local doorSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&lt;br /&gt;
if radioSuccess and radioTypeSuccess and doorSuccess then&lt;br /&gt;
    outputChatBox(&amp;quot;Elegy audio settings configured successfully!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Create vehicle to test settings&lt;br /&gt;
    local elegy = createVehicle(elegytModel, 200, 200, 3)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Some audio settings failed to apply.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Batch Audio Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to apply custom audio profile to multiple vehicles&lt;br /&gt;
function applyCustomAudioProfile(models, profile)&lt;br /&gt;
    local successCount = 0&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local modelSuccess = true&lt;br /&gt;
        &lt;br /&gt;
        for property, value in pairs(profile) do&lt;br /&gt;
            if not setVehicleModelAudioSetting(modelID, property, value) then&lt;br /&gt;
                modelSuccess = false&lt;br /&gt;
                outputChatBox(&amp;quot;Failed to set &amp;quot; .. property .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if modelSuccess then&lt;br /&gt;
            successCount = successCount + 1&lt;br /&gt;
            outputChatBox(&amp;quot;Audio profile applied to model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return successCount&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Define custom audio profile&lt;br /&gt;
local sportCarProfile = {&lt;br /&gt;
    [&amp;quot;engineOnSoundBankID&amp;quot;] = 200,&lt;br /&gt;
    [&amp;quot;engineOffSoundBankID&amp;quot;] = 180,&lt;br /&gt;
    [&amp;quot;hornHigh&amp;quot;] = 1.8,&lt;br /&gt;
    [&amp;quot;hornVolumeDelta&amp;quot;] = 1.5,&lt;br /&gt;
    [&amp;quot;radioType&amp;quot;] = 3&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Apply to multiple sports cars&lt;br /&gt;
local sportsCars = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modifiedCount = applyCustomAudioProfile(sportsCars, sportCarProfile)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Modified audio for &amp;quot; .. modifiedCount .. &amp;quot; vehicle models&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 5: Engine Sound Bank Validation===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to safely set engine sound with validation&lt;br /&gt;
function setEngineSound(modelID, bankID, isEngineOn)&lt;br /&gt;
    -- Validate sound bank ID (must be &amp;lt;= 410)&lt;br /&gt;
    if bankID &amp;gt; 410 then&lt;br /&gt;
        outputChatBox(&amp;quot;Error: Sound bank ID must be 410 or lower&amp;quot;)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local property = isEngineOn and &amp;quot;engineOnSoundBankID&amp;quot; or &amp;quot;engineOffSoundBankID&amp;quot;&lt;br /&gt;
    local success = setVehicleModelAudioSetting(modelID, property, bankID)&lt;br /&gt;
    &lt;br /&gt;
    if success then&lt;br /&gt;
        local stateText = isEngineOn and &amp;quot;on&amp;quot; or &amp;quot;off&amp;quot;&lt;br /&gt;
        outputChatBox(&amp;quot;Engine &amp;quot; .. stateText .. &amp;quot; sound set to bank &amp;quot; .. bankID .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to set engine sound for model &amp;quot; .. modelID)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return success&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Example usage&lt;br /&gt;
setEngineSound(411, 250, true)  -- Set engine on sound&lt;br /&gt;
setEngineSound(411, 230, false) -- Set engine off sound&lt;br /&gt;
setEngineSound(411, 450, true)  -- This will fail due to validation&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
&lt;br /&gt;
''author: Mohab''&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82276</id>
		<title>SetVehicleModelAudioSetting</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleModelAudioSetting&amp;diff=82276"/>
		<updated>2025-07-25T16:38:54Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{client function}} __NOTOC__ This function sets audio properties for a specific vehicle model. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool setVehicleModelAudioSetting ( int modelID, string property, float value ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''modelID:''' The vehicle model ID to modify audio settings for *'''property...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function sets audio properties for a specific vehicle model. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.&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 setVehicleModelAudioSetting ( int modelID, string property, float value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''modelID:''' The vehicle model ID to modify audio settings for&lt;br /&gt;
*'''property:''' The audio property to set. Valid properties are:&lt;br /&gt;
**&amp;quot;doorSound&amp;quot; - Door sound effects&lt;br /&gt;
**&amp;quot;engineOffSoundBankID&amp;quot; - Engine off sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;engineOnSoundBankID&amp;quot; - Engine on sound bank ID (0-410)&lt;br /&gt;
**&amp;quot;hornHigh&amp;quot; - Horn high frequency&lt;br /&gt;
**&amp;quot;hornTon&amp;quot; - Horn tone&lt;br /&gt;
**&amp;quot;hornVolumeDelta&amp;quot; - Horn volume delta&lt;br /&gt;
**&amp;quot;radioNum&amp;quot; - Radio number&lt;br /&gt;
**&amp;quot;radioType&amp;quot; - Radio type&lt;br /&gt;
*'''value:''' The numerical value to set for the specified property&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the audio setting was successfully applied, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{Note|Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect newly created vehicles. Existing vehicles will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Engine Sound Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Modify the engine sound for Infernus (model 411)&lt;br /&gt;
local success = setVehicleModelAudioSetting(411, &amp;quot;engineOnSoundBankID&amp;quot;, 150)&lt;br /&gt;
if success then&lt;br /&gt;
    outputChatBox(&amp;quot;Infernus engine sound modified successfully!&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Failed to modify engine sound.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Create an Infernus to hear the new sound&lt;br /&gt;
local vehicle = createVehicle(411, 0, 0, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Custom Horn Settings===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Customize horn settings for Sultan (model 560)&lt;br /&gt;
local modelID = 560&lt;br /&gt;
&lt;br /&gt;
-- Set horn properties&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornHigh&amp;quot;, 1.5)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornTon&amp;quot;, 0.8)&lt;br /&gt;
setVehicleModelAudioSetting(modelID, &amp;quot;hornVolumeDelta&amp;quot;, 2.0)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Sultan horn settings customized!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Spawn a Sultan to test the new horn&lt;br /&gt;
local testVehicle = createVehicle(modelID, 100, 100, 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Radio and Door Sound Configuration===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Configure radio and door sounds for Elegy (model 562)&lt;br /&gt;
local elegytModel = 562&lt;br /&gt;
&lt;br /&gt;
-- Set radio properties&lt;br /&gt;
local radioSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioNum&amp;quot;, 5)&lt;br /&gt;
local radioTypeSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;radioType&amp;quot;, 2)&lt;br /&gt;
&lt;br /&gt;
-- Set door sound&lt;br /&gt;
local doorSuccess = setVehicleModelAudioSetting(elegytModel, &amp;quot;doorSound&amp;quot;, 1.2)&lt;br /&gt;
&lt;br /&gt;
if radioSuccess and radioTypeSuccess and doorSuccess then&lt;br /&gt;
    outputChatBox(&amp;quot;Elegy audio settings configured successfully!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Create vehicle to test settings&lt;br /&gt;
    local elegy = createVehicle(elegytModel, 200, 200, 3)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Some audio settings failed to apply.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Batch Audio Modification===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to apply custom audio profile to multiple vehicles&lt;br /&gt;
function applyCustomAudioProfile(models, profile)&lt;br /&gt;
    local successCount = 0&lt;br /&gt;
    &lt;br /&gt;
    for _, modelID in ipairs(models) do&lt;br /&gt;
        local modelSuccess = true&lt;br /&gt;
        &lt;br /&gt;
        for property, value in pairs(profile) do&lt;br /&gt;
            if not setVehicleModelAudioSetting(modelID, property, value) then&lt;br /&gt;
                modelSuccess = false&lt;br /&gt;
                outputChatBox(&amp;quot;Failed to set &amp;quot; .. property .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if modelSuccess then&lt;br /&gt;
            successCount = successCount + 1&lt;br /&gt;
            outputChatBox(&amp;quot;Audio profile applied to model &amp;quot; .. modelID)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return successCount&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Define custom audio profile&lt;br /&gt;
local sportCarProfile = {&lt;br /&gt;
    [&amp;quot;engineOnSoundBankID&amp;quot;] = 200,&lt;br /&gt;
    [&amp;quot;engineOffSoundBankID&amp;quot;] = 180,&lt;br /&gt;
    [&amp;quot;hornHigh&amp;quot;] = 1.8,&lt;br /&gt;
    [&amp;quot;hornVolumeDelta&amp;quot;] = 1.5,&lt;br /&gt;
    [&amp;quot;radioType&amp;quot;] = 3&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Apply to multiple sports cars&lt;br /&gt;
local sportsCars = {411, 506, 451, 602} -- Infernus, Super GT, Turismo, Alpha&lt;br /&gt;
local modifiedCount = applyCustomAudioProfile(sportsCars, sportCarProfile)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Modified audio for &amp;quot; .. modifiedCount .. &amp;quot; vehicle models&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 5: Engine Sound Bank Validation===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to safely set engine sound with validation&lt;br /&gt;
function setEngineSound(modelID, bankID, isEngineOn)&lt;br /&gt;
    -- Validate sound bank ID (must be &amp;lt;= 410)&lt;br /&gt;
    if bankID &amp;gt; 410 then&lt;br /&gt;
        outputChatBox(&amp;quot;Error: Sound bank ID must be 410 or lower&amp;quot;)&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local property = isEngineOn and &amp;quot;engineOnSoundBankID&amp;quot; or &amp;quot;engineOffSoundBankID&amp;quot;&lt;br /&gt;
    local success = setVehicleModelAudioSetting(modelID, property, bankID)&lt;br /&gt;
    &lt;br /&gt;
    if success then&lt;br /&gt;
        local stateText = isEngineOn and &amp;quot;on&amp;quot; or &amp;quot;off&amp;quot;&lt;br /&gt;
        outputChatBox(&amp;quot;Engine &amp;quot; .. stateText .. &amp;quot; sound set to bank &amp;quot; .. bankID .. &amp;quot; for model &amp;quot; .. modelID)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to set engine sound for model &amp;quot; .. modelID)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return success&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Example usage&lt;br /&gt;
setEngineSound(411, 250, true)  -- Set engine on sound&lt;br /&gt;
setEngineSound(411, 230, false) -- Set engine off sound&lt;br /&gt;
setEngineSound(411, 450, true)  -- This will fail due to validation&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[getVehicleModelAudioSettings]]&lt;br /&gt;
*[[resetVehicleModelAudioSettings]]&lt;br /&gt;
*[[setVehicleAudioSetting]]&lt;br /&gt;
*[[getVehicleAudioSettings]]&lt;br /&gt;
*[[resetVehicleAudioSettings]]&lt;br /&gt;
&lt;br /&gt;
''author: Mohab''&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientBrowserResourceBlocked&amp;diff=82237</id>
		<title>OnClientBrowserResourceBlocked</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientBrowserResourceBlocked&amp;diff=82237"/>
		<updated>2025-07-15T12:13:53Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client_event}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This event is executed when a resource (images, sounds etc.) has been blocked.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string url, string domain, int reason&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''url''': the blocked URL.&lt;br /&gt;
*'''domain''': the blocked domain (part of the URL).&lt;br /&gt;
*'''reason''': the reason why the resource was blocked. Possibles values:&lt;br /&gt;
** '''0''': not allowed yet&lt;br /&gt;
** '''1''': blacklisted&lt;br /&gt;
** '''2''': blocked protocol scheme&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[Element/Browser|browser]] element.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example demonstrates how to open a browser window, load a test URL, and handle the onClientBrowserResourceBlocked event. If a resource is blocked, it outputs the details to chat and, if the reason is 0 (not allowed yet), requests the domain and reloads the page if accepted.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local screenWidth, screenHeight = guiGetScreenSize( )&lt;br /&gt;
&lt;br /&gt;
local browser, theBrowser&lt;br /&gt;
local lastBrowser = nil&lt;br /&gt;
local testCases = {&lt;br /&gt;
    {name = &amp;quot;Google (HTTPS, should work)&amp;quot;, url = &amp;quot;https://www.google.com/&amp;quot;},&lt;br /&gt;
    {name = &amp;quot;YouTube (HTTPS, should work)&amp;quot;, url = &amp;quot;https://www.youtube.com/&amp;quot;},&lt;br /&gt;
    {name = &amp;quot;MTA Wiki (HTTPS, should work)&amp;quot;, url = &amp;quot;https://wiki.multitheftauto.com/&amp;quot;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;openbrowser&amp;quot;, function(_, case)&lt;br /&gt;
    if isElement(browser) then destroyElement(browser) end&lt;br /&gt;
    local sx, sy = guiGetScreenSize()&lt;br /&gt;
    local bw, bh = math.floor(sx * 0.6), math.floor(sy * 0.6)&lt;br /&gt;
    local bx, by = math.floor((sx - bw) / 2), math.floor((sy - bh) / 2)&lt;br /&gt;
    browser = guiCreateBrowser(bx, by, bw, bh, false, false, false)&lt;br /&gt;
    guiSetVisible(browser, true)&lt;br /&gt;
    guiBringToFront(browser)&lt;br /&gt;
    showCursor(true)&lt;br /&gt;
    theBrowser = guiGetBrowser(browser)&lt;br /&gt;
&lt;br /&gt;
    local idx = tonumber(case) or 1&lt;br /&gt;
    if not testCases[idx] then idx = 1 end&lt;br /&gt;
    local test = testCases[idx]&lt;br /&gt;
    outputChatBox(&amp;quot;[BrowserTest] Loading test case: &amp;quot;..test.name)&lt;br /&gt;
&lt;br /&gt;
    addEventHandler(&amp;quot;onClientBrowserCreated&amp;quot;, theBrowser, function()&lt;br /&gt;
        loadBrowserURL(source, test.url)&lt;br /&gt;
    end)&lt;br /&gt;
&lt;br /&gt;
    addEventHandler(&amp;quot;onClientBrowserDocumentReady&amp;quot;, theBrowser, function(url)&lt;br /&gt;
        outputChatBox(&amp;quot;[BrowserTest] Browser loaded: &amp;quot; .. tostring(url))&lt;br /&gt;
    end)&lt;br /&gt;
&lt;br /&gt;
    addEventHandler(&amp;quot;onClientBrowserResourceBlocked&amp;quot;, theBrowser, function(url, domain, reason)&lt;br /&gt;
        outputChatBox(&amp;quot;[BrowserTest] Resource blocked! URL=&amp;quot;..tostring(url)..&amp;quot; DOMAIN=&amp;quot;..tostring(domain)..&amp;quot; REASON=&amp;quot;..tostring(reason), 255, 0, 0)&lt;br /&gt;
        if (reason == 0) then&lt;br /&gt;
            lastBrowser = source&lt;br /&gt;
            requestBrowserDomains({domain}, false, function(accepted, newDomains)&lt;br /&gt;
                if (accepted == true) then&lt;br /&gt;
                    outputChatBox(&amp;quot;[BrowserTest] Domain accepted, reloading page.&amp;quot;)&lt;br /&gt;
                    reloadBrowserPage(lastBrowser)&lt;br /&gt;
                else&lt;br /&gt;
                    outputChatBox(&amp;quot;[BrowserTest] Domain NOT accepted.&amp;quot;)&lt;br /&gt;
                end&lt;br /&gt;
                lastBrowser = nil&lt;br /&gt;
            end)&lt;br /&gt;
        elseif (reason == 1) then&lt;br /&gt;
            outputChatBox(&amp;quot;[BrowserTest] Domain is blacklisted.&amp;quot;)&lt;br /&gt;
        elseif (reason == 2) then&lt;br /&gt;
            outputChatBox(&amp;quot;[BrowserTest] Blocked protocol scheme.&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;
&lt;br /&gt;
[[pl:onClientBrowserResourceBlocked]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{CEF_events}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCameraMatrix&amp;diff=82235</id>
		<title>GetCameraMatrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCameraMatrix&amp;diff=82235"/>
		<updated>2025-07-15T10:33:15Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function gets the position of the camera and the position of the point it is facing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Important Note|Server-side this functions returns false or the latest value set via [[setCameraMatrix]] (called from server or client.) &amp;lt;br&amp;gt; So if you never used setCameraMatrix on serverside for that player, then it will return false.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float float float float float float getCameraMatrix ( player thePlayer )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:getCameraMatrix|cameraMatrix|setCameraMatrix}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player whose camera matrix is to be returned.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float float float float float float getCameraMatrix ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Camera]].getMatrix|matrix|setCameraMatrix}}&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function returns 8 [[float|floats]] if the argument is valid (when applicable); the first three indicate the position of the camera, the next three indicate the position of the point it's facing, and the last two are the roll and field of view. Returns ''false'' if the argument is invalid.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local x, y, z, lx, ly, lz = getCameraMatrix ()&lt;br /&gt;
x, lx = x + 1, lx + 1&lt;br /&gt;
&lt;br /&gt;
setCameraMatrix (x, y, z, lx, ly, lz)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Camera functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getCameraMatrix]]&lt;br /&gt;
[[RO:getCameraMatrix]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCameraMatrix&amp;diff=82234</id>
		<title>GetCameraMatrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCameraMatrix&amp;diff=82234"/>
		<updated>2025-07-15T10:32:26Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function gets the position of the camera and the position of the point it is facing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Important Note|Server-side this functions returns false or the latest value set via [[setCameraMatrix]] (called from server or client &amp;lt;br&amp;gt; So if you never used setCameraMatrix on serverside for that player, then it will return false.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float float float float float float getCameraMatrix ( player thePlayer )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:getCameraMatrix|cameraMatrix|setCameraMatrix}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player whose camera matrix is to be returned.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float float float float float float getCameraMatrix ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Camera]].getMatrix|matrix|setCameraMatrix}}&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function returns 8 [[float|floats]] if the argument is valid (when applicable); the first three indicate the position of the camera, the next three indicate the position of the point it's facing, and the last two are the roll and field of view. Returns ''false'' if the argument is invalid.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local x, y, z, lx, ly, lz = getCameraMatrix ()&lt;br /&gt;
x, lx = x + 1, lx + 1&lt;br /&gt;
&lt;br /&gt;
setCameraMatrix (x, y, z, lx, ly, lz)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Camera functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getCameraMatrix]]&lt;br /&gt;
[[RO:getCameraMatrix]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCameraMatrix&amp;diff=82233</id>
		<title>GetCameraMatrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCameraMatrix&amp;diff=82233"/>
		<updated>2025-07-15T10:32:05Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function gets the position of the camera and the position of the point it is facing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Important Note|Server-side this functions returns false or the latest value set via [[setCameraMatrix]] (called from server or client &amp;lt;br&amp;gt; So if you never used setCameraMatrix on serverside for that player, then it will return false.).}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float float float float float float getCameraMatrix ( player thePlayer )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:getCameraMatrix|cameraMatrix|setCameraMatrix}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player whose camera matrix is to be returned.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float float float float float float getCameraMatrix ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Camera]].getMatrix|matrix|setCameraMatrix}}&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function returns 8 [[float|floats]] if the argument is valid (when applicable); the first three indicate the position of the camera, the next three indicate the position of the point it's facing, and the last two are the roll and field of view. Returns ''false'' if the argument is invalid.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local x, y, z, lx, ly, lz = getCameraMatrix ()&lt;br /&gt;
x, lx = x + 1, lx + 1&lt;br /&gt;
&lt;br /&gt;
setCameraMatrix (x, y, z, lx, ly, lz)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Camera functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getCameraMatrix]]&lt;br /&gt;
[[RO:getCameraMatrix]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetMarkerTargetArrowProperties&amp;diff=82222</id>
		<title>GetMarkerTargetArrowProperties</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetMarkerTargetArrowProperties&amp;diff=82222"/>
		<updated>2025-07-10T09:25:37Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature/item|9.0161|1.6.0|22620|function returns the color, transparency and size for a checkpoint marker's target arrow.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int, int, int, int, int getMarkerTargetArrowProperties( marker theMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theMarker''': The [[marker]] that you wish to retrieve the color and size of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns five [[int]]s corresponding to the amount of ''red'', ''green'', ''blue'', ''alpha'' and ''size'' of the marker's target arrow, ''false'' if invalid arguments were passed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, function()&lt;br /&gt;
&lt;br /&gt;
    local myMarker = createMarker(0, 0, 3, &amp;quot;checkpoint&amp;quot;, 2.0, 255, 0, 0, 150)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    setMarkerTarget(myMarker, 10, 0, 3)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    local r, g, b, a, size = getMarkerTargetArrowProperties(myMarker)&lt;br /&gt;
&lt;br /&gt;
    if r then&lt;br /&gt;
        outputChatBox(&amp;quot;Marker Target Arrow Properties:&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;Color: R=&amp;quot; .. r .. &amp;quot; G=&amp;quot; .. g .. &amp;quot; B=&amp;quot; .. b)&lt;br /&gt;
        outputChatBox(&amp;quot;Alpha: &amp;quot; .. a)&lt;br /&gt;
        outputChatBox(&amp;quot;Size: &amp;quot; .. size)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Error: Could not retrieve marker target arrow properties.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Marker functions}}&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuAddSeparator&amp;diff=82221</id>
		<title>DgsMenuAddSeparator</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuAddSeparator&amp;diff=82221"/>
		<updated>2025-07-10T09:09:46Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function adds a separator to a DGS menu. A separator is a visual divider that can be used to organize menu items into logical groups. It can be displayed as a horizontal line or as text.&lt;br /&gt;
&lt;br /&gt;
[[File:Dgs seperator.png|frame|right|alt=Dgs Seperator|A thin horizontal line used to visually divide sections of a DGS Menu]]&lt;br /&gt;
[[File:DGS Text Seperator.png|frame|right|alt=DGS Text Seperator|DGS Text Seperator]]&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int uniqueID, int position dgsMenuAddSeparator ( element menu [, string text, int parentItemID, int position ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element to add the separator to&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''text:''' The text to display for the separator. If not specified or ''nil'', a horizontal line will be drawn instead&lt;br /&gt;
*'''parentItemID:''' The unique ID of the parent item. If not specified, the separator will be added to the root menu&lt;br /&gt;
*'''position:''' The position where the separator should be inserted. If not specified, it will be added at the end&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the unique ID of the separator and its position if successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Separator (Line)===&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 items and separators&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add some menu items&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New File&amp;quot;, &amp;quot;file.new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Open File&amp;quot;, &amp;quot;file.open&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add a separator line&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
&lt;br /&gt;
-- Add more items after the separator&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;)&lt;br /&gt;
local item4 = dgsMenuAddItem(menu, &amp;quot;Save As&amp;quot;, &amp;quot;file.saveas&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add another separator&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
&lt;br /&gt;
-- Add exit item&lt;br /&gt;
local item5 = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;file.exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Text Separator===&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 text separators (wider menu for better text visibility)&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 300, 250, false)&lt;br /&gt;
&lt;br /&gt;
-- Add file operations&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file.new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file.open&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add a text separator&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;--- Edit Operations ---&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add edit operations&lt;br /&gt;
local item4 = dgsMenuAddItem(menu, &amp;quot;Copy&amp;quot;, &amp;quot;edit.copy&amp;quot;)&lt;br /&gt;
local item5 = dgsMenuAddItem(menu, &amp;quot;Paste&amp;quot;, &amp;quot;edit.paste&amp;quot;)&lt;br /&gt;
local item6 = dgsMenuAddItem(menu, &amp;quot;Cut&amp;quot;, &amp;quot;edit.cut&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add another text separator&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;--- View Options ---&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add view operations&lt;br /&gt;
local item7 = dgsMenuAddItem(menu, &amp;quot;Zoom In&amp;quot;, &amp;quot;view.zoomin&amp;quot;)&lt;br /&gt;
local item8 = dgsMenuAddItem(menu, &amp;quot;Zoom Out&amp;quot;, &amp;quot;view.zoomout&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Separator with Position and Parent Item===&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 nested items and separators&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 200, false)&lt;br /&gt;
&lt;br /&gt;
-- Add main menu items&lt;br /&gt;
local fileItem = dgsMenuAddItem(menu, &amp;quot;File&amp;quot;, &amp;quot;file&amp;quot;)&lt;br /&gt;
local editItem = dgsMenuAddItem(menu, &amp;quot;Edit&amp;quot;, &amp;quot;edit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add items to the File submenu&lt;br /&gt;
local newItem = dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file.new&amp;quot;, fileItem)&lt;br /&gt;
local openItem = dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file.open&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add a separator in the File submenu at position 3&lt;br /&gt;
local separatorID = dgsMenuAddSeparator(menu, nil, fileItem, 3)&lt;br /&gt;
&lt;br /&gt;
-- Add more items to the File submenu&lt;br /&gt;
local saveItem = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;, fileItem)&lt;br /&gt;
local exitItem = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;file.exit&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add another separator with text in the File submenu&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;Recent Files&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add recent file items&lt;br /&gt;
local recent1 = dgsMenuAddItem(menu, &amp;quot;document1.txt&amp;quot;, &amp;quot;file.recent1&amp;quot;, fileItem)&lt;br /&gt;
local recent2 = dgsMenuAddItem(menu, &amp;quot;document2.txt&amp;quot;, &amp;quot;file.recent2&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Context Menu with Separators===&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 context menu that appears on right-click&lt;br /&gt;
local contextMenu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add context menu items&lt;br /&gt;
local cutItem = dgsMenuAddItem(contextMenu, &amp;quot;Cut&amp;quot;, &amp;quot;cut&amp;quot;)&lt;br /&gt;
local copyItem = dgsMenuAddItem(contextMenu, &amp;quot;Copy&amp;quot;, &amp;quot;copy&amp;quot;)&lt;br /&gt;
local pasteItem = dgsMenuAddItem(contextMenu, &amp;quot;Paste&amp;quot;, &amp;quot;paste&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add separator&lt;br /&gt;
dgsMenuAddSeparator(contextMenu)&lt;br /&gt;
&lt;br /&gt;
-- Add more options&lt;br /&gt;
local selectAllItem = dgsMenuAddItem(contextMenu, &amp;quot;Select All&amp;quot;, &amp;quot;selectall&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add separator with text&lt;br /&gt;
dgsMenuAddSeparator(contextMenu, &amp;quot;Properties&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add properties item&lt;br /&gt;
local propertiesItem = dgsMenuAddItem(contextMenu, &amp;quot;Item Properties&amp;quot;, &amp;quot;properties&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Create a button that shows the context menu&lt;br /&gt;
local button = dgsCreateButton(400, 400, 200, 50, &amp;quot;Right Click Me&amp;quot;, false)&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onDgsMouseClickUp&amp;quot;, button, function(mouseButton)&lt;br /&gt;
    if mouseButton == &amp;quot;right&amp;quot; then&lt;br /&gt;
        local x, y = dgsGetCursorPosition()&lt;br /&gt;
        dgsMenuShow(contextMenu, x, y)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
-- Handle context menu selections&lt;br /&gt;
addEventHandler(&amp;quot;onDgsMenuSelect&amp;quot;, contextMenu, 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;
    outputChatBox(&amp;quot;Context action: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuRemoveItem]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[dgsMenuShow]]&lt;br /&gt;
*[[dgsMenuHide]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuRemoveItem&amp;diff=82220</id>
		<title>DgsMenuRemoveItem</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuRemoveItem&amp;diff=82220"/>
		<updated>2025-07-10T08:53:12Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function removes an item from a DGS menu element.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool dgsMenuRemoveItem ( element menu, int uniqueID ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element from which to remove the item *'''uniqueID:''' The unique ID of the menu item to remove (returned by dgsMenuAddItem)  ===Returns=== Returns ''true'' if the item was successfully removed, ''false'' if the item wit...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function removes an item from a DGS menu element.&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 dgsMenuRemoveItem ( element menu, int uniqueID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element from which to remove the item&lt;br /&gt;
*'''uniqueID:''' The unique ID of the menu item to remove (returned by [[dgsMenuAddItem]])&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the item was successfully removed, ''false'' if the item with the specified uniqueID was not found.&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Option 1&amp;quot;, &amp;quot;command1&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Option 2&amp;quot;, &amp;quot;command2&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Option 3&amp;quot;, &amp;quot;command3&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Remove the second item&lt;br /&gt;
local removeItem = dgsMenuRemoveItem(menu, item2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Show the menu (item2 will not be visible)&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuAddSeparator]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[dgsMenuGetItemText]]&lt;br /&gt;
*[[dgsMenuSetItemText]]&lt;br /&gt;
*[[dgsMenuGetItemCommand]]&lt;br /&gt;
*[[dgsMenuSetItemCommand]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuAddSeparator&amp;diff=82219</id>
		<title>DgsMenuAddSeparator</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuAddSeparator&amp;diff=82219"/>
		<updated>2025-07-10T08:32:41Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function adds a separator to a DGS menu. A separator is a visual divider that can be used to organize menu items into logical groups. It can be displayed as a horizontal line or as text.&lt;br /&gt;
&lt;br /&gt;
[[File:Dgs seperator.png|frame|right|alt=Dgs Seperator|A thin horizontal line or vertical line used to visually divide sections of a DGS Menu]]&lt;br /&gt;
[[File:DGS Text Seperator.png|frame|right|alt=DGS Text Seperator|DGS Text Seperator]]&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int uniqueID, int position dgsMenuAddSeparator ( element menu [, string text, int parentItemID, int position ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element to add the separator to&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''text:''' The text to display for the separator. If not specified or ''nil'', a horizontal line will be drawn instead&lt;br /&gt;
*'''parentItemID:''' The unique ID of the parent item. If not specified, the separator will be added to the root menu&lt;br /&gt;
*'''position:''' The position where the separator should be inserted. If not specified, it will be added at the end&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the unique ID of the separator and its position if successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Separator (Line)===&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 items and separators&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add some menu items&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New File&amp;quot;, &amp;quot;file.new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Open File&amp;quot;, &amp;quot;file.open&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add a separator line&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
&lt;br /&gt;
-- Add more items after the separator&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;)&lt;br /&gt;
local item4 = dgsMenuAddItem(menu, &amp;quot;Save As&amp;quot;, &amp;quot;file.saveas&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add another separator&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
&lt;br /&gt;
-- Add exit item&lt;br /&gt;
local item5 = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;file.exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Text Separator===&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 text separators (wider menu for better text visibility)&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 300, 250, false)&lt;br /&gt;
&lt;br /&gt;
-- Add file operations&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file.new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file.open&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add a text separator&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;--- Edit Operations ---&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add edit operations&lt;br /&gt;
local item4 = dgsMenuAddItem(menu, &amp;quot;Copy&amp;quot;, &amp;quot;edit.copy&amp;quot;)&lt;br /&gt;
local item5 = dgsMenuAddItem(menu, &amp;quot;Paste&amp;quot;, &amp;quot;edit.paste&amp;quot;)&lt;br /&gt;
local item6 = dgsMenuAddItem(menu, &amp;quot;Cut&amp;quot;, &amp;quot;edit.cut&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add another text separator&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;--- View Options ---&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add view operations&lt;br /&gt;
local item7 = dgsMenuAddItem(menu, &amp;quot;Zoom In&amp;quot;, &amp;quot;view.zoomin&amp;quot;)&lt;br /&gt;
local item8 = dgsMenuAddItem(menu, &amp;quot;Zoom Out&amp;quot;, &amp;quot;view.zoomout&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Separator with Position and Parent Item===&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 nested items and separators&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 200, false)&lt;br /&gt;
&lt;br /&gt;
-- Add main menu items&lt;br /&gt;
local fileItem = dgsMenuAddItem(menu, &amp;quot;File&amp;quot;, &amp;quot;file&amp;quot;)&lt;br /&gt;
local editItem = dgsMenuAddItem(menu, &amp;quot;Edit&amp;quot;, &amp;quot;edit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add items to the File submenu&lt;br /&gt;
local newItem = dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file.new&amp;quot;, fileItem)&lt;br /&gt;
local openItem = dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file.open&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add a separator in the File submenu at position 3&lt;br /&gt;
local separatorID = dgsMenuAddSeparator(menu, nil, fileItem, 3)&lt;br /&gt;
&lt;br /&gt;
-- Add more items to the File submenu&lt;br /&gt;
local saveItem = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;, fileItem)&lt;br /&gt;
local exitItem = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;file.exit&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add another separator with text in the File submenu&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;Recent Files&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add recent file items&lt;br /&gt;
local recent1 = dgsMenuAddItem(menu, &amp;quot;document1.txt&amp;quot;, &amp;quot;file.recent1&amp;quot;, fileItem)&lt;br /&gt;
local recent2 = dgsMenuAddItem(menu, &amp;quot;document2.txt&amp;quot;, &amp;quot;file.recent2&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Context Menu with Separators===&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 context menu that appears on right-click&lt;br /&gt;
local contextMenu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add context menu items&lt;br /&gt;
local cutItem = dgsMenuAddItem(contextMenu, &amp;quot;Cut&amp;quot;, &amp;quot;cut&amp;quot;)&lt;br /&gt;
local copyItem = dgsMenuAddItem(contextMenu, &amp;quot;Copy&amp;quot;, &amp;quot;copy&amp;quot;)&lt;br /&gt;
local pasteItem = dgsMenuAddItem(contextMenu, &amp;quot;Paste&amp;quot;, &amp;quot;paste&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add separator&lt;br /&gt;
dgsMenuAddSeparator(contextMenu)&lt;br /&gt;
&lt;br /&gt;
-- Add more options&lt;br /&gt;
local selectAllItem = dgsMenuAddItem(contextMenu, &amp;quot;Select All&amp;quot;, &amp;quot;selectall&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add separator with text&lt;br /&gt;
dgsMenuAddSeparator(contextMenu, &amp;quot;Properties&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add properties item&lt;br /&gt;
local propertiesItem = dgsMenuAddItem(contextMenu, &amp;quot;Item Properties&amp;quot;, &amp;quot;properties&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Create a button that shows the context menu&lt;br /&gt;
local button = dgsCreateButton(400, 400, 200, 50, &amp;quot;Right Click Me&amp;quot;, false)&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onDgsMouseClickUp&amp;quot;, button, function(mouseButton)&lt;br /&gt;
    if mouseButton == &amp;quot;right&amp;quot; then&lt;br /&gt;
        local x, y = dgsGetCursorPosition()&lt;br /&gt;
        dgsMenuShow(contextMenu, x, y)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
-- Handle context menu selections&lt;br /&gt;
addEventHandler(&amp;quot;onDgsMenuSelect&amp;quot;, contextMenu, 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;
    outputChatBox(&amp;quot;Context action: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuRemoveItem]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[dgsMenuShow]]&lt;br /&gt;
*[[dgsMenuHide]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=File:DGS_Text_Seperator.png&amp;diff=82218</id>
		<title>File:DGS Text Seperator.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=File:DGS_Text_Seperator.png&amp;diff=82218"/>
		<updated>2025-07-10T08:32:11Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DGS Text Seperator&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuAddSeparator&amp;diff=82217</id>
		<title>DgsMenuAddSeparator</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuAddSeparator&amp;diff=82217"/>
		<updated>2025-07-10T08:28:58Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function adds a separator to a DGS menu. A separator is a visual divider that can be used to organize menu items into logical groups. It can be displayed as a horizontal line or as text.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; int uniqueID, int position dgsMenuAddSeparator ( element menu [, string text, int parentItemID, int position ] ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element to add the separator...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function adds a separator to a DGS menu. A separator is a visual divider that can be used to organize menu items into logical groups. It can be displayed as a horizontal line or as text.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int uniqueID, int position dgsMenuAddSeparator ( element menu [, string text, int parentItemID, int position ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element to add the separator to&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''text:''' The text to display for the separator. If not specified or ''nil'', a horizontal line will be drawn instead&lt;br /&gt;
*'''parentItemID:''' The unique ID of the parent item. If not specified, the separator will be added to the root menu&lt;br /&gt;
*'''position:''' The position where the separator should be inserted. If not specified, it will be added at the end&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the unique ID of the separator and its position if successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Basic Separator (Line)===&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 items and separators&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add some menu items&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New File&amp;quot;, &amp;quot;file.new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Open File&amp;quot;, &amp;quot;file.open&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add a separator line&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
&lt;br /&gt;
-- Add more items after the separator&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;)&lt;br /&gt;
local item4 = dgsMenuAddItem(menu, &amp;quot;Save As&amp;quot;, &amp;quot;file.saveas&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add another separator&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
&lt;br /&gt;
-- Add exit item&lt;br /&gt;
local item5 = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;file.exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Text Separator===&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 text separators (wider menu for better text visibility)&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 300, 250, false)&lt;br /&gt;
&lt;br /&gt;
-- Add file operations&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file.new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file.open&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add a text separator&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;--- Edit Operations ---&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add edit operations&lt;br /&gt;
local item4 = dgsMenuAddItem(menu, &amp;quot;Copy&amp;quot;, &amp;quot;edit.copy&amp;quot;)&lt;br /&gt;
local item5 = dgsMenuAddItem(menu, &amp;quot;Paste&amp;quot;, &amp;quot;edit.paste&amp;quot;)&lt;br /&gt;
local item6 = dgsMenuAddItem(menu, &amp;quot;Cut&amp;quot;, &amp;quot;edit.cut&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add another text separator&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;--- View Options ---&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add view operations&lt;br /&gt;
local item7 = dgsMenuAddItem(menu, &amp;quot;Zoom In&amp;quot;, &amp;quot;view.zoomin&amp;quot;)&lt;br /&gt;
local item8 = dgsMenuAddItem(menu, &amp;quot;Zoom Out&amp;quot;, &amp;quot;view.zoomout&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Separator with Position and Parent Item===&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 nested items and separators&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 200, false)&lt;br /&gt;
&lt;br /&gt;
-- Add main menu items&lt;br /&gt;
local fileItem = dgsMenuAddItem(menu, &amp;quot;File&amp;quot;, &amp;quot;file&amp;quot;)&lt;br /&gt;
local editItem = dgsMenuAddItem(menu, &amp;quot;Edit&amp;quot;, &amp;quot;edit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add items to the File submenu&lt;br /&gt;
local newItem = dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file.new&amp;quot;, fileItem)&lt;br /&gt;
local openItem = dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file.open&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add a separator in the File submenu at position 3&lt;br /&gt;
local separatorID = dgsMenuAddSeparator(menu, nil, fileItem, 3)&lt;br /&gt;
&lt;br /&gt;
-- Add more items to the File submenu&lt;br /&gt;
local saveItem = dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file.save&amp;quot;, fileItem)&lt;br /&gt;
local exitItem = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;file.exit&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add another separator with text in the File submenu&lt;br /&gt;
dgsMenuAddSeparator(menu, &amp;quot;Recent Files&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Add recent file items&lt;br /&gt;
local recent1 = dgsMenuAddItem(menu, &amp;quot;document1.txt&amp;quot;, &amp;quot;file.recent1&amp;quot;, fileItem)&lt;br /&gt;
local recent2 = dgsMenuAddItem(menu, &amp;quot;document2.txt&amp;quot;, &amp;quot;file.recent2&amp;quot;, fileItem)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 4: Context Menu with Separators===&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 context menu that appears on right-click&lt;br /&gt;
local contextMenu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add context menu items&lt;br /&gt;
local cutItem = dgsMenuAddItem(contextMenu, &amp;quot;Cut&amp;quot;, &amp;quot;cut&amp;quot;)&lt;br /&gt;
local copyItem = dgsMenuAddItem(contextMenu, &amp;quot;Copy&amp;quot;, &amp;quot;copy&amp;quot;)&lt;br /&gt;
local pasteItem = dgsMenuAddItem(contextMenu, &amp;quot;Paste&amp;quot;, &amp;quot;paste&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add separator&lt;br /&gt;
dgsMenuAddSeparator(contextMenu)&lt;br /&gt;
&lt;br /&gt;
-- Add more options&lt;br /&gt;
local selectAllItem = dgsMenuAddItem(contextMenu, &amp;quot;Select All&amp;quot;, &amp;quot;selectall&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add separator with text&lt;br /&gt;
dgsMenuAddSeparator(contextMenu, &amp;quot;Properties&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add properties item&lt;br /&gt;
local propertiesItem = dgsMenuAddItem(contextMenu, &amp;quot;Item Properties&amp;quot;, &amp;quot;properties&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Create a button that shows the context menu&lt;br /&gt;
local button = dgsCreateButton(400, 400, 200, 50, &amp;quot;Right Click Me&amp;quot;, false)&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onDgsMouseClickUp&amp;quot;, button, function(mouseButton)&lt;br /&gt;
    if mouseButton == &amp;quot;right&amp;quot; then&lt;br /&gt;
        local x, y = dgsGetCursorPosition()&lt;br /&gt;
        dgsMenuShow(contextMenu, x, y)&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
-- Handle context menu selections&lt;br /&gt;
addEventHandler(&amp;quot;onDgsMenuSelect&amp;quot;, contextMenu, 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;
    outputChatBox(&amp;quot;Context action: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuRemoveItem]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[dgsMenuShow]]&lt;br /&gt;
*[[dgsMenuHide]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=File:Dgs_seperator.png&amp;diff=82216</id>
		<title>File:Dgs seperator.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=File:Dgs_seperator.png&amp;diff=82216"/>
		<updated>2025-07-10T07:53:03Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A thin horizontal line or vertical line used to visually divide sections of a DGS Menu&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemColor&amp;diff=82215</id>
		<title>DgsMenuGetItemColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemColor&amp;diff=82215"/>
		<updated>2025-07-10T06:43:44Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function gets the color of a specific menu item. You can retrieve the colors either as separate RGBA components or as color values.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; int r, int g, int b, int a, int hr, int hg, int hb, int ha dgsMenuGetItemColor ( element menu, int uniqueID ) int normalColor, int hoverColor dgsMenuGetItemColor ( element menu, int uniqueID, bool notSplitColor ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the color of a specific menu item. You can retrieve the colors either as separate RGBA components or as color values.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int r, int g, int b, int a, int hr, int hg, int hb, int ha dgsMenuGetItemColor ( element menu, int uniqueID )&lt;br /&gt;
int normalColor, int hoverColor dgsMenuGetItemColor ( element menu, int uniqueID, bool notSplitColor )&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;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''notSplitColor:''' If set to ''true'', returns the color values as they are stored (two color values). If ''false'' or not specified, returns 8 separate RGBA components&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
When '''notSplitColor''' is ''false'' or not specified:&lt;br /&gt;
Returns 8 integers representing the RGBA components: normal red, normal green, normal blue, normal alpha, hover red, hover green, hover blue, hover alpha. Returns ''false'' if the operation failed.&lt;br /&gt;
&lt;br /&gt;
When '''notSplitColor''' is ''true'':&lt;br /&gt;
Returns two color values: normalColor, hoverColor. Returns ''false'' if the operation failed.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Getting RGBA Components===&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Red Item&amp;quot;, &amp;quot;red&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Custom Item&amp;quot;, &amp;quot;custom&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set colors for the items&lt;br /&gt;
dgsMenuSetItemColor(menu, item1, 255, 0, 0, 200)  -- Red with alpha&lt;br /&gt;
local normalColor = tocolor(100, 150, 200)&lt;br /&gt;
local hoverColor = tocolor(200, 255, 100)&lt;br /&gt;
dgsMenuSetItemColor(menu, item2, {normalColor, hoverColor})&lt;br /&gt;
&lt;br /&gt;
-- Get the colors as RGBA components&lt;br /&gt;
local r, g, b, a, hr, hg, hb, ha = dgsMenuGetItemColor(menu, item1)&lt;br /&gt;
if r then&lt;br /&gt;
    outputChatBox(&amp;quot;Item 1 - Normal: R=&amp;quot; .. r .. &amp;quot; G=&amp;quot; .. g .. &amp;quot; B=&amp;quot; .. b .. &amp;quot; A=&amp;quot; .. a)&lt;br /&gt;
    outputChatBox(&amp;quot;Item 1 - Hover: R=&amp;quot; .. hr .. &amp;quot; G=&amp;quot; .. hg .. &amp;quot; B=&amp;quot; .. hb .. &amp;quot; A=&amp;quot; .. ha)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local r2, g2, b2, a2, hr2, hg2, hb2, ha2 = dgsMenuGetItemColor(menu, item2)&lt;br /&gt;
if r2 then&lt;br /&gt;
    outputChatBox(&amp;quot;Item 2 - Normal: R=&amp;quot; .. r2 .. &amp;quot; G=&amp;quot; .. g2 .. &amp;quot; B=&amp;quot; .. b2 .. &amp;quot; A=&amp;quot; .. a2)&lt;br /&gt;
    outputChatBox(&amp;quot;Item 2 - Hover: R=&amp;quot; .. hr2 .. &amp;quot; G=&amp;quot; .. hg2 .. &amp;quot; B=&amp;quot; .. hb2 .. &amp;quot; A=&amp;quot; .. ha2)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Getting Color Values===&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Blue Item&amp;quot;, &amp;quot;blue&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Yellow Item&amp;quot;, &amp;quot;yellow&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set colors for the items&lt;br /&gt;
dgsMenuSetItemColor(menu, item1, tocolor(0, 0, 255))  -- Blue for both states&lt;br /&gt;
local normalYellow = tocolor(255, 255, 0)&lt;br /&gt;
local hoverYellow = tocolor(255, 255, 150)&lt;br /&gt;
dgsMenuSetItemColor(menu, item2, {normalYellow, hoverYellow})&lt;br /&gt;
&lt;br /&gt;
-- Get the colors as color values&lt;br /&gt;
local normalColor1, hoverColor1 = dgsMenuGetItemColor(menu, item1, true)&lt;br /&gt;
if normalColor1 then&lt;br /&gt;
    outputChatBox(&amp;quot;Item 1 - Normal Color: &amp;quot; .. normalColor1)&lt;br /&gt;
    outputChatBox(&amp;quot;Item 1 - Hover Color: &amp;quot; .. hoverColor1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local normalColor2, hoverColor2 = dgsMenuGetItemColor(menu, item2, true)&lt;br /&gt;
if normalColor2 then&lt;br /&gt;
    outputChatBox(&amp;quot;Item 2 - Normal Color: &amp;quot; .. normalColor2)&lt;br /&gt;
    outputChatBox(&amp;quot;Item 2 - Hover Color: &amp;quot; .. hoverColor2)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Color Inspection and Modification===&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Inspectable Item&amp;quot;, &amp;quot;inspect&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set initial color&lt;br /&gt;
dgsMenuSetItemColor(menu, item1, 128, 128, 128, 255)  -- Gray&lt;br /&gt;
&lt;br /&gt;
-- Function to inspect and modify colors&lt;br /&gt;
function inspectAndModifyColor(menu, uniqueID)&lt;br /&gt;
    -- Get current colors as RGBA components&lt;br /&gt;
    local r, g, b, a, hr, hg, hb, ha = dgsMenuGetItemColor(menu, uniqueID)&lt;br /&gt;
    &lt;br /&gt;
    if r then&lt;br /&gt;
        outputChatBox(&amp;quot;Current colors:&amp;quot;)&lt;br /&gt;
        outputChatBox(&amp;quot;Normal - R:&amp;quot; .. r .. &amp;quot; G:&amp;quot; .. g .. &amp;quot; B:&amp;quot; .. b .. &amp;quot; A:&amp;quot; .. a)&lt;br /&gt;
        outputChatBox(&amp;quot;Hover - R:&amp;quot; .. hr .. &amp;quot; G:&amp;quot; .. hg .. &amp;quot; B:&amp;quot; .. hb .. &amp;quot; A:&amp;quot; .. ha)&lt;br /&gt;
        &lt;br /&gt;
        -- Modify the colors (make them brighter)&lt;br /&gt;
        local newR = math.min(255, r + 50)&lt;br /&gt;
        local newG = math.min(255, g + 50)&lt;br /&gt;
        local newB = math.min(255, b + 50)&lt;br /&gt;
        &lt;br /&gt;
        -- Set the new colors&lt;br /&gt;
        dgsMenuSetItemColor(menu, uniqueID, newR, newG, newB, a)&lt;br /&gt;
        outputChatBox(&amp;quot;Colors have been brightened!&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Failed to get item colors&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Inspect and modify colors after 3 seconds&lt;br /&gt;
setTimer(inspectAndModifyColor, 3000, 1, menu, item1)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuSetItemColor]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuGetItemText]]&lt;br /&gt;
*[[dgsMenuGetItemTextSize]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemColor&amp;diff=82214</id>
		<title>DgsMenuSetItemColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemColor&amp;diff=82214"/>
		<updated>2025-07-10T06:18:20Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function sets the color of a specific menu item. You can set both the normal and hover colors for the item.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool dgsMenuSetItemColor ( element menu, int uniqueID, int r, int g, int b [, int a ] ) bool dgsMenuSetItemColor ( element menu, int uniqueID, int color ) bool dgsMenuSetItemColor ( element menu, int uniqueID, table colors ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function sets the color of a specific menu item. You can set both the normal and hover colors for the item.&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 dgsMenuSetItemColor ( element menu, int uniqueID, int r, int g, int b [, int a ] )&lt;br /&gt;
bool dgsMenuSetItemColor ( element menu, int uniqueID, int color )&lt;br /&gt;
bool dgsMenuSetItemColor ( element menu, int uniqueID, table colors )&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;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''r:''' The red component (0-255)&lt;br /&gt;
*'''g:''' The green component (0-255)&lt;br /&gt;
*'''b:''' The blue component (0-255)&lt;br /&gt;
*'''a:''' The alpha component (0-255). If not specified, 255 is used&lt;br /&gt;
*'''color:''' A single color value (created with [[tocolor]])&lt;br /&gt;
*'''colors:''' A table containing two color values: {normalColor, hoverColor}. If only one color is provided, it will be used for both states&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the color was set successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Example 1: Using RGB Values===&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Red Item&amp;quot;, &amp;quot;red&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Blue Item&amp;quot;, &amp;quot;blue&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Green Item&amp;quot;, &amp;quot;green&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set different colors for each item using RGB values&lt;br /&gt;
dgsMenuSetItemColor(menu, item1, 255, 0, 0)        -- Red&lt;br /&gt;
dgsMenuSetItemColor(menu, item2, 0, 0, 255, 200)   -- Blue with alpha&lt;br /&gt;
dgsMenuSetItemColor(menu, item3, 0, 255, 0)        -- Green&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 2: Using Color Values===&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Yellow Item&amp;quot;, &amp;quot;yellow&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Purple Item&amp;quot;, &amp;quot;purple&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Orange Item&amp;quot;, &amp;quot;orange&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set colors using tocolor function&lt;br /&gt;
dgsMenuSetItemColor(menu, item1, tocolor(255, 255, 0))     -- Yellow&lt;br /&gt;
dgsMenuSetItemColor(menu, item2, tocolor(128, 0, 128))     -- Purple&lt;br /&gt;
dgsMenuSetItemColor(menu, item3, tocolor(255, 165, 0))     -- Orange&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example 3: Using Color Tables (Normal and Hover States)===&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Custom Colors&amp;quot;, &amp;quot;custom&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Another Item&amp;quot;, &amp;quot;another&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set different colors for normal and hover states&lt;br /&gt;
local normalColor = tocolor(100, 100, 100)    -- Gray when normal&lt;br /&gt;
local hoverColor = tocolor(255, 255, 255)     -- White when hovering&lt;br /&gt;
dgsMenuSetItemColor(menu, item1, {normalColor, hoverColor})&lt;br /&gt;
&lt;br /&gt;
-- You can also use the same color for both states&lt;br /&gt;
local singleColor = tocolor(255, 100, 100)    -- Light red&lt;br /&gt;
dgsMenuSetItemColor(menu, item2, {singleColor})  -- Will use the same color for both states&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuGetItemColor]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuSetItemText]]&lt;br /&gt;
*[[dgsMenuSetItemTextSize]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemTextSize&amp;diff=82213</id>
		<title>DgsMenuGetItemTextSize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemTextSize&amp;diff=82213"/>
		<updated>2025-07-10T06:06:57Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function gets the text size of a specific menu item.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; float, float dgsMenuGetItemTextSize ( element menu, int uniqueID ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem)  ===Returns=== Returns two floats representing the horizontal and vertical text scale factors, or '...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the text size of a specific menu item.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float dgsMenuGetItemTextSize ( element menu, int uniqueID )&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;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns two floats representing the horizontal and vertical text scale factors, or ''false'' if the operation failed.&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 items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Normal Size&amp;quot;, &amp;quot;normal&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Large Text&amp;quot;, &amp;quot;large&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set different text sizes&lt;br /&gt;
dgsMenuSetItemTextSize(menu, item1, 1.0)&lt;br /&gt;
dgsMenuSetItemTextSize(menu, item2, 1.5, 2.0)&lt;br /&gt;
&lt;br /&gt;
-- Get and display the text sizes&lt;br /&gt;
local sizeX1, sizeY1 = dgsMenuGetItemTextSize(menu, item1)&lt;br /&gt;
local sizeX2, sizeY2 = dgsMenuGetItemTextSize(menu, item2)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Item 1 text size: &amp;quot; .. sizeX1 .. &amp;quot;x&amp;quot; .. sizeY1)&lt;br /&gt;
outputChatBox(&amp;quot;Item 2 text size: &amp;quot; .. sizeX2 .. &amp;quot;x&amp;quot; .. sizeY2)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuSetItemTextSize]]&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;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemTextSize&amp;diff=82212</id>
		<title>DgsMenuSetItemTextSize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemTextSize&amp;diff=82212"/>
		<updated>2025-07-10T05:59:28Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function sets the text size of a specific menu item.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool dgsMenuSetItemTextSize ( element menu, int uniqueID, float textSizeX [, float textSizeY ] ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem) *'''textSizeX:''' The horizontal scale of the text  ===Optional Argum...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function sets the text size of a specific menu item.&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 dgsMenuSetItemTextSize ( element menu, int uniqueID, float textSizeX [, float textSizeY ] )&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;
*'''textSizeX:''' The horizontal scale of the text&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''textSizeY:''' The vertical scale of the text. If not specified, textSizeX is used for both dimensions&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the text size 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 different text sizes&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 200, 150, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;Normal Size&amp;quot;, &amp;quot;normal&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Large Text&amp;quot;, &amp;quot;large&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Small Text&amp;quot;, &amp;quot;small&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Set different text sizes for each item&lt;br /&gt;
dgsMenuSetItemTextSize(menu, item1, 1.0)        -- Normal size&lt;br /&gt;
dgsMenuSetItemTextSize(menu, item2, 1.5)        -- Large text&lt;br /&gt;
dgsMenuSetItemTextSize(menu, item3, 0.8, 0.8)   -- Small text&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;
    outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuGetItemTextSize]]&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;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemText&amp;diff=82211</id>
		<title>DgsMenuGetItemText</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemText&amp;diff=82211"/>
		<updated>2025-07-10T04:52:05Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function retrieves the displayed text of a menu item.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string dgsMenuGetItemText ( element menu, int uniqueID )&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;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the text string if successful, ''false'' if the item doesn't exist.&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, 100, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New Game&amp;quot;, &amp;quot;new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Load Game&amp;quot;, &amp;quot;load&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Get and display the text of menu items&lt;br /&gt;
local text1 = dgsMenuGetItemText(menu, item1)&lt;br /&gt;
local text2 = dgsMenuGetItemText(menu, item2)&lt;br /&gt;
local text3 = dgsMenuGetItemText(menu, item3)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Menu items: &amp;quot; .. text1 .. &amp;quot;, &amp;quot; .. text2 .. &amp;quot;, &amp;quot; .. text3)&lt;br /&gt;
-- Output: &amp;quot;Menu items: New Game, Load Game, Exit&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuSetItemText]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuGetItemCommand]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemCommand&amp;diff=82210</id>
		<title>DgsMenuGetItemCommand</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemCommand&amp;diff=82210"/>
		<updated>2025-07-10T04:51:47Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function retrieves the command identifier of a menu item. The command is used to identify which action should be performed when the item is 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;
string dgsMenuGetItemCommand ( element menu, int uniqueID )&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;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the command string if successful, ''false'' if the item doesn't exist.&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 different types of items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
local fileItem = dgsMenuAddItem(menu, &amp;quot;File&amp;quot;, &amp;quot;file&amp;quot;)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file_new&amp;quot;, fileItem)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file_open&amp;quot;, fileItem)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file_save&amp;quot;, fileItem)&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Handle menu selections by checking commands&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;
    -- Get the command of the selected item&lt;br /&gt;
    local command = dgsMenuGetItemCommand(source, uniqueID)&lt;br /&gt;
    &lt;br /&gt;
    -- Perform actions based on command&lt;br /&gt;
    if command == &amp;quot;file_new&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Creating new file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;file_open&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Opening file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;file_save&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Saving file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Goodbye!&amp;quot;)&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Close menu after action&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuSetItemCommand]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[onDgsMenuSelect]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;diff=82209</id>
		<title>DgsMenuSetItemCommand</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;diff=82209"/>
		<updated>2025-07-10T04:51:28Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&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;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemCommand&amp;diff=82208</id>
		<title>DgsMenuGetItemCommand</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemCommand&amp;diff=82208"/>
		<updated>2025-07-10T04:51:23Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function retrieves the command identifier of a menu item. The command is used to identify which action should be performed when the item is 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;
string dgsMenuGetItemCommand ( element menu, int uniqueID )&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;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the command string if successful, ''false'' if the item doesn't exist.&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 different types of items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
local fileItem = dgsMenuAddItem(menu, &amp;quot;File&amp;quot;, &amp;quot;file&amp;quot;)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file_new&amp;quot;, fileItem)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file_open&amp;quot;, fileItem)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file_save&amp;quot;, fileItem)&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Handle menu selections by checking commands&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;
    -- Get the command of the selected item&lt;br /&gt;
    local command = dgsMenuGetItemCommand(source, uniqueID)&lt;br /&gt;
    &lt;br /&gt;
    -- Perform actions based on command&lt;br /&gt;
    if command == &amp;quot;file_new&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Creating new file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;file_open&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Opening file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;file_save&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Saving file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Goodbye!&amp;quot;)&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Close menu after action&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuSetItemCommand]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[onDgsMenuSelect]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
This documentation was created by [[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemText&amp;diff=82207</id>
		<title>DgsMenuSetItemText</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemText&amp;diff=82207"/>
		<updated>2025-07-10T04:51:07Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function changes the displayed text of an existing menu item.&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 dgsMenuSetItemText ( element menu, int uniqueID, string text )&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;
*'''text:''' The new text to display for this menu item&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the text 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 a toggle option&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 160, 120, false)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Start Game&amp;quot;, &amp;quot;start&amp;quot;)&lt;br /&gt;
local soundItem = dgsMenuAddItem(menu, &amp;quot;Sound: ON&amp;quot;, &amp;quot;toggle_sound&amp;quot;)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Track sound state&lt;br /&gt;
local soundEnabled = true&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;start&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Starting game...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;toggle_sound&amp;quot; then&lt;br /&gt;
        -- Toggle sound state and update menu text&lt;br /&gt;
        soundEnabled = not soundEnabled&lt;br /&gt;
        if soundEnabled then&lt;br /&gt;
            dgsMenuSetItemText(source, soundItem, &amp;quot;Sound: ON&amp;quot;)&lt;br /&gt;
            outputChatBox(&amp;quot;Sound enabled&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            dgsMenuSetItemText(source, soundItem, &amp;quot;Sound: OFF&amp;quot;)&lt;br /&gt;
            outputChatBox(&amp;quot;Sound disabled&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        return -- Don't hide menu for toggle&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuGetItemText]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuSetItemCommand]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuHide&amp;diff=82206</id>
		<title>DgsMenuHide</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuHide&amp;diff=82206"/>
		<updated>2025-07-10T04:50:45Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function hides a DGS menu and cleans up any associated submenus.&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 dgsMenuHide ( element menu )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element to hide&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the menu was hidden 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&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 150, 120, false)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;New File&amp;quot;, &amp;quot;new&amp;quot;)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Open File&amp;quot;, &amp;quot;open&amp;quot;)&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Handle menu selection&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;exit&amp;quot; then&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        outputChatBox(&amp;quot;Menu closed!&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Selected: &amp;quot; .. command)&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|This function automatically cleans up submenus and removes focus from the menu}}&lt;br /&gt;
{{Note|Menus are automatically hidden when losing focus if autoHide property is enabled (default)}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuShow]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[dgsMenuClean]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuAddItem&amp;diff=82205</id>
		<title>DgsMenuAddItem</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuAddItem&amp;diff=82205"/>
		<updated>2025-07-10T04:50:19Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function adds a new item to a DGS menu. Each item can have text, a command identifier, and can optionally be a child of another item to create submenus.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int, int dgsMenuAddItem ( element menu, string text, string command [, int parentItemID, int position ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element to add the item to&lt;br /&gt;
*'''text:''' The text that will be displayed for this menu item&lt;br /&gt;
*'''command:''' A string identifier for this item (used to identify it when selected)&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''parentItemID:''' The unique ID of a parent item to create a submenu. If not specified, the item is added to the root menu&lt;br /&gt;
*'''position:''' The position where to insert the item. If not specified, the item is added at the end&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the unique item ID and position if the item was added 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&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add root level items&lt;br /&gt;
local timeItem = dgsMenuAddItem(menu, &amp;quot;Time&amp;quot;, &amp;quot;time&amp;quot;)&lt;br /&gt;
local weatherItem = dgsMenuAddItem(menu, &amp;quot;Weather&amp;quot;, &amp;quot;weather&amp;quot;)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add submenu items under &amp;quot;Time&amp;quot;&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Day&amp;quot;, &amp;quot;set_day&amp;quot;, timeItem)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Night&amp;quot;, &amp;quot;set_night&amp;quot;, timeItem)&lt;br /&gt;
&lt;br /&gt;
-- Add submenu items under &amp;quot;Weather&amp;quot;&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Clear&amp;quot;, &amp;quot;clear_weather&amp;quot;, weatherItem)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Rain&amp;quot;, &amp;quot;rain_weather&amp;quot;, weatherItem)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;set_day&amp;quot; then&lt;br /&gt;
        setTime(12, 0)&lt;br /&gt;
        outputChatBox(&amp;quot;Time set to day&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;set_night&amp;quot; then&lt;br /&gt;
        setTime(0, 0)&lt;br /&gt;
        outputChatBox(&amp;quot;Time set to night&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;clear_weather&amp;quot; then&lt;br /&gt;
        setWeather(0)&lt;br /&gt;
        outputChatBox(&amp;quot;Weather set to clear&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;rain_weather&amp;quot; then&lt;br /&gt;
        setWeather(8)&lt;br /&gt;
        outputChatBox(&amp;quot;Weather set to rain&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        outputChatBox(&amp;quot;Menu closed&amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Hide menu after most selections&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
{{Tip|Each item gets a unique ID that can be used with other menu functions like [[dgsMenuGetItemCommand]]}}&lt;br /&gt;
{{Note|Parent items automatically display a &amp;quot;&amp;gt;&amp;quot; indicator when they have child items}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[dgsMenuAddSeparator]]&lt;br /&gt;
*[[dgsMenuRemoveItem]]&lt;br /&gt;
*[[dgsMenuGetItemCommand]]&lt;br /&gt;
*[[dgsMenuShow]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[[User:Mohab|Mohab]].&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemText&amp;diff=82204</id>
		<title>DgsMenuGetItemText</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemText&amp;diff=82204"/>
		<updated>2025-07-10T04:49:42Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function retrieves the displayed text of a menu item.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; string dgsMenuGetItemText ( element menu, int uniqueID ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem)  ===Returns=== Returns the text string if successful, ''false'' if the item doesn't exist.  ==Examples== &amp;lt;sy...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function retrieves the displayed text of a menu item.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string dgsMenuGetItemText ( element menu, int uniqueID )&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;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the text string if successful, ''false'' if the item doesn't exist.&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, 100, false)&lt;br /&gt;
local item1 = dgsMenuAddItem(menu, &amp;quot;New Game&amp;quot;, &amp;quot;new&amp;quot;)&lt;br /&gt;
local item2 = dgsMenuAddItem(menu, &amp;quot;Load Game&amp;quot;, &amp;quot;load&amp;quot;)&lt;br /&gt;
local item3 = dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Get and display the text of menu items&lt;br /&gt;
local text1 = dgsMenuGetItemText(menu, item1)&lt;br /&gt;
local text2 = dgsMenuGetItemText(menu, item2)&lt;br /&gt;
local text3 = dgsMenuGetItemText(menu, item3)&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;Menu items: &amp;quot; .. text1 .. &amp;quot;, &amp;quot; .. text2 .. &amp;quot;, &amp;quot; .. text3)&lt;br /&gt;
-- Output: &amp;quot;Menu items: New Game, Load Game, Exit&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuSetItemText]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuGetItemCommand]]&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>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemText&amp;diff=82203</id>
		<title>DgsMenuSetItemText</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemText&amp;diff=82203"/>
		<updated>2025-07-10T04:47:47Z</updated>

		<summary type="html">&lt;p&gt;Mohab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function changes the displayed text of an existing menu item.&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 dgsMenuSetItemText ( element menu, int uniqueID, string text )&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;
*'''text:''' The new text to display for this menu item&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the text 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 a toggle option&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 160, 120, false)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Start Game&amp;quot;, &amp;quot;start&amp;quot;)&lt;br /&gt;
local soundItem = dgsMenuAddItem(menu, &amp;quot;Sound: ON&amp;quot;, &amp;quot;toggle_sound&amp;quot;)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Track sound state&lt;br /&gt;
local soundEnabled = true&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;start&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Starting game...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;toggle_sound&amp;quot; then&lt;br /&gt;
        -- Toggle sound state and update menu text&lt;br /&gt;
        soundEnabled = not soundEnabled&lt;br /&gt;
        if soundEnabled then&lt;br /&gt;
            dgsMenuSetItemText(source, soundItem, &amp;quot;Sound: ON&amp;quot;)&lt;br /&gt;
            outputChatBox(&amp;quot;Sound enabled&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            dgsMenuSetItemText(source, soundItem, &amp;quot;Sound: OFF&amp;quot;)&lt;br /&gt;
            outputChatBox(&amp;quot;Sound disabled&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        return -- Don't hide menu for toggle&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuGetItemText]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuSetItemCommand]]&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>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemText&amp;diff=82202</id>
		<title>DgsMenuSetItemText</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemText&amp;diff=82202"/>
		<updated>2025-07-10T04:47:38Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function changes the displayed text of an existing menu item.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool dgsMenuSetItemText ( element menu, int uniqueID, string text ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem) *'''text:''' The new text to display for this menu item  ===Returns=== Returns ''true'' i...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function changes the displayed text of an existing menu item.&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 dgsMenuSetItemText ( element menu, int uniqueID, string text )&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;
*'''text:''' The new text to display for this menu item&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the text 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 a toggle option&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 160, 120, false)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Start Game&amp;quot;, &amp;quot;start&amp;quot;)&lt;br /&gt;
local soundItem = dgsMenuAddItem(menu, &amp;quot;Sound: ON&amp;quot;, &amp;quot;toggle_sound&amp;quot;)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Track sound state&lt;br /&gt;
local soundEnabled = true&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;start&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Starting game...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;toggle_sound&amp;quot; then&lt;br /&gt;
        -- Toggle sound state and update menu text&lt;br /&gt;
        soundEnabled = not soundEnabled&lt;br /&gt;
        if soundEnabled then&lt;br /&gt;
            dgsMenuSetItemText(source, soundItem, &amp;quot;Sound: ON&amp;quot;)&lt;br /&gt;
            outputChatBox(&amp;quot;Sound enabled&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            dgsMenuSetItemText(source, soundItem, &amp;quot;Sound: OFF&amp;quot;)&lt;br /&gt;
            outputChatBox(&amp;quot;Sound disabled&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        return -- Don't hide menu for toggle&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuGetItemText]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsMenuSetItemCommand]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
This documentation was created by [[User:Mohab|Mohab]].&lt;br /&gt;
&lt;br /&gt;
[[Category:DGS_functions]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemCommand&amp;diff=82201</id>
		<title>DgsMenuGetItemCommand</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuGetItemCommand&amp;diff=82201"/>
		<updated>2025-07-10T04:44:06Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{Client function}} __NOTOC__ This function retrieves the command identifier of a menu item. The command is used to identify which action should be performed when the item is selected.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; string dgsMenuGetItemCommand ( element menu, int uniqueID ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem)  ===Retur...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function retrieves the command identifier of a menu item. The command is used to identify which action should be performed when the item is 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;
string dgsMenuGetItemCommand ( element menu, int uniqueID )&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;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the command string if successful, ''false'' if the item doesn't exist.&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 different types of items&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
local fileItem = dgsMenuAddItem(menu, &amp;quot;File&amp;quot;, &amp;quot;file&amp;quot;)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;New&amp;quot;, &amp;quot;file_new&amp;quot;, fileItem)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;Open&amp;quot;, &amp;quot;file_open&amp;quot;, fileItem)&lt;br /&gt;
    dgsMenuAddItem(menu, &amp;quot;Save&amp;quot;, &amp;quot;file_save&amp;quot;, fileItem)&lt;br /&gt;
dgsMenuAddSeparator(menu)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&lt;br /&gt;
&lt;br /&gt;
-- Handle menu selections by checking commands&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;
    -- Get the command of the selected item&lt;br /&gt;
    local command = dgsMenuGetItemCommand(source, uniqueID)&lt;br /&gt;
    &lt;br /&gt;
    -- Perform actions based on command&lt;br /&gt;
    if command == &amp;quot;file_new&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Creating new file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;file_open&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Opening file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;file_save&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Saving file...&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        outputChatBox(&amp;quot;Goodbye!&amp;quot;)&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Close menu after action&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsMenuSetItemCommand]]&lt;br /&gt;
*[[dgsMenuAddItem]]&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[onDgsMenuSelect]]&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
This documentation was created by [[User:Mohab|Mohab]].&lt;br /&gt;
&lt;br /&gt;
[[Category:DGS_functions]]&lt;/div&gt;</summary>
		<author><name>Mohab</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;diff=82200</id>
		<title>DgsMenuSetItemCommand</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuSetItemCommand&amp;diff=82200"/>
		<updated>2025-07-10T04:40:37Z</updated>

		<summary type="html">&lt;p&gt;Mohab: 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'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=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem) *'''command:''' Th...&amp;quot;&lt;/p&gt;
&lt;hr /&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>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsMenuAddItem&amp;diff=82199</id>
		<title>DgsMenuAddItem</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsMenuAddItem&amp;diff=82199"/>
		<updated>2025-07-10T04:32:40Z</updated>

		<summary type="html">&lt;p&gt;Mohab: Created page with &amp;quot;{{client function}} __NOTOC__ This function adds a new item to a DGS menu. Each item can have text, a command identifier, and can optionally be a child of another item to create submenus.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; int, int dgsMenuAddItem ( element menu, string text, string command [, int parentItemID, int position ] ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *'''menu:''' The DGS menu element to add the item to *'''text:''' The text that will be display...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function adds a new item to a DGS menu. Each item can have text, a command identifier, and can optionally be a child of another item to create submenus.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int, int dgsMenuAddItem ( element menu, string text, string command [, int parentItemID, int position ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''menu:''' The DGS menu element to add the item to&lt;br /&gt;
*'''text:''' The text that will be displayed for this menu item&lt;br /&gt;
*'''command:''' A string identifier for this item (used to identify it when selected)&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''parentItemID:''' The unique ID of a parent item to create a submenu. If not specified, the item is added to the root menu&lt;br /&gt;
*'''position:''' The position where to insert the item. If not specified, the item is added at the end&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the unique item ID and position if the item was added 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&lt;br /&gt;
local menu = dgsCreateMenu(200, 200, 180, 150, false)&lt;br /&gt;
&lt;br /&gt;
-- Add root level items&lt;br /&gt;
local timeItem = dgsMenuAddItem(menu, &amp;quot;Time&amp;quot;, &amp;quot;time&amp;quot;)&lt;br /&gt;
local weatherItem = dgsMenuAddItem(menu, &amp;quot;Weather&amp;quot;, &amp;quot;weather&amp;quot;)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Exit&amp;quot;, &amp;quot;exit&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- Add submenu items under &amp;quot;Time&amp;quot;&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Day&amp;quot;, &amp;quot;set_day&amp;quot;, timeItem)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Night&amp;quot;, &amp;quot;set_night&amp;quot;, timeItem)&lt;br /&gt;
&lt;br /&gt;
-- Add submenu items under &amp;quot;Weather&amp;quot;&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Clear&amp;quot;, &amp;quot;clear_weather&amp;quot;, weatherItem)&lt;br /&gt;
dgsMenuAddItem(menu, &amp;quot;Rain&amp;quot;, &amp;quot;rain_weather&amp;quot;, weatherItem)&lt;br /&gt;
&lt;br /&gt;
-- Show the menu&lt;br /&gt;
dgsMenuShow(menu)&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;set_day&amp;quot; then&lt;br /&gt;
        setTime(12, 0)&lt;br /&gt;
        outputChatBox(&amp;quot;Time set to day&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;set_night&amp;quot; then&lt;br /&gt;
        setTime(0, 0)&lt;br /&gt;
        outputChatBox(&amp;quot;Time set to night&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;clear_weather&amp;quot; then&lt;br /&gt;
        setWeather(0)&lt;br /&gt;
        outputChatBox(&amp;quot;Weather set to clear&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;rain_weather&amp;quot; then&lt;br /&gt;
        setWeather(8)&lt;br /&gt;
        outputChatBox(&amp;quot;Weather set to rain&amp;quot;)&lt;br /&gt;
    elseif command == &amp;quot;exit&amp;quot; then&lt;br /&gt;
        dgsMenuHide(source)&lt;br /&gt;
        outputChatBox(&amp;quot;Menu closed&amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Hide menu after most selections&lt;br /&gt;
    dgsMenuHide(source)&lt;br /&gt;
end, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
{{Tip|Each item gets a unique ID that can be used with other menu functions like [[dgsMenuGetItemCommand]]}}&lt;br /&gt;
{{Note|Parent items automatically display a &amp;quot;&amp;gt;&amp;quot; indicator when they have child items}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[dgsCreateMenu]]&lt;br /&gt;
*[[dgsMenuAddSeparator]]&lt;br /&gt;
*[[dgsMenuRemoveItem]]&lt;br /&gt;
*[[dgsMenuGetItemCommand]]&lt;br /&gt;
*[[dgsMenuShow]]&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>