<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: создание команд]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=17532&amp;type=atom" />
	<updated>2022-12-31T16:04:12Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=17532</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: создание команд]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=156159#p156159" />
			<content type="html"><![CDATA[<p><strong>ikryznov</strong><br />Скрипты для игр должны находиться в соответствующей ветке, переношу. А что непонятно в выводимом сообщении об ошибке? Вы его прочитали?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-12-31T16:04:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=156159#p156159</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: создание команд]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=156158#p156158" />
			<content type="html"><![CDATA[<p><a href="https://yapx.ru/album/VRG33">https://yapx.ru/album/VRG33</a> - скрин</p>]]></content>
			<author>
				<name><![CDATA[ikryznov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=42732</uri>
			</author>
			<updated>2022-12-31T15:41:10Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=156158#p156158</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: создание команд]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=156157#p156157" />
			<content type="html"><![CDATA[<p>Данный код выдают ошибку на скрине ниже:</p><div class="codebox"><pre><code>
#If WinActive(&quot;GTA:SA:MP&quot;)
#If
CMD.SwitchOn()
Class CMD {
	Static Status := 0
	Static List := {}

	; CMD.Register(&quot;command&quot;,&quot;testFunc&quot;) - The second parameter is a function
	; CMD.Register(&quot;command&quot;,&quot;testFunc&quot;,testObject) - The second parameter is a method
	Register(Command,Function, Object := &quot;&quot;) {
		If ( IsObject(Object) ) {
			Function := ObjBindMethod(Object,Function)
			CMD.List[Command] := Function 
			return 0
		} else if ( IsFunc(Function) ) {
			CMD.List[Command] := Function
			return 0
		} else return 1
	}
	SwitchOn() {
		If ( !CMD.Status ) {
			Static Function := ObjBindMethod(CMD,&quot;Check&quot;)
			Hotkey, If, WinActive(&quot;GTA:SA:MP&quot;)
			Hotkey, ~Enter,% Function, On, UseErrorLevel
			CMD.Status := ( ErrorLevel == 0 ) ? &quot;1&quot; : &quot;0&quot;
			return ErrorLevel
		} else return 1
	}
	SwitchOff() {
		If ( CMD.Status != 0 ) {
			Hotkey, If, WinActive(&quot;GTA:SA:MP&quot;)
			Hotkey, ~Enter, Off, UseErrorLevel
			CMD.Status := ( ErrorLevel == 0 ) ? &quot;0&quot; : &quot;1&quot;
			return ErrorLevel
		} else return 1
	}
	Check() {
		if ( isInChat() ) {
			KeyWait, Enter
			sleep 150 
			Input := readString(hGTA, dwSAMP + 0x141A78, 256)
			If ( SubStr(Input,1,1) == &quot;/&quot; &amp;&amp; RegExMatch(Input,&quot;(\w+)&quot;, Command, 2) &amp;&amp; CMD.List[Command] ) {
				writeString(hGTA, dwSAMP + 0x141A78, &quot;&quot;)
				Function := CMD.List[Command], Arguments := StrSplit(SubStr(Input,3+StrLen(Command),StrLen(Input)-2-StrLen(Command)),&quot; &quot;)
				While ( Arguments.Length() &lt; IsFunc(Function) )
					Arguments.Push(&quot;&quot;)
				%Function%(Arguments*)
			}
		}
	}
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ikryznov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=42732</uri>
			</author>
			<updated>2022-12-31T15:39:55Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=156157#p156157</id>
		</entry>
</feed>
