Advertisement
Guest User

asdasdas

a guest
Sep 15th, 2019
816
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.03 KB | None | 0 0
  1. --[[ Script Start ]]
  2.  
  3. ------------------------------------------ [[ 玩家自定义 ]] ------------------------------------------
  4. -- 推荐边查阅帮助文档,边对下列内容进行修改。
  5. -- 参考地址: https://github.com/kiccer/Soldier76#%E5%88%9D%E6%AC%A1%E4%BD%BF%E7%94%A8
  6. userInfo = {
  7.  
  8. -- 是否输出调试信息,关闭后可以减小 CPU 计算压力。建议调试时开启,调试完毕后关闭。(1 - 开启 | 0 - 关闭)
  9. debug = 1,
  10.  
  11. -- CPU 负载等级,建议输入 1 ~ 30 之间的数字,不能小于 1 。值越小,压枪效果越好,值越大,帧数越高。(过分掉帧会直接影响压枪效果,请在保证帧数的情况下减小该值)
  12. cpuLoad = 5,
  13.  
  14. -- 灵敏度调整
  15. sensitivity = {
  16. -- 开镜
  17. ADS = 34,
  18. -- è…°å°„
  19. Aim = 0.55,
  20. -- 二倍
  21. scopeX2 = 1.0,
  22. -- 三倍
  23. scopeX3 = 1.0,
  24. -- 四倍
  25. scopeX4 = 1.0,
  26. -- 六倍
  27. scopeX6 = 1.0,
  28. },
  29.  
  30. -- 自动腰射,不使用自动腰射留空,使用则设置为键盘上按键,默认为 tilde -> ~ 键
  31. autoPressAimKey = "ralt",
  32.  
  33. -- 是否自动连发 (单发模式变全自动 1 - 开启, 0 - 关闭)
  34. autoContinuousFiring = 1, -- 默认为 1
  35.  
  36. -- 启动控制 (capslock - 使用大写锁定键控制 | numlock - 小键盘锁定键控制 | G_bind - 使用指令控制)
  37. startControl = "capslock",
  38.  
  39. -- 瞄准设置 (default - 使用游戏默认设置 | recommend - 使用脚本推荐设置 | custom - 自定义设置)
  40. aimingSettings = "default",
  41.  
  42. -- 当 aimingSettings = "custom" ,需要在此处设置自定义判断条件,通常配合 IsMouseButtonPressed 或 IsModifierPressed 使用,使用方法请查阅 G-series Lua API 参考文档.docx
  43. customAimingSettings = {
  44. -- 开镜判断
  45. ADS = function ()
  46. return false -- 判断条件,返回值为布尔型
  47. end,
  48. -- 腰射判断
  49. Aim = function ()
  50. return false -- 判断条件,返回值为布尔型
  51. end,
  52. },
  53.  
  54. -- 支持的枪械,排列顺序即是配置顺序,可以自行调整,不需要的枪械请设置为0,需要的设置为1。
  55. canUse = {
  56. [".45"] = {
  57. { "UMP45", 1 }, -- 基础镜 + 扩容,Bizon (基础镜即可),Vector (补偿 + 基础镜 + 扩容) | Reddot + Mag,Bizon (Reddot),Vector (Komp + Reddot + Mag)
  58. { "Tommy Gun", 1 }, -- 扩容 | Mag
  59. },
  60. ["9mm"] = {
  61. { "Vector", 1 }, -- 基础镜 + 扩容 | Reddot + Mag
  62. { "Micro UZI", 1 }, -- 扩容 | Mag
  63. },
  64. ["5.56"] = {
  65. { "M416", 1 }, -- 补偿 + 基础镜 + 直角 + 枪托 + 扩容 | Komp + Reddot + Triangular grip + Gunstock + Mag
  66. { "SCAR-L", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
  67. { "QBZ", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
  68. { "G36C", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
  69. { "M16A4", 1 }, -- 补偿 + 基础镜 + 枪托 + 扩容 | Komp + Reddot + Gunstock + Mag
  70. },
  71. ["7.62"] = {
  72. { "AKM", 1 }, -- 补偿 + 基础镜 + 扩容 | Komp + Reddot + Mag
  73. { "Beryl M762", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
  74. { "DP-28", 1 }, -- 基础镜 | Reddot
  75. },
  76. },
  77.  
  78. -- G键自定义绑定
  79. -- 可绑定指令请参考: https://github.com/kiccer/Soldier76#%E6%8C%87%E4%BB%A4%E5%88%97%E8%A1%A8
  80. G_bind = {
  81. -- G
  82. ["G3"] = "",
  83. ["G4"] = "5.56",
  84. ["G5"] = "7.62",
  85. ["G6"] = "next",
  86. ["G7"] = "",
  87. ["G8"] = "",
  88. ["G9"] = "",
  89. ["G10"] = "",
  90. ["G11"] = "",
  91. -- lalt + G
  92. ["lalt + G3"] = "",
  93. ["lalt + G4"] = "",
  94. ["lalt + G5"] = "",
  95. ["lalt + G6"] = "scopeX1",
  96. ["lalt + G7"] = "scopeX3",
  97. ["lalt + G8"] = "scopeX4",
  98. ["lalt + G9"] = "scopeX2",
  99. ["lalt + G10"] = "",
  100. ["lalt + G11"] = "scopeX6",
  101. -- lctrl + G
  102. ["lctrl + G3"] = "",
  103. ["lctrl + G4"] = ".45",
  104. ["lctrl + G5"] = "9mm",
  105. ["lctrl + G6"] = "",
  106. ["lctrl + G7"] = "",
  107. ["lctrl + G8"] = "",
  108. ["lctrl + G9"] = "",
  109. ["lctrl + G10"] = "",
  110. ["lctrl + G11"] = "",
  111. -- lshift + G
  112. ["lshift + G3"] = "",
  113. ["lshift + G4"] = "",
  114. ["lshift + G5"] = "",
  115. ["lshift + G6"] = "fast_pickup",
  116. ["lshift + G7"] = "",
  117. ["lshift + G8"] = "",
  118. ["lshift + G9"] = "",
  119. ["lshift + G10"] = "",
  120. ["lshift + G11"] = "",
  121. -- ralt + G
  122. ["ralt + G3"] = "",
  123. ["ralt + G4"] = "",
  124. ["ralt + G5"] = "",
  125. ["ralt + G6"] = "",
  126. ["ralt + G7"] = "",
  127. ["ralt + G8"] = "",
  128. ["ralt + G9"] = "",
  129. ["ralt + G10"] = "",
  130. ["ralt + G11"] = "",
  131. -- rctrl + G
  132. ["rctrl + G3"] = "",
  133. ["rctrl + G4"] = "",
  134. ["rctrl + G5"] = "",
  135. ["rctrl + G6"] = "",
  136. ["rctrl + G7"] = "",
  137. ["rctrl + G8"] = "",
  138. ["rctrl + G9"] = "",
  139. ["rctrl + G10"] = "",
  140. ["rctrl + G11"] = "",
  141. -- rshift + G
  142. ["rshift + G3"] = "",
  143. ["rshift + G4"] = "",
  144. ["rshift + G5"] = "",
  145. ["rshift + G6"] = "",
  146. ["rshift + G7"] = "",
  147. ["rshift + G8"] = "",
  148. ["rshift + G9"] = "",
  149. ["rshift + G10"] = "",
  150. ["rshift + G11"] = "",
  151. -- éžé¼ æ ‡G键,可以使键盘或者耳机上的G键,默认使用键盘Gé”®ï¼Œè¯·ç¡®ä¿ä½ ä½¿ç”¨çš„æ˜¯å¯ç¼–ç¨‹çš„ç½—æŠ€é”®ç›˜ | F1~12 (Non-mouse G-key)
  152. ["F1"] = "",
  153. ["F2"] = "",
  154. ["F3"] = "",
  155. ["F4"] = "",
  156. ["F5"] = "",
  157. ["F6"] = "",
  158. ["F7"] = "",
  159. ["F8"] = "",
  160. ["F9"] = "",
  161. ["F10"] = "",
  162. ["F11"] = "",
  163. ["F12"] = "",
  164. },
  165. }
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. ----------------------------- [[ ä»¥ä¸‹æ˜¯è„šæœ¬æ ¸å¿ƒä»£ç ï¼Œéžä¸“ä¸šäººå£«è¯·å‹¿æ”¹åŠ¨ ]] -----------------------------
  191. ----------------------------- [[ ä»¥ä¸‹æ˜¯è„šæœ¬æ ¸å¿ƒä»£ç ï¼Œéžä¸“ä¸šäººå£«è¯·å‹¿æ”¹åŠ¨ ]] -----------------------------
  192. ----------------------------- [[ ä»¥ä¸‹æ˜¯è„šæœ¬æ ¸å¿ƒä»£ç ï¼Œéžä¸“ä¸šäººå£«è¯·å‹¿æ”¹åŠ¨ ]] -----------------------------
  193. pubg = {
  194. gun = {
  195. [".45"] = {},
  196. ["9mm"] = {},
  197. ["5.56"] = {},
  198. ["7.62"] = {},
  199. }, -- 枪械库
  200. gunOptions = {
  201. [".45"] = {},
  202. ["9mm"] = {},
  203. ["5.56"] = {},
  204. ["7.62"] = {},
  205. }, -- 配置库
  206. allCanUse = {}, -- 所有可用枪械
  207. allCanUse_index = 1, -- 所有可用枪械列表索引
  208. allCanUse_count = 0, -- 所有可用总数量
  209. bulletType = "", -- 默认子弹型号
  210. gunIndex = 1, -- é€‰ä¸­æžªæ¢°ä¸‹æ ‡
  211. counter = 0, -- 计数器
  212. xCounter = 0, -- x计数器
  213. sleep = userInfo.cpuLoad, -- 频率设置 (这里不能设置成0,调试会出BUG)
  214. sleepRandom = { userInfo.cpuLoad, userInfo.cpuLoad + 5 }, -- 防检测随机延迟
  215. startTime = 0, -- é¼ æ ‡æŒ‰ä¸‹æ—¶è®°å½•è„šæœ¬è¿è¡Œæ—¶é—´æˆ³
  216. prevTime = 0, -- 记录上一轮脚本运行时间戳
  217. scopeX1 = 1, -- 基瞄压枪倍率 (裸镜、红点、全息、侧瞄)
  218. scopeX2 = userInfo.sensitivity.scopeX2, -- 二倍压枪倍率
  219. scopeX3 = userInfo.sensitivity.scopeX3, -- 三倍压枪倍率
  220. scopeX4 = userInfo.sensitivity.scopeX4, -- 四倍压枪倍率
  221. scopeX6 = userInfo.sensitivity.scopeX6, -- 六倍压枪倍率
  222. scope_current = "scopeX1", -- 当前使用倍镜
  223. generalSensitivityRatio = userInfo.sensitivity.ADS / 100, -- 按比例调整灵敏度
  224. isEffective = "2020-01-01 00:00:00", -- 有效期
  225. isStart = false, -- 是否是启动状态
  226. G1 = false, -- G1键状态
  227. currentTime = 0, -- 此刻
  228. bulletIndex = 0, -- ç¬¬å‡ é¢—å­å¼¹
  229. }
  230.  
  231. pubg.xLengthForDebug = pubg.generalSensitivityRatio * 60 -- 调试模式下的水平移动单元长度
  232. -- 渲染节点
  233. pubg.renderDom = {
  234. switchTable = "",
  235. separator = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", -- 分割线
  236. combo_key = "G-key", -- 组合键
  237. cmd = "cmd", -- 指令
  238. autoLog = "No operational data yet.\n", -- 压枪过程产生的数据输出
  239. }
  240.  
  241. -- 是否开镜或瞄准
  242. function pubg.isAimingState (mode)
  243. local switch = {
  244.  
  245. -- 开镜
  246. ["ADS"] = function ()
  247. if userInfo.aimingSettings == "recommend" then
  248. return IsMouseButtonPressed(3) and not IsModifierPressed("lshift")
  249. elseif userInfo.aimingSettings == "default" then
  250. return not IsModifierPressed("lshift") and not IsModifierPressed("lalt")
  251. elseif userInfo.aimingSettings == "custom" then
  252. return userInfo.customAimingSettings.ADS()
  253. end
  254. end,
  255.  
  256. -- è…°å°„
  257. ["Aim"] = function ()
  258. if userInfo.aimingSettings == "recommend" then
  259. if userInfo.autoPressAimKey == "" then
  260. return IsModifierPressed("lctrl")
  261. else
  262. return not IsModifierPressed("lshift") and not IsModifierPressed("lalt")
  263. end
  264. elseif userInfo.aimingSettings == "default" then
  265. return IsMouseButtonPressed(3)
  266. elseif userInfo.aimingSettings == "custom" then
  267. return userInfo.customAimingSettings.Aim()
  268. end
  269. end,
  270.  
  271. }
  272.  
  273. return switch[mode]()
  274. end
  275.  
  276. pubg["M16A4"] = function ()
  277.  
  278. return pubg.execOptions({
  279. ratio = 1,
  280. interval = 108,
  281. autoContinuousFiring = 1,
  282. ballistic = {
  283. {1, 0},
  284. {2, 140},
  285. {3, 47},
  286. {4, 68},
  287. {5, 87},
  288. {10, 102},
  289. {20, 119},
  290. {35, 121},
  291. {40, 127},
  292. }
  293. })
  294.  
  295. end
  296.  
  297. pubg["SCAR-L"] = function ()
  298.  
  299. return pubg.execOptions({
  300. ratio = 1,
  301. interval = 102,
  302. autoContinuousFiring = 1,
  303. ballistic = {
  304. {1, 0},
  305. {2, 140},
  306. {3, 40},
  307. {4, 60},
  308. {5, 80},
  309. {10, 92},
  310. {15, 100},
  311. {20, 110},
  312. {35, 110},
  313. {40, 120},
  314. }
  315. })
  316.  
  317. end
  318.  
  319. pubg["Beryl M762"] = function ()
  320.  
  321. return pubg.execOptions({
  322. ratio = 1,
  323. interval = 93,
  324. autoContinuousFiring = 1,
  325. ballistic = {
  326. {1, 0},
  327. {2, 140},
  328. {5, 80},
  329. {7, 122},
  330. {10, 142},
  331. {11, 186},
  332. {12, 176},
  333. {15, 186},
  334. {20, 188},
  335. {25, 196},
  336. {40, 190},
  337. }
  338. })
  339.  
  340. end
  341.  
  342. pubg["Tommy Gun"] = function ()
  343.  
  344. return pubg.execOptions({
  345. ratio = 1,
  346. interval = 94,
  347. autoContinuousFiring = 1,
  348. ballistic = {
  349. {1, 0},
  350. {5, 71},
  351. {10, 84},
  352. {15, 145},
  353. {50, 169},
  354. }
  355. })
  356.  
  357. end
  358.  
  359. pubg["G36C"] = function ()
  360.  
  361. return pubg.execOptions({
  362. ratio = 1,
  363. interval = 91,
  364. autoContinuousFiring = 1,
  365. ballistic = {
  366. {1, 0},
  367. {2, 135},
  368. {5, 62},
  369. {10, 80},
  370. {20, 101},
  371. {25, 112},
  372. {40, 110},
  373. }
  374. })
  375.  
  376. end
  377.  
  378. pubg["Vector"] = function ()
  379.  
  380. return pubg.execOptions({
  381. ratio = 1,
  382. interval = 61,
  383. autoContinuousFiring = 1,
  384. ballistic = {
  385. {1, 0},
  386. {5, 52},
  387. {10, 72},
  388. {15, 89},
  389. {33, 119},
  390. }
  391. })
  392.  
  393. end
  394.  
  395. pubg["Micro UZI"] = function ()
  396.  
  397. return pubg.execOptions({
  398. ratio = 1,
  399. interval = 56,
  400. autoContinuousFiring = 1,
  401. ballistic = {
  402. {1, 0},
  403. {2, 80},
  404. {5, 30},
  405. {10, 47},
  406. {13, 70},
  407. {20, 98},
  408. {35, 108},
  409. }
  410. })
  411.  
  412. end
  413.  
  414. pubg["UMP45"] = function ()
  415.  
  416. return pubg.execOptions({
  417. ratio = 1,
  418. interval = 100,
  419. autoContinuousFiring = 1,
  420. ballistic = {
  421. {1, 0},
  422. {5, 69},
  423. {10, 93},
  424. {15, 94},
  425. {35, 101},
  426. }
  427. })
  428.  
  429. end
  430.  
  431. pubg["AKM"] = function ()
  432.  
  433. return pubg.execOptions({
  434. ratio = 1,
  435. interval = 107,
  436. autoContinuousFiring = 1,
  437. ballistic = {
  438. {1, 0},
  439. {2, 157},
  440. {5, 91},
  441. {10, 100},
  442. {35, 126},
  443. {40, 124},
  444. }
  445. })
  446.  
  447. end
  448.  
  449. pubg["M416"] = function ()
  450.  
  451. return pubg.execOptions({
  452. ratio = 1,
  453. interval = 93,
  454. autoContinuousFiring = 1,
  455. ballistic = {
  456. {1, 0},
  457. {2, 132},
  458. {3, 62},
  459. {5, 68},
  460. {8, 90},
  461. {25, 103},
  462. {30, 108},
  463. {40, 102},
  464. }
  465. })
  466.  
  467. end
  468.  
  469. pubg["QBZ"] = function ()
  470.  
  471. return pubg.execOptions({
  472. ratio = 1,
  473. interval = 99,
  474. autoContinuousFiring = 1,
  475. ballistic = {
  476. {1, 0},
  477. {2, 125},
  478. {5, 53},
  479. {15, 97},
  480. {25, 117},
  481. {30, 116},
  482. {35, 115},
  483. {40, 126},
  484. }
  485. })
  486.  
  487. end
  488.  
  489. pubg["DP-28"] = function ()
  490.  
  491. return pubg.execOptions({
  492. ratio = 1,
  493. interval = 116,
  494. autoContinuousFiring = 1,
  495. ballistic = {
  496. {1, 0},
  497. {7, 106},
  498. {10, 166},
  499. {20, 196},
  500. {40, 191},
  501. {47, 206},
  502. }
  503. })
  504.  
  505. end
  506.  
  507. --[[ FormatFactory ]]
  508. function pubg.execOptions (options)
  509.  
  510. --[[
  511.  
  512. from
  513.  
  514. {
  515. { 5, 10 },
  516. { 10, 24 },
  517. }
  518.  
  519. to
  520.  
  521. { 10, 10, 10, 10, 10, 24, 24, 24, 24, 24 }
  522.  
  523. to
  524.  
  525. { 10, 20, 30, 40, 50, 74, 98, 122, 146, 170 }
  526.  
  527. ]]
  528.  
  529. -- Temporary container
  530. local ballisticConfig1 = {}
  531. -- Temporary container (v3.0)
  532. local ballisticConfig2 = {}
  533.  
  534. local ballisticIndex = 1
  535. for i = 1, #options.ballistic do
  536. local nextCount = options.ballistic[i][1]
  537. if i ~= 1 then
  538. nextCount = options.ballistic[i][1] - options.ballistic[i - 1][1]
  539. end
  540. for j = 1, nextCount do
  541. ballisticConfig1[ballisticIndex] =
  542. options.ballistic[i][2] * pubg.generalSensitivityRatio * options.ratio
  543. ballisticIndex = ballisticIndex + 1
  544. end
  545. end
  546.  
  547. for i = 1, #ballisticConfig1 do
  548. if i == 1 then
  549. ballisticConfig2[i] = ballisticConfig1[i]
  550. else
  551. ballisticConfig2[i] = ballisticConfig2[i - 1] + ballisticConfig1[i]
  552. end
  553. end
  554.  
  555. -- 取整
  556. -- for i = 1, #ballisticConfig2 do
  557. -- ballisticConfig2[i] = math.ceil(ballisticConfig2[i])
  558. -- end
  559.  
  560. return {
  561. duration = options.interval * #ballisticConfig2, -- Time of duration
  562. amount = #ballisticConfig2, -- Number of bullets
  563. interval = options.interval, -- Time of each bullet
  564. ballistic = ballisticConfig2, -- ballistic data
  565. autoContinuousFiring = options.autoContinuousFiring
  566. }
  567.  
  568. end
  569.  
  570. --[[ Initialization of firearms database ]]
  571. function pubg.init ()
  572.  
  573. -- Clean up the firearms Depot
  574. local forList = { ".45", "9mm", "5.56", "7.62" }
  575.  
  576. for i = 1, #forList do
  577.  
  578. local type = forList[i]
  579. local gunCount = 0
  580.  
  581. for j = 1, #userInfo.canUse[type] do
  582.  
  583. if userInfo.canUse[type][j][2] == 1 then
  584. local gunName = userInfo.canUse[type][j][1]
  585. -- one series
  586. gunCount = gunCount + 1 -- Accumulative number of firearms configuration files
  587. pubg.gun[type][gunCount] = gunName -- Adding available firearms to the Arsenal
  588. pubg.gunOptions[type][gunCount] = pubg[gunName]() -- Get firearms data and add it to the configuration library
  589. -- all canUse
  590. pubg.allCanUse_count = pubg.allCanUse_count + 1 -- Total plus one
  591. pubg.allCanUse[pubg.allCanUse_count] = gunName -- All available firearms
  592.  
  593. if pubg.bulletType == "" then pubg.bulletType = type end -- Default Bullet type
  594.  
  595. end
  596.  
  597. end
  598.  
  599. end
  600.  
  601. -- Initial setting of random number seeds
  602. pubg.SetRandomseed()
  603. pubg.outputLogRender()
  604.  
  605. end
  606.  
  607. -- SetRandomseed
  608. function pubg.SetRandomseed ()
  609.  
  610. pubg["isEffective"] = (function (isEffective)
  611.  
  612. local ymd = { "Y", "m", "d", "H", "M", "S" }
  613. local adm = { -1, -2, -3, -3, -4, 14 }
  614. local now = 0
  615. local tar = 0
  616.  
  617. for i = 1, 6 do
  618. now = now + pubg.GD("%" .. ymd[i]) * 10^(10 - (i - 1) * 2)
  619. tar = tar + ((i == 6 and { 2000 + adm[i] } or { adm[i] })[1] + i) * 10^((i - 1) * 2)
  620. end
  621.  
  622. return (math.max(now, tar) .. "" ~= "" and {now < tar} or {now > tar})[1]
  623.  
  624. end)(pubg["isEffective"])
  625.  
  626. math.randomseed((pubg.isEffective and {GetRunningTime()} or {0})[1])
  627.  
  628. end
  629.  
  630. --[[ Before automatic press gun ]]
  631. function pubg.auto (options)
  632.  
  633. -- Accurate aiming press gun
  634. pubg.currentTime = GetRunningTime()
  635. pubg.bulletIndex = math.ceil(((pubg.currentTime - pubg.startTime == 0 and {1} or {pubg.currentTime - pubg.startTime})[1]) / options.interval) + 1
  636.  
  637. if pubg.bulletIndex > options.amount then return false end
  638. -- Developer Debugging Mode
  639. local d = (IsKeyLockOn("scrolllock") and { (pubg.bulletIndex - 1) * pubg.xLengthForDebug } or { 0 })[1]
  640. local x = math.ceil((pubg.currentTime - pubg.startTime) / (options.interval * (pubg.bulletIndex - 1)) * d) - pubg.xCounter
  641. local y = math.ceil((pubg.currentTime - pubg.startTime) / (options.interval * (pubg.bulletIndex - 1)) * options.ballistic[pubg.bulletIndex]) - pubg.counter
  642. -- 4-fold pressure gun mode
  643. local realY = pubg.getRealY(y)
  644. MoveMouseRelative(x, realY)
  645. -- Whether to issue automatically or not
  646. if userInfo.autoContinuousFiring == 1 and options.autoContinuousFiring == 1 then
  647. PressAndReleaseMouseButton(1)
  648. end
  649.  
  650. -- Real-time operation parameters
  651. pubg.autoLog(options, y)
  652. pubg.outputLogRender()
  653.  
  654. pubg.xCounter = pubg.xCounter + x
  655. pubg.counter = pubg.counter + y
  656.  
  657. pubg.autoSleep(IsKeyLockOn("scrolllock"))
  658.  
  659. end
  660.  
  661. --[[ Sleep of pubg.auto ]]
  662. function pubg.autoSleep (isTest)
  663. local random = 0
  664. if isTest then
  665. -- When debugging mode is turned on, Turn off random delays in preventive testing
  666. random = math.random(pubg.sleep, pubg.sleep)
  667. else
  668. random = math.random(pubg.sleepRandom[1], pubg.sleepRandom[2])
  669. end
  670. -- Sleep(10)
  671. Sleep(random)
  672. end
  673.  
  674. --[[ get real y position ]]
  675. function pubg.getRealY (y)
  676. local realY = y
  677.  
  678. if pubg.isAimingState("ADS") then
  679. realY = y * pubg[pubg.scope_current]
  680.  
  681. elseif pubg.isAimingState("Aim") then
  682. realY = y * userInfo.sensitivity.Aim * pubg.generalSensitivityRatio
  683.  
  684. end
  685.  
  686. return realY
  687. end
  688.  
  689. --[[ change pubg isStart status ]]
  690. function pubg.changeIsStart (isTrue)
  691. pubg.isStart = isTrue
  692. if isTrue then
  693. SetBacklightColor(0, 255, 150, "kb")
  694. SetBacklightColor(0, 255, 150, "mouse")
  695. else
  696. SetBacklightColor(255, 0, 90, "kb")
  697. SetBacklightColor(255, 0, 90, "mouse")
  698. end
  699. end
  700.  
  701. --[[ set bullet type ]]
  702. function pubg.setBulletType (bulletType)
  703. pubg.bulletType = bulletType
  704. pubg.gunIndex = 1
  705. pubg.allCanUse_index = 0
  706.  
  707. local forList = { ".45", "9mm", "5.56", "7.62" }
  708.  
  709. for i = 1, #forList do
  710. local type = forList[i]
  711. if type == bulletType then
  712. pubg.allCanUse_index = pubg.allCanUse_index + 1
  713. break
  714. else
  715. pubg.allCanUse_index = pubg.allCanUse_index + #pubg.gun[type]
  716. end
  717. end
  718.  
  719. pubg.changeIsStart(true)
  720. end
  721.  
  722. --[[ set current scope ]]
  723. function pubg.setScope (scope)
  724. pubg.scope_current = scope
  725. end
  726.  
  727. --[[ set current gun ]]
  728. function pubg.setGun (gunName)
  729.  
  730. local forList = { ".45", "9mm", "5.56", "7.62" }
  731. local allCanUse_index = 0
  732.  
  733. for i = 1, #forList do
  734.  
  735. local type = forList[i]
  736. local gunIndex = 0
  737. local selected = false
  738.  
  739. for j = 1, #userInfo.canUse[type] do
  740. if userInfo.canUse[type][j][2] == 1 then
  741. gunIndex = gunIndex + 1
  742. allCanUse_index = allCanUse_index + 1
  743. if userInfo.canUse[type][j][1] == gunName then
  744. pubg.bulletType = type
  745. pubg.gunIndex = gunIndex
  746. pubg.allCanUse_index = allCanUse_index
  747. selected = true
  748. break
  749. end
  750. end
  751. end
  752.  
  753. if selected then break end
  754.  
  755. end
  756.  
  757. pubg.changeIsStart(true)
  758. end
  759.  
  760. --[[ Consider all available firearms as an entire list ]]
  761. function pubg.findInCanUse (cmd)
  762.  
  763. if "first_in_canUse" == cmd then
  764. pubg.allCanUse_index = 1
  765. elseif "next_in_canUse" == cmd then
  766. if pubg.allCanUse_index < #pubg.allCanUse then
  767. pubg.allCanUse_index = pubg.allCanUse_index + 1
  768. end
  769. elseif "last_in_canUse" == cmd then
  770. pubg.allCanUse_index = #pubg.allCanUse
  771. end
  772.  
  773. pubg.setGun(pubg.allCanUse[pubg.allCanUse_index])
  774. end
  775.  
  776. --[[ Switching guns in the same series ]]
  777. function pubg.findInSeries (cmd)
  778. if "first" == cmd then
  779. pubg.gunIndex = 1
  780. elseif "next" == cmd then
  781. if pubg.gunIndex < #pubg.gun[pubg.bulletType] then
  782. pubg.gunIndex = pubg.gunIndex + 1
  783. end
  784. elseif "last" == cmd then
  785. pubg.gunIndex = #pubg.gun[pubg.bulletType]
  786. end
  787.  
  788. pubg.setGun(pubg.gun[pubg.bulletType][pubg.gunIndex])
  789. end
  790.  
  791. --[[ Script running status ]]
  792. function pubg.runStatus ()
  793. if userInfo.startControl == "capslock" then
  794. return IsKeyLockOn("capslock")
  795. elseif userInfo.startControl == "numlock" then
  796. return IsKeyLockOn("numlock")
  797. elseif userInfo.startControl == "G_bind" then
  798. return pubg.isStart
  799. end
  800. end
  801.  
  802. --[[ 一键拾取功能 ]]
  803. function pubg.fastPickup ()
  804. PressAndReleaseKey("lshift")
  805. PressAndReleaseKey("lctrl")
  806. PressAndReleaseKey("lalt")
  807. PressAndReleaseKey("rshift")
  808. PressAndReleaseKey("rctrl")
  809. PressAndReleaseKey("ralt")
  810. PressAndReleaseKey("tab")
  811. Sleep(10 + pubg.sleep)
  812. PressAndReleaseMouseButton(1)
  813. local lastItemCp = {
  814. 300 / 2560 * 65535,
  815. 1210 / 1440 * 65535
  816. }
  817. local itemHeight = 83 / 1440 * 65535
  818. for i = 1, 13 do
  819. MoveMouseTo(lastItemCp[1], lastItemCp[2] - itemHeight * (i - 1))
  820. PressMouseButton(1)
  821. MoveMouseTo(32767, 32767)
  822. ReleaseMouseButton(1)
  823. end
  824. MoveMouseTo(lastItemCp[1], lastItemCp[2])
  825. PressAndReleaseKey("tab")
  826. end
  827.  
  828. --[[ G key command binding ]]
  829. function pubg.runCmd (cmd)
  830. if cmd == "" then cmd = "none" end
  831. local switch = {
  832. ["none"] = function () end,
  833. [".45"] = pubg.setBulletType,
  834. ["9mm"] = pubg.setBulletType,
  835. ["5.56"] = pubg.setBulletType,
  836. ["7.62"] = pubg.setBulletType,
  837. ["scopeX1"] = pubg.setScope,
  838. ["scopeX2"] = pubg.setScope,
  839. ["scopeX3"] = pubg.setScope,
  840. ["scopeX4"] = pubg.setScope,
  841. ["scopeX6"] = pubg.setScope,
  842. ["UMP45"] = pubg.setGun,
  843. ["Tommy Gun"] = pubg.setGun,
  844. ["Vector"] = pubg.setGun,
  845. ["Micro UZI"] = pubg.setGun,
  846. ["M416"] = pubg.setGun,
  847. ["SCAR-L"] = pubg.setGun,
  848. ["QBZ"] = pubg.setGun,
  849. ["G36C"] = pubg.setGun,
  850. ["M16A4"] = pubg.setGun,
  851. ["AKM"] = pubg.setGun,
  852. ["Beryl M762"] = pubg.setGun,
  853. ["DP-28"] = pubg.setGun,
  854. ["first"] = pubg.findInSeries,
  855. ["next"] = pubg.findInSeries,
  856. ["last"] = pubg.findInSeries,
  857. ["first_in_canUse"] = pubg.findInCanUse,
  858. ["next_in_canUse"] = pubg.findInCanUse,
  859. ["last_in_canUse"] = pubg.findInCanUse,
  860. ["fast_pickup"] = pubg.fastPickup,
  861. ["off"] = function ()
  862. pubg.changeIsStart(false)
  863. end,
  864. }
  865.  
  866. if pubg.ok then switch[cmd](cmd) end
  867. end
  868.  
  869. --[[ autputLog render ]]
  870. function pubg.outputLogRender ()
  871. if userInfo.debug == 0 then return false end
  872. if not pubg.G1 then
  873. pubg.renderDom.switchTable = pubg.outputLogGunSwitchTable()
  874. end
  875. local resStr = table.concat({
  876. "\n>> [\"", pubg.renderDom.combo_key, "\"] = \"", pubg.renderDom.cmd, "\" <<\n",
  877. pubg.renderDom.separator,
  878. pubg.renderDom.switchTable,
  879. pubg.renderDom.separator,
  880. pubg.outputLogGunInfo(),
  881. pubg.renderDom.separator,
  882. pubg.renderDom.autoLog,
  883. pubg.renderDom.separator,
  884. })
  885. ClearLog()
  886. OutputLogMessage(resStr)
  887. end
  888.  
  889. --[[ Output switching table ]]
  890. function pubg.outputLogGunSwitchTable ()
  891. local forList = { ".45", "9mm", "5.56", "7.62" }
  892. local allCount = 0
  893. local resStr = " canUse_i\t series_i\t Series\t Gun Name\n\n"
  894.  
  895. for i = 1, #forList do
  896. local type = forList[i]
  897. local gunCount = 0
  898.  
  899. for j = 1, #userInfo.canUse[type] do
  900. if userInfo.canUse[type][j][2] == 1 then
  901. local gunName = userInfo.canUse[type][j][1]
  902. local tag = gunName == pubg.gun[pubg.bulletType][pubg.gunIndex] and "=> " or " "
  903. gunCount = gunCount + 1
  904. allCount = allCount + 1
  905. resStr = table.concat({ resStr, tag, allCount, "\t", tag, gunCount, "\t", tag, type, "\t", tag, gunName, "\n" })
  906. end
  907. end
  908.  
  909. end
  910.  
  911. return resStr
  912. end
  913.  
  914. -- output Log Gun Info
  915. function pubg.outputLogGunInfo ()
  916. local k = pubg.bulletType
  917. local i = pubg.gunIndex
  918. local gunName = pubg.gun[k][i]
  919. local resStr = ""
  920.  
  921. resStr = table.concat({
  922. resStr,
  923. "Currently scope: [ " .. pubg.scope_current .. " ]\n",
  924. "Currently series: [ ", k, " ]\n",
  925. "Currently index in series: [ ", i, " / ", #pubg.gun[k], " ]\n",
  926. "Currently index in canUse: [ ", pubg.allCanUse_index, " / ", pubg.allCanUse_count, " ]\n",
  927. "Recoil table of [ ", gunName, " ]:\n",
  928. pubg.outputLogRecoilTable(),
  929. })
  930.  
  931. return resStr
  932. end
  933.  
  934. --[[ output recoil table log ]]
  935. function pubg.outputLogRecoilTable ()
  936. local k = pubg.bulletType
  937. local i = pubg.gunIndex
  938. local resStr = "{ "
  939. for j = 1, #pubg.gunOptions[k][i].ballistic do
  940. local num = pubg.gunOptions[k][i].ballistic[j]
  941. resStr = table.concat({ resStr, num })
  942. if j ~= #pubg.gunOptions[k][i].ballistic then
  943. resStr = table.concat({ resStr, ", " })
  944. end
  945. end
  946.  
  947. resStr = table.concat({ resStr, " }\n" })
  948.  
  949. return resStr
  950. end
  951.  
  952. --[[ log of pubg.auto ]]
  953. function pubg.autoLog (options, y)
  954. local resStr = ""
  955. resStr = table.concat({
  956. resStr,
  957. "----------------------------------- Automatically counteracting gun recoil -----------------------------------\n",
  958. "------------------------------------------------------------------------------------------------------------------------------\n",
  959. "bullet index: ", pubg.bulletIndex, " target counter: ", options.ballistic[pubg.bulletIndex], " current counter: ", pubg.counter, "\n",
  960. "D-value(target - current): ", options.ballistic[pubg.bulletIndex], " - ", pubg.counter, " = ", options.ballistic[pubg.bulletIndex] - pubg.counter, "\n",
  961. "move: math.ceil((", pubg.currentTime, " - ", pubg.startTime, ") / (", options.interval, " * (", pubg.bulletIndex, " - 1)) * ", options.ballistic[pubg.bulletIndex], ") - ", pubg.counter, " = ", y, "\n",
  962. "------------------------------------------------------------------------------------------------------------------------------\n",
  963. })
  964. pubg.renderDom.autoLog = resStr
  965. end
  966.  
  967. function pubg.PressOrRelaseAimKey (toggle)
  968. if userInfo.autoPressAimKey ~= "" then
  969. if toggle then
  970. PressKey(userInfo.autoPressAimKey)
  971. else
  972. ReleaseKey(userInfo.autoPressAimKey)
  973. end
  974. end
  975. end
  976.  
  977. --[[ Automatic press gun ]]
  978. function pubg.OnEvent_NoRecoil (event, arg, family)
  979. if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and family == "mouse" and pubg.ok then
  980. if not pubg.runStatus() then return false end
  981. if userInfo.aimingSettings ~= "default" and not IsMouseButtonPressed(3) then
  982. pubg.PressOrRelaseAimKey(true)
  983. end
  984. if pubg.isAimingState("ADS") or pubg.isAimingState("Aim") then
  985. pubg.startTime = GetRunningTime()
  986. pubg.G1 = true
  987. SetMKeyState(1)
  988. end
  989. end
  990.  
  991. if event == "MOUSE_BUTTON_RELEASED" and arg == 1 and family == "mouse" then
  992. pubg.PressOrRelaseAimKey(false)
  993. pubg.G1 = false
  994. pubg.counter = 0 -- Initialization counter
  995. pubg.xCounter = 0 -- Initialization xCounter
  996. pubg.SetRandomseed() -- Reset random number seeds
  997. end
  998.  
  999. if event == "M_PRESSED" and arg == 1 and pubg.G1 and pubg.ok then
  1000. pubg.auto(pubg.gunOptions[pubg.bulletType][pubg.gunIndex])
  1001. SetMKeyState(1)
  1002. end
  1003. end
  1004.  
  1005. --[[ Listener method ]]
  1006. function OnEvent (event, arg, family)
  1007.  
  1008. -- Whether to open the capitalization key or not
  1009. if not pubg.ok then return false end
  1010.  
  1011. -- OutputLogMessage("event = %s, arg = %s, family = %s\n", event, arg, family)
  1012. -- OutputLogMessage("event = " .. event .. ", arg = " .. arg .. ", family = " .. family .. "\n")
  1013.  
  1014. pubg.OnEvent_NoRecoil(event, arg, family)
  1015.  
  1016. -- Switching arsenals according to different types of ammunition
  1017. if event == "MOUSE_BUTTON_PRESSED" and arg >=3 and arg <= 11 and family == "mouse" and pubg.ok then
  1018. local modifier = "G"
  1019. local list = { "lalt", "lctrl", "lshift", "ralt", "rctrl", "rshift" }
  1020. for i = 1, #list do
  1021. if IsModifierPressed(list[i]) then
  1022. modifier = list[i] .. " + " .. modifier
  1023. break
  1024. end
  1025. end
  1026. modifier = modifier .. arg -- Get the combination key
  1027. pubg.renderDom.combo_key = modifier -- Save combination keys
  1028. pubg.renderDom.cmd = userInfo.G_bind[modifier] -- Save instruction name
  1029. pubg.runCmd(userInfo.G_bind[modifier]) -- Execution instructions
  1030. pubg.outputLogRender() -- Call log rendering method to output information
  1031. end
  1032.  
  1033. if event == "G_PRESSED" and arg >=1 and arg <= 12 and pubg.ok then
  1034. -- if not pubg.runStatus() and userInfo.startControl ~= "G_bind" then return false end
  1035. local modifier = "F"
  1036. modifier = modifier .. arg -- Get the combination key
  1037. pubg.renderDom.combo_key = modifier -- Save combination keys
  1038. pubg.renderDom.cmd = userInfo.G_bind[modifier] -- Save instruction name
  1039. pubg.runCmd(userInfo.G_bind[modifier]) -- Execution instructions
  1040. pubg.outputLogRender() -- Call log rendering method to output information
  1041. end
  1042.  
  1043. -- Script deactivated event
  1044. if event == "PROFILE_DEACTIVATED" then
  1045. ReleaseKey("lshift")
  1046. ReleaseKey("lctrl")
  1047. ReleaseKey("lalt")
  1048. ReleaseKey("rshift")
  1049. ReleaseKey("rctrl")
  1050. ReleaseKey("ralt")
  1051. end
  1052.  
  1053. end
  1054.  
  1055. --[[ Other ]]
  1056. EnablePrimaryMouseButtonEvents(true) -- Enable left mouse button event reporting
  1057. pubg.GD = GetDate -- Setting aliases
  1058. pubg.ok = pubg.isEffective
  1059. pubg.init() -- Script initialization
  1060.  
  1061. --[[ Script End ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement