<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.rage.mp/w/index.php?action=history&amp;feed=atom&amp;title=Register</id>
	<title>Register - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.rage.mp/w/index.php?action=history&amp;feed=atom&amp;title=Register"/>
	<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Register&amp;action=history"/>
	<updated>2026-11-02T03:57:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.rage.mp/w/index.php?title=Register&amp;diff=18432&amp;oldid=prev</id>
		<title>Xabi: Xabi moved page NAPI.Command.Register to Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Register&amp;diff=18432&amp;oldid=prev"/>
		<updated>2019-11-27T13:09:37Z</updated>

		<summary type="html">&lt;p&gt;Xabi moved page &lt;a href=&quot;/wiki/NAPI.Command.Register&quot; class=&quot;mw-redirect&quot; title=&quot;NAPI.Command.Register&quot;&gt;NAPI.Command.Register&lt;/a&gt; to &lt;a href=&quot;/wiki/Register&quot; title=&quot;Register&quot;&gt;Register&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:09, 27 November 2019&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key rmp_wiki:diff::1.12:old-18313:rev-18432 --&gt;
&lt;/table&gt;</summary>
		<author><name>Xabi</name></author>
	</entry>
	<entry>
		<id>https://wiki.rage.mp/w/index.php?title=Register&amp;diff=18313&amp;oldid=prev</id>
		<title>Muphy: Created page with &quot;Registers a command at runtime.  ==Syntax== &lt;syntaxhighlight lang=&quot;C#&quot; &gt;bool NAPI.Command.Register(MethodInfo method, CommandArgs = null);&lt;/syntaxhighlight&gt;  &#039;&#039;&#039;Optional Argum...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.rage.mp/w/index.php?title=Register&amp;diff=18313&amp;oldid=prev"/>
		<updated>2019-11-27T01:28:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Registers a command at runtime.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;C#&amp;quot; &amp;gt;bool NAPI.Command.Register(MethodInfo method, CommandArgs = null);&amp;lt;/syntaxhighlight&amp;gt;  &amp;#039;&amp;#039;&amp;#039;Optional Argum...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Registers a command at runtime.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C#&amp;quot; &amp;gt;bool NAPI.Command.Register(MethodInfo method, CommandArgs = null);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Optional Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;CommandArgs&amp;#039;&amp;#039;&amp;#039;: null by default&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; This function returns a bool, true if successful and false if failed.&lt;br /&gt;
&lt;br /&gt;
==Usage example(s)==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C#&amp;quot; &amp;gt;&lt;br /&gt;
namespace myresourcename&lt;br /&gt;
{&lt;br /&gt;
    public static class Commands // Make sure to not inherit Script class in order to avoid registering the command on stratup&lt;br /&gt;
    {&lt;br /&gt;
        [Command] // Don&amp;#039;t forget to add the Command Attribute&lt;br /&gt;
        public static void TestCmd(Client sender) // Method must be static!&lt;br /&gt;
        {&lt;br /&gt;
            NAPI.Util.ConsoleOutput(&amp;quot;TestCommand Invoked!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public class Main : Script&lt;br /&gt;
    {&lt;br /&gt;
        [ServerEvent(Event.ResourceStart)]&lt;br /&gt;
        public void ResourceStart()&lt;br /&gt;
        { &lt;br /&gt;
            var methodInfo = Type.GetType(&amp;quot;myresourcename.Commands&amp;quot;).GetMethod(&amp;quot;TestCmd&amp;quot;); // Reflection: Type.GetType(&amp;quot;Namespace.Class&amp;quot;).GetMethod(&amp;quot;Method&amp;quot;);&lt;br /&gt;
            if (methodInfo != null) &lt;br /&gt;
            {&lt;br /&gt;
                var args = new CommandArgs {InvokeString = &amp;quot;test&amp;quot;, Description = &amp;quot;Some description&amp;quot;};&lt;br /&gt;
                var success = NAPI.Command.Register(methodInfo, args);&lt;br /&gt;
                if (success) NAPI.Console.WriteLine(&amp;quot;Command added successfully!&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Serverside API]]&lt;/div&gt;</summary>
		<author><name>Muphy</name></author>
	</entry>
</feed>