<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/IsCommandHandlerAdded?action=history&amp;feed=atom</id>
	<title>IsCommandHandlerAdded - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/IsCommandHandlerAdded?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsCommandHandlerAdded&amp;action=history"/>
	<updated>2026-05-09T05:40:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsCommandHandlerAdded&amp;diff=76218&amp;oldid=prev</id>
		<title>Hydra: Created page with &quot;{{Useful Function}} &lt;lowercasetitle&gt;&lt;/lowercasetitle&gt; __NOTOC__ Checks if a command is added in the respective resource.  ==Syntax==  &lt;syntaxhighlight lang=&quot;lua&quot;&gt; isCommandHandlerAdded(string command) &lt;/syntaxhighlight&gt;  ===Required Arguments=== *'''command:''' The name of the command you want to check.  ===Returns=== Return true if the command exists and false if not.  ==Code== &lt;section name=&quot;Serverside script&quot; class=&quot;server&quot; show=&quot;true&quot;&gt; &lt;syntaxhighlight lang=&quot;lua&quot;&gt; fu...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsCommandHandlerAdded&amp;diff=76218&amp;oldid=prev"/>
		<updated>2023-02-16T09:33:11Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Useful Function}} &amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt; __NOTOC__ Checks if a command is added in the respective resource.  ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; isCommandHandlerAdded(string command) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments=== *&amp;#039;&amp;#039;&amp;#039;command:&amp;#039;&amp;#039;&amp;#039; The name of the command you want to check.  ===Returns=== Return true if the command exists and false if not.  ==Code== &amp;lt;section name=&amp;quot;Serverside script&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt; &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; fu...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Checks if a command is added in the respective resource.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
isCommandHandlerAdded(string command)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''command:''' The name of the command you want to check.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Return true if the command exists and false if not.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Serverside script&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;
function isCommandHandlerAdded(theCmd)&lt;br /&gt;
   local commands = getCommandHandlers()&lt;br /&gt;
   for _, v in ipairs(commands) do&lt;br /&gt;
       if v[1] == theCmd then&lt;br /&gt;
          return true&lt;br /&gt;
       end&lt;br /&gt;
   end&lt;br /&gt;
   return false&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Author: Hydra45&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&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;
&lt;br /&gt;
local tps = {&amp;quot;sf&amp;quot;, &amp;quot;lv&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerCommand&amp;quot;, root, function(cmd)&lt;br /&gt;
    for _, tele in ipairs(tps) do&lt;br /&gt;
        if cmd == tele then&lt;br /&gt;
           if not isCommandHandlerAdded(tele) then&lt;br /&gt;
              print(&amp;quot;Indeed, it's not added&amp;quot;)&lt;br /&gt;
           else&lt;br /&gt;
              print(&amp;quot;Seems like it's added&amp;quot;)&lt;br /&gt;
           end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;sf&amp;quot;, function(thePlayer, _)&lt;br /&gt;
end)&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Hydra</name></author>
	</entry>
</feed>