Guest User

J's SA-MP Keybinder w/AutoReply v1.12

a guest
Apr 3rd, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; J's SAMP Keybinder with Automated Responses V1.12
  2. ; Jaycob.co.nf for more San Andreas Multiplayer scripts
  3. ; Updated on 03/04/2013
  4. #SingleInstance force
  5. ; check for chatlog
  6. INIRead, logfile, binds.ini, general, logfile
  7. If (logfile == "ERROR"){
  8.     msgbox Hit Ok and find the SAMP chatlog (default location on WindowsXP is "My Documents\GTA San Andreas User Files\SAMP\chatlog.txt") You can ignor this by hitting cancel on the next window if you don't plan on using automated responses. It will ask again on next launch incase you change your mind.
  9.    FileSelectFile, logfile,,,Selet GTA chat log, Documents (*.txt)
  10.    If (logfile == ""){
  11.       MsgBox, No file selected, automated responses wont work.
  12.    } Else {
  13.       INIWrite, %logfile%, binds.ini, general, logfile
  14.    }
  15. }
  16. ; Main GUI
  17. main:
  18. IniRead, box1, %A_ScriptDir%\binds.ini, Binds, box1
  19. IniRead, box2, %A_ScriptDir%\binds.ini, Binds, box2
  20. IniRead, box3, %A_ScriptDir%\binds.ini, Binds, box3
  21. IniRead, box4, %A_ScriptDir%\binds.ini, Binds, box4
  22. IniRead, box5, %A_ScriptDir%\binds.ini, Binds, box5
  23. IniRead, box6, %A_ScriptDir%\binds.ini, Binds, box6
  24. IniRead, box7, %A_ScriptDir%\binds.ini, Binds, box7
  25. IniRead, box8, %A_ScriptDir%\binds.ini, Binds, box8
  26. IniRead, box9, %A_ScriptDir%\binds.ini, Binds, box9
  27. IniRead, box0, %A_ScriptDir%\binds.ini, Binds, box0
  28. IniRead, box11, %A_ScriptDir%\binds.ini, Binds, box11
  29. IniRead, box21, %A_ScriptDir%\binds.ini, Binds, box21
  30. IniRead, box31, %A_ScriptDir%\binds.ini, Binds, box31
  31. IniRead, box41, %A_ScriptDir%\binds.ini, Binds, box41
  32. IniRead, box51, %A_ScriptDir%\binds.ini, Binds, box51
  33. IniRead, box61, %A_ScriptDir%\binds.ini, Binds, box61
  34. IniRead, box71, %A_ScriptDir%\binds.ini, Binds, box71
  35. IniRead, box81, %A_ScriptDir%\binds.ini, Binds, box81
  36. IniRead, box91, %A_ScriptDir%\binds.ini, Binds, box91
  37. IniRead, box01, %A_ScriptDir%\binds.ini, Binds, box01
  38. IniRead, boxsub, %A_ScriptDir%\binds.ini, Binds, boxsub
  39. IniRead, boxadd, %A_ScriptDir%\binds.ini, Binds, boxadd
  40. IniRead, boxent, %A_ScriptDir%\binds.ini, Binds, boxent
  41. IniRead, boxdot, %A_ScriptDir%\binds.ini, Binds, boxdot
  42. IniRead, boxphr, %A_ScriptDir%\binds.ini, Binds, boxphr
  43. IniRead, boxres, %A_ScriptDir%\binds.ini, Binds, boxres
  44. Gui, Add, Text, x406 y20 w150 h510 , Examples:
  45. Gui, Add, Text, x414 y38 w120 h60 , /me has done that
  46. Gui, Add, Text, x414 y58 w110 h20 , /s WOOOO
  47. Gui, Add, Text, x416 y80 w80 h20 , Good'ay mate.
  48. Gui, Add, Text, x416 y100 w110 h20 , /enter
  49. Gui, Add, Text, x406 y120 w140 h50 , Avoid using ^`, !`, * certain punctuations might act as keys (like Enter or Ctrl)
  50. Gui, Add, Text, x406 y170 w150 h40 , To send more than one with one key add "{ENTER}t" between the lines
  51. Gui, Add, Text, x406 y220 w100 h20 , Examples:
  52. Gui, Add, Text, x416 y240 w110 h30 , /getmats{ENTER}t/me picks up some mats
  53. Gui, Add, Text, x416 y270 w120 h30 , /me opens the door and enters{ENTER}t/enter
  54. Gui, Add, Text, x416 y300 w140 h30 , /fucku{ENTER}tFUCKER
  55. Gui, Add, Text, x406 y320 w150 h70 , If it says "ERROR" it's because there's no save(binds.ini). They will go away when you replace them with anything`, hit ok and a save is created
  56. Gui, Add, Button, x406 y400 w140 h40 , AutoReply
  57. Gui, Add, Text, x406 y460 w140 h70 , F11 will bring you back to this window. NUMLOCK to toggle hotkeys. Right click the icon next to the time and hit exit to exit.
  58. Gui, Add, Button, x406 y540 w140 h70 , OK
  59. Gui, Add, Text, x6 y20 w130 h20 , *NUMPAD1*
  60. Gui, Add, Text, x6 y70 w130 h20 , *NUMPAD2*
  61. Gui, Add, Text, x6 y120 w130 h20 , *NUMPAD3*
  62. Gui, Add, Text, x6 y170 w130 h20 , *NUMPAD4*
  63. Gui, Add, Text, x6 y220 w130 h20 , *NUMPAD5*
  64. Gui, Add, Text, x6 y270 w130 h20 , *NUMPAD6*
  65. Gui, Add, Text, x6 y320 w130 h20 , *NUMPAD7*
  66. Gui, Add, Text, x6 y370 w130 h20 , *NUMPAD8*
  67. Gui, Add, Text, x6 y420 w130 h20 , *NUMPAD9*
  68. Gui, Add, Text, x6 y470 w130 h20 , *NUMPAD0*
  69. Gui, Add, Text, x6 y520 w130 h20 , *NUMPAD ENTER*
  70. Gui, Add, Text, x6 y570 w130 h20 , *NUMPAD DOT*
  71. Gui, Add, Text, x206 y20 w130 h20 , *ALT+NUMPAD1*
  72. Gui, Add, Text, x206 y70 w130 h20 , *ALT+NUMPAD2*
  73. Gui, Add, Text, x206 y120 w130 h20 , *ALT+NUMPAD3*
  74. Gui, Add, Text, x206 y170 w130 h20 , *ALT+NUMPAD4*
  75. Gui, Add, Text, x206 y220 w130 h20 , *ALT+NUMPAD5*
  76. Gui, Add, Text, x206 y270 w130 h20 , *ALT+NUMPAD6*
  77. Gui, Add, Text, x206 y320 w130 h20 , *ALT+NUMPAD7*
  78. Gui, Add, Text, x206 y370 w130 h20 , *ALT+NUMPAD8*
  79. Gui, Add, Text, x206 y420 w130 h20 , *ALT+NUMPAD9*
  80. Gui, Add, Text, x206 y470 w130 h20 , *ALT+NUMPAD0*
  81. Gui, Add, Text, x206 y520 w130 h20 , *NUMPAD ADD*
  82. Gui, Add, Text, x206 y570 w130 h20 , *NUMPAD SUB*
  83. Gui, Add, Edit, x6 y40 vbox1 w190 h20 , %box1%
  84. Gui, Add, Edit, x6 y90 vbox2 w190 h20 , %box2%
  85. Gui, Add, Edit, x6 y140 vbox3 w190 h20 , %box3%
  86. Gui, Add, Edit, x6 y190 vbox4 w190 h20 , %box4%
  87. Gui, Add, Edit, x6 y240 vbox5 w190 h20 , %box5%
  88. Gui, Add, Edit, x6 y290 vbox6 w190 h20 , %box6%
  89. Gui, Add, Edit, x6 y340 vbox7 w190 h20 , %box7%
  90. Gui, Add, Edit, x6 y390 vbox8 w190 h20 , %box8%
  91. Gui, Add, Edit, x6 y440 vbox9 w190 h20 , %box9%
  92. Gui, Add, Edit, x6 y490 vbox0 w190 h20 , %box0%
  93. Gui, Add, Edit, x6 y540 vboxent w190 h20 , %boxent%
  94. Gui, Add, Edit, x6 y590 vboxdot w190 h20 , %boxdot%
  95. Gui, Add, Edit, x206 y590 vboxsub w190 h20 , %boxsub%
  96. Gui, Add, Edit, x206 y540 vboxadd w190 h20 , %boxadd%
  97. Gui, Add, Edit, x206 y490 vbox01 w190 h20 , %box01%
  98. Gui, Add, Edit, x206 y440 vbox91 w190 h20 , %box91%
  99. Gui, Add, Edit, x206 y390 vbox81 w190 h20 , %box81%
  100. Gui, Add, Edit, x206 y340 vbox71 w190 h20 , %box71%
  101. Gui, Add, Edit, x206 y290 vbox61 w190 h20 , %box61%
  102. Gui, Add, Edit, x206 y240 vbox51 w190 h20 , %box51%
  103. Gui, Add, Edit, x206 y190 vbox41 w190 h20 , %box41%
  104. Gui, Add, Edit, x206 y140 vbox31 w190 h20 , %box31%
  105. Gui, Add, Edit, x206 y90 vbox21 w190 h20 , %box21%
  106. Gui, Add, Edit, x206 y40 vbox11 w190 h20 , %box11%
  107. Gui, Add, Text, x126 y0 w250 h20 +Center, @!@@.:J's SA-MP Keybinder v1.12:.@@!@
  108. Gui, Show, w558 h628, J's SA-MP Binder v1.12
  109. return
  110. ; Main GUI AutoReply button
  111. ButtonAutoReply:
  112. gui, submit
  113. IniWrite, %box1%, %A_ScriptDir%\binds.ini, Binds, box1
  114. IniWrite, %box2%, %A_ScriptDir%\binds.ini, Binds, box2
  115. IniWrite, %box3%, %A_ScriptDir%\binds.ini, Binds, box3
  116. IniWrite, %box4%, %A_ScriptDir%\binds.ini, Binds, box4
  117. IniWrite, %box5%, %A_ScriptDir%\binds.ini, Binds, box5
  118. IniWrite, %box6%, %A_ScriptDir%\binds.ini, Binds, box6
  119. IniWrite, %box7%, %A_ScriptDir%\binds.ini, Binds, box7
  120. IniWrite, %box8%, %A_ScriptDir%\binds.ini, Binds, box8
  121. IniWrite, %box9%, %A_ScriptDir%\binds.ini, Binds, box9
  122. IniWrite, %box0%, %A_ScriptDir%\binds.ini, Binds, box0
  123. IniWrite, %box11%, %A_ScriptDir%\binds.ini, Binds, box11
  124. IniWrite, %box21%, %A_ScriptDir%\binds.ini, Binds, box21
  125. IniWrite, %box31%, %A_ScriptDir%\binds.ini, Binds, box31
  126. IniWrite, %box41%, %A_ScriptDir%\binds.ini, Binds, box41
  127. IniWrite, %box51%, %A_ScriptDir%\binds.ini, Binds, box51
  128. IniWrite, %box61%, %A_ScriptDir%\binds.ini, Binds, box61
  129. IniWrite, %box71%, %A_ScriptDir%\binds.ini, Binds, box71
  130. IniWrite, %box81%, %A_ScriptDir%\binds.ini, Binds, box81
  131. IniWrite, %box91%, %A_ScriptDir%\binds.ini, Binds, box91
  132. IniWrite, %box01%, %A_ScriptDir%\binds.ini, Binds, box01
  133. IniWrite, %boxent%, %A_ScriptDir%\binds.ini, Binds, boxent
  134. IniWrite, %boxsub%, %A_ScriptDir%\binds.ini, Binds, boxsub
  135. IniWrite, %boxadd%, %A_ScriptDir%\binds.ini, Binds, boxadd
  136. IniWrite, %boxdot%, %A_ScriptDir%\binds.ini, Binds, boxdot
  137. Gui, Destroy
  138. ; Autoreply GUI
  139. INIRead, logfile, binds.ini, general, logfile
  140. If (logfile == "ERROR"){
  141.     msgbox you must restart this program and select the SAMP chatlog to use this function
  142.     goto main
  143. }
  144. else
  145. IniRead, boxphr1, %A_ScriptDir%\binds.ini, Binds, boxphr1
  146. IniRead, boxphr2, %A_ScriptDir%\binds.ini, Binds, boxphr2
  147. IniRead, boxphr3, %A_ScriptDir%\binds.ini, Binds, boxphr3
  148. IniRead, boxres1, %A_ScriptDir%\binds.ini, Binds, boxres1
  149. IniRead, boxres2, %A_ScriptDir%\binds.ini, Binds, boxres2
  150. IniRead, boxres3, %A_ScriptDir%\binds.ini, Binds, boxres3
  151. Gui, Add, Text, x6 y0 w320 h20 , Automated responses:
  152. Gui, Add, Text, x12 y20 w310 h30 , Automaticly sends the "Reply" box if they say what's written in the "if they say" box
  153. Gui, Add, Text, x6 y50 w280 h20 +Center, *Buggy* to disable write gibberish in the "if they say" box
  154. Gui, Add, Text, x166 y70 w160 h20 , Reply:
  155. Gui, Add, Edit, x166 y90 vboxphr1 w160 h20 , %boxphr1%
  156. Gui, Add, Edit, x166 y110 vboxphr2 w160 h20 , %boxphr2%
  157. Gui, Add, Edit, x166 y130 vboxphr3 w160 h20 , %boxphr3%
  158. Gui, Add, Text, x6 y70 w160 h20 , If they say:
  159. Gui, Add, Edit, x6 y90 vboxres1 w160 h20 , %boxres1%
  160. Gui, Add, Edit, x6 y110 vboxres2 w160 h20 , %boxres2%
  161. Gui, Add, Edit, x6 y130 vboxres3 w160 h20 , %boxres3%
  162. Gui, Add, Button, x6 y150 w320 h40 , Set
  163. Gui, Show, w336 h197, Js SAMP Automated Responses
  164. return
  165. ; Autoreply GUI Set button GUI
  166. ButtonSet:
  167. gui, submit
  168. IniWrite, %boxphr1%, %A_ScriptDir%\binds.ini, Binds, boxphr1
  169. IniWrite, %boxres1%, %A_ScriptDir%\binds.ini, Binds, boxres1
  170. IniWrite, %boxphr2%, %A_ScriptDir%\binds.ini, Binds, boxphr2
  171. IniWrite, %boxres2%, %A_ScriptDir%\binds.ini, Binds, boxres2
  172. IniWrite, %boxphr3%, %A_ScriptDir%\binds.ini, Binds, boxphr3
  173. IniWrite, %boxres3%, %A_ScriptDir%\binds.ini, Binds, boxres3
  174. gui, destroy
  175. goto, main
  176. return
  177. ; Main GUI Ok button
  178. ButtonOK:
  179. gui, submit
  180. IniWrite, %box1%, %A_ScriptDir%\binds.ini, Binds, box1
  181. IniWrite, %box2%, %A_ScriptDir%\binds.ini, Binds, box2
  182. IniWrite, %box3%, %A_ScriptDir%\binds.ini, Binds, box3
  183. IniWrite, %box4%, %A_ScriptDir%\binds.ini, Binds, box4
  184. IniWrite, %box5%, %A_ScriptDir%\binds.ini, Binds, box5
  185. IniWrite, %box6%, %A_ScriptDir%\binds.ini, Binds, box6
  186. IniWrite, %box7%, %A_ScriptDir%\binds.ini, Binds, box7
  187. IniWrite, %box8%, %A_ScriptDir%\binds.ini, Binds, box8
  188. IniWrite, %box9%, %A_ScriptDir%\binds.ini, Binds, box9
  189. IniWrite, %box0%, %A_ScriptDir%\binds.ini, Binds, box0
  190. IniWrite, %box11%, %A_ScriptDir%\binds.ini, Binds, box11
  191. IniWrite, %box21%, %A_ScriptDir%\binds.ini, Binds, box21
  192. IniWrite, %box31%, %A_ScriptDir%\binds.ini, Binds, box31
  193. IniWrite, %box41%, %A_ScriptDir%\binds.ini, Binds, box41
  194. IniWrite, %box51%, %A_ScriptDir%\binds.ini, Binds, box51
  195. IniWrite, %box61%, %A_ScriptDir%\binds.ini, Binds, box61
  196. IniWrite, %box71%, %A_ScriptDir%\binds.ini, Binds, box71
  197. IniWrite, %box81%, %A_ScriptDir%\binds.ini, Binds, box81
  198. IniWrite, %box91%, %A_ScriptDir%\binds.ini, Binds, box91
  199. IniWrite, %box01%, %A_ScriptDir%\binds.ini, Binds, box01
  200. IniWrite, %boxent%, %A_ScriptDir%\binds.ini, Binds, boxent
  201. IniWrite, %boxsub%, %A_ScriptDir%\binds.ini, Binds, boxsub
  202. IniWrite, %boxadd%, %A_ScriptDir%\binds.ini, Binds, boxadd
  203. IniWrite, %boxdot%, %A_ScriptDir%\binds.ini, Binds, boxdot
  204. sleep 100
  205. WinWait, GTA:SA:MP,
  206. IfWinNotActive, GTA:SA:MP, , WinActivate, GTA:SA:MP,
  207. WinWaitActive, GTA:SA:MP,
  208. sleep 100
  209. ; AutoReply Chatlog reader/sender
  210. last = 1
  211. line = 2
  212. phrase1 = %boxphr1%
  213. response1 = %boxres1%
  214. phrase2 = %boxphr2%
  215. response2 = %boxres2%
  216. phrase3 = %boxphr3%
  217. response3 = %boxres3%
  218. loop,{
  219. top:
  220. Loop, read, %logfile%
  221.     {
  222.         if A_LoopReadLine > 0
  223.             {
  224.             line = %A_LoopReadLine%
  225.             }
  226.     }
  227. go:
  228.         if last = %line%
  229.             {
  230.             goto top
  231.             }  
  232. IfInString, line, %response1%          
  233. {
  234. send t{CtrlDown}a{CtrlUp}{delete}%phrase1%{enter}
  235. sleep 5000
  236. goto top
  237. }
  238. else
  239. IfInString, line, %response2%  
  240. {
  241. send t{CtrlDown}a{CtrlUp}{delete}%phrase2%{enter}
  242. sleep 5000
  243. goto top
  244. }
  245. else
  246. IfInString, line, %response3%  
  247. {
  248. send t{CtrlDown}a{CtrlUp}{delete}%phrase3%{enter}
  249. sleep 5000
  250. goto top
  251. }
  252. else
  253. sleep 1000
  254. goto top
  255. }
  256. return
  257. ; Main Gui hotkey
  258. F11::
  259. Gui, destroy
  260. goto, main
  261. return
  262. ; Bind Hotkeys
  263. Numpad0::
  264.     send, t{CtrlDown}a{CtrlUp}{delete}%box0%{enter}
  265.     return
  266. !Numpad0:: 
  267.     send, t{CtrlDown}a{CtrlUp}{delete}%box01%{enter}
  268.     return
  269. Numpad1::  
  270.     send, t{CtrlDown}a{CtrlUp}{delete}%box1%{enter}
  271.     return
  272. !Numpad1:: 
  273.     send, t{CtrlDown}a{CtrlUp}{delete}%box11%{enter}
  274.     return
  275. Numpad2::  
  276.     send, t{CtrlDown}a{CtrlUp}{delete}%box2%{enter}
  277.     return
  278. !Numpad2:: 
  279.     send, t{CtrlDown}a{CtrlUp}{delete}%box21%{enter}
  280.     return
  281. Numpad3::  
  282.     send, t{CtrlDown}a{CtrlUp}{delete}%box3%{enter}
  283.     return
  284. !Numpad3:: 
  285.     send, t{CtrlDown}a{CtrlUp}{delete}%box31%{enter}
  286.     return
  287. Numpad4::  
  288.     send, t{CtrlDown}a{CtrlUp}{delete}%box4%{enter}
  289.     return
  290. !Numpad4:: 
  291.     send, t{CtrlDown}a{CtrlUp}{delete}%box41%{enter}
  292.     return
  293. Numpad5::  
  294.     send, t{CtrlDown}a{CtrlUp}{delete}%box5%{enter}
  295.     return
  296. !Numpad5:: 
  297.     send, t{CtrlDown}a{CtrlUp}{delete}%box51%{enter}
  298.     return
  299. Numpad6::  
  300.     send, t{CtrlDown}a{CtrlUp}{delete}%box6%{enter}
  301.     return
  302. !Numpad6:: 
  303.     send, t{CtrlDown}a{CtrlUp}{delete}%box61%{enter}
  304.     return
  305. Numpad7::  
  306.     send, t{CtrlDown}a{CtrlUp}{delete}%box7%{enter}
  307.     return
  308. !Numpad7:: 
  309.     send, t{CtrlDown}a{CtrlUp}{delete}%box71%{enter}
  310.     return
  311. Numpad8::  
  312.     send, t{CtrlDown}a{CtrlUp}{delete}%box8%{enter}
  313.     return
  314. !Numpad8:: 
  315.     send, t{CtrlDown}a{CtrlUp}{delete}%box81%{enter}
  316.     return
  317. Numpad9::  
  318.     send, t{CtrlDown}a{CtrlUp}{delete}%box9%{enter}
  319.     return
  320. !Numpad9:: 
  321.     send, t{CtrlDown}a{CtrlUp}{delete}%box91%{enter}
  322.     return
  323. Numpadsub::
  324.     send, t{CtrlDown}a{CtrlUp}{delete}%boxsub%{enter}
  325.     return
  326. Numpadadd::
  327.     send, t{CtrlDown}a{CtrlUp}{delete}%boxadd%{enter}
  328.     return
  329. Numpaddot::
  330.     send, t{CtrlDown}a{CtrlUp}{delete}%boxdot%{enter}
  331.     return
  332. NumpadEnter::
  333.     send, t{CtrlDown}a{CtrlUp}{delete}%boxent%{enter}
  334.     return
  335. ; ALT+F11 to reload script(added for testing purposes)
  336. !f11::reload
  337. ; fin
Advertisement
Add Comment
Please, Sign In to add comment