Advertisement
michalmonday

autoDrugs.cs keypress

Jan 9th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. 0000:
  2.  
  3. repeat
  4. wait 50
  5. until 0AFA: is_samp_available
  6.  
  7. alloc 1@ 500
  8. 0B34: samp register_client_command "autodrugs" to_label @toggle
  9. 31@ = 0
  10.  
  11. if 0AAB: file_exists "CLEO\autoDrugsSettings.ini"
  12. then
  13. 0AF0: 10@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "after_buy_cmd"
  14. 0AF0: 11@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "after_buy_item_min"
  15. 0AF0: 12@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "after_buy_item_max"
  16. 0AF0: 13@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "after_all_buying"
  17. 0AF0: 14@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "before_sending_dialog_min"
  18. 0AF0: 15@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "before_sending_dialog_max"
  19. 0AF0: 16@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "before_next_produce_heroin"
  20. 0AF0: 17@ = get_int_from_ini_file "CLEO\autoDrugsSettings.ini" section "Settings" key "deactivation_key"
  21. //alloc 30@ 200
  22. //format 30@ "autoDrugsSettings: %d %d %d %d %d %d %d %d" 10@ 11@ 12@ 13@ 14@ 15@ 16@ 17@
  23. //chatmsg 30@ -1
  24. //free 30@
  25. else
  26. 0AF8: samp add_message_to_chat "{F7F694}CLEO\autoDrugsSettings.ini {FF4800}not found. {F7F694}The mod won't work"
  27. 0A93: end_custom_thread
  28. end
  29.  
  30. while true
  31. wait 0
  32. if 31@ == 1
  33. then
  34.  
  35. //deactivation by key
  36. call @DeactivationCheck 2 key 17@ state 31@ _returnedState 31@
  37.  
  38. say "/buy"
  39. wait 10@
  40. for 30@ = 1 to 5
  41. call @WaitRandomTime 2 lowerBorder 11@ higherBorder 12@
  42. // 0B49: samp set_current_dialog_list_item 3 // 3 id could be 4th item
  43. wait 200
  44. 0AB1: @FAKE_KEYPRESS 2 key 0x28 300
  45. wait 200
  46. 0AB1: @FAKE_KEYPRESS 2 key 0x28 300
  47. wait 200
  48. 0AB1: @FAKE_KEYPRESS 2 key 0x28 300
  49. wait 200
  50. 0B47: samp close_current_dialog_with_button 1 //buy button
  51. wait 500
  52. end
  53. 0B47: samp close_current_dialog_with_button 2 //close button
  54. wait 13@
  55.  
  56. for 30@ = 1 to 5
  57. say "/produce heroin"
  58. // wait for dialog
  59.  
  60. for 29@ = 1 to 3
  61. while 8B4C: samp is_dialog_active -1
  62. wait 0
  63. wait 20
  64. call @DeactivationCheck 2 key 17@ state 31@ _returnedState 31@
  65. if 31@ == 0
  66. then
  67. break
  68. end
  69. end
  70.  
  71. 0BD7: 1@ //get text
  72. call @GetLast11CharactersFromString 1 stringPointer 1@ _returnedPointer 2@
  73. call @WaitRandomTime 2 lowerBorder 14@ higherBorder 15@
  74. call @SendDialogResponse 1 responseStringPointer 2@
  75. wait 100
  76. //printf 2@ 1000
  77.  
  78. call @DeactivationCheck 2 key 17@ state 31@ _returnedState 31@
  79. if 31@ == 0
  80. then
  81. break
  82. end
  83. end
  84.  
  85. wait 16@
  86. end
  87.  
  88. end
  89. end
  90.  
  91. :toggle
  92. 0B12: 31@ = 31@ 1
  93. if 31@ == 1
  94. then
  95. printf "autoDrugs is ~G~activated" 1000
  96. else
  97. printf "autoDrugs is ~R~deactivated" 1000
  98. end
  99. samp.CmdRet()
  100.  
  101. :GetLast11CharactersFromString
  102. 0C17: 31@ = strlen 0@
  103. 005A: 0@ += 31@ // (int)
  104. 0@ -= 11
  105. ret 1 0@
  106.  
  107. :DeactivationCheck
  108. if key_down 0@
  109. then
  110. printf "autoDrugs is ~R~deactivated" 1000
  111. 1@ = 0
  112. end
  113. ret 1 1@
  114.  
  115. :WaitRandomTime// 2 2873 3861
  116. 0209: 31@ = random_int_in_ranges 0@ 1@
  117. wait 31@
  118. ret 0
  119.  
  120. :SendDialogResponse
  121. 0B4B: samp set_current_dialog_editbox_text 0@
  122. 0B47: samp close_current_dialog_with_button 1
  123. ret 0
  124.  
  125.  
  126.  
  127. :FAKE_KEYPRESS
  128. if 0AA2: 2@ = load_library "User32.dll"
  129. then
  130. if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
  131. then
  132. 0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
  133. wait 1@
  134. 0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
  135. end
  136. end
  137. 0AB2: ret 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement