Блокировка чата в коммандном процессоре

tricksterbs

Новичок
Автор темы
1
0
Версия SA-MP
  1. 0.3.7 (R1)
Нужна помощь, есть проект в котором реализованы команды. Единственное что мешает это отправление на сервер каждой команды.
Код КП:
AutoHotKey:
#If WinActive("GTA:SA:MP")
#If
CMD.SwitchOn()
Class CMD {
    Static Status := 0
    Static List := {}

    Register(Command,Function, Object := "") {
        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,"Check")
            Hotkey, If, WinActive("GTA:SA:MP")
            Hotkey, ~Enter,% Function, On, UseErrorLevel
            CMD.Status := ( ErrorLevel == 0 ) ? "1" : "0"
            return ErrorLevel
        } else return 1
    }
    SwitchOff() {
        If ( CMD.Status != 0 ) {
            Hotkey, If, WinActive("GTA:SA:MP")
            Hotkey, ~Enter, Off, UseErrorLevel
            CMD.Status := ( ErrorLevel == 0 ) ? "0" : "1"
            return ErrorLevel
        } else return 1
    }
    Check() {
        If ( isInChat() ) {
            KeyWait, Enter
            sleep 150
            Input := readString(hGTA, dwSAMP + 0x12D8F8, 256)
            If ( SubStr(Input,1,1) == "/" && RegExMatch(Input,"(\w+)", Command, 2) && CMD.List[Command] ) {
                writeString(hGTA, dwSAMP + 0x12D8F8, "")
                Function := CMD.List[Command], Arguments := StrSplit(SubStr(Input,3+StrLen(Command),StrLen(Input)-2-StrLen(Command))," ")
                While ( Arguments.Length() < IsFunc(Function) )
                    Arguments.Push("")
                %Function%(Arguments*)
            }
        }
    }
}

Нужно реализовать это как-то через BlockchatInput() ; UnBlockChatInput()
Сколько по форумам лазал так и не смог найти/разобраться.
 

Вложения

  • 12313.jpg
    12313.jpg
    21.8 KB · Просмотры: 7