McFree

AHK SAMP CMD processor

Feb 18th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; return true and run callback func -> OnSendmycommand(params*)
  2. ; if comand uncnown return false
  3. getCommand(dwParams) {
  4.     if (isInChat() = 1) and (not isDialogOpen()) and (not UseAlternative)
  5.     {
  6.         BlockChatInput()
  7.         sleep 250
  8.         dwAddress := dwSAMP + 0x12D8F8
  9.         chatInput := readString(hGTA, dwAddress, 256)
  10.         if ( InStr(chatInput, "/") ) {
  11.             if (StrLen(chatInput) > 0 ) {
  12.                 unBlockChatInput()
  13.                 params := StrSplit(chatInput, " ")
  14.                 dwAddress := dwSAMP + 0x12D8F8
  15.                 writeString(hGTA, dwAddress, "")
  16.                 AntiCrash()
  17.                 funcname = "OnSend"
  18.                 funcname .= SubStr(params[1], 1)
  19.                 try {
  20.                     callback := RegisterCallback(funcname, "F", 3)
  21.                     DllCall(callback, "Str", params[2], "Str", params[3], "Str", params[4])  
  22.                     return true
  23.                 } catch e {
  24.                     unBlockChatInput()
  25.                     AntiCrash()
  26.                     return false
  27.                 }
  28.             } else {
  29.                 unBlockChatInput()
  30.                 AntiCrash()
  31.             }
  32.         } else {
  33.             unBlockChatInput()
  34.             AntiCrash()
  35.         }
  36.     }
  37.     return false
  38. }
Add Comment
Please, Sign In to add comment