Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.36 KB | None | 0 0
  1. ---------------------------
  2. -- Configuration --
  3. ---------------------------
  4.  
  5. -- Containers --
  6. local Containers = {
  7. Cash = 'Blue Backpack', -- money backpack
  8. Items = 'Broacde Backpack' -- need implement
  9. }
  10.  
  11. -- Misc Options--
  12. local PartyhatTime = 1000 -- in ms
  13. local Ping = 100 -- set lagging in sent packet to server
  14. local TimetoKick = 25 -- time to kick from house
  15. local WarringTimes = 5 -- agresive action agnist you
  16.  
  17. local inviterfile_path = 'C:\\Users\\Midaz\\Documents\\XenoBot\\AutoInviter\\main'
  18.  
  19. -- Ban list --
  20. local Banned = { -- list banned players
  21. {name = 'Charlover', reason = 'no reason', time = os.time() + 99999},
  22. }
  23.  
  24. -- Cast Settings --
  25. local AutoCast = true
  26. local CastCommand = "!cast"
  27. local StopCastCommand = "!cast off"
  28.  
  29. -- Bet Config --
  30. local Bet = {
  31. Min = 5,
  32. Max = 50,
  33. Payout = 90 --%
  34. }
  35.  
  36. --- Positions ---
  37.  
  38. local GamblerSQM = {
  39. {32281, 31120, 7},
  40. {32282, 31120, 7},
  41. {32283, 31120, 7},
  42. {32281, 31121, 7},
  43. {32282, 31121, 7},
  44. {32283, 31121, 7},
  45. {32282, 31122, 7}
  46. }
  47.  
  48. local InviterSQM = { -- valid pos inviting player to house
  49. {32281, 31123, 7},
  50. {32282, 31123, 7},
  51. {32283, 31123, 7}
  52. }
  53.  
  54. local Location = {
  55. Dice = {32283, 31118, 7}, -- dice sqm position
  56. Counter = {32282, 31119, 7, id = 2326}, -- accept cash/items
  57. Yourself = {32282, 31118, 7}, -- my position
  58. PayoutCounter = {32283, 31119, 7, id = 2323} -- payout cash here
  59. }
  60.  
  61. local HouseUntrashSQM = {
  62. inRange = {
  63. {0, 0, 0, ids = {0}},
  64. },
  65. toFar = {
  66. {0, 0, 6, ids = {408}}
  67. }
  68.  
  69. }
  70.  
  71. -------------------------------------
  72. -- DO NOT TOUCH NOTHING BELOW --
  73. -------------------------------------
  74.  
  75.  
  76. local PacketIDs = {834, 2796, 2785, 2793, 6114, 2789, 2806, 17972, 6372, 2776, 831, 2804, 2797, 2805, 2802, 2811, 2808, 2801, 6371, 2803, 2791, 2783, 2800, 2778, 833, 2807, 2779, 832, 6115, 2794, 2792, 2799, 2798, 2784, 268}
  77. local Casino = {}
  78. local Invited = {}
  79. local Gambler = {}
  80. local Balance = {}
  81. local Interested = {}
  82. local time = os.clock()
  83. local Profit = 0
  84. local Warring = 0
  85.  
  86.  
  87. -- HUDS --
  88. -- Character Info --
  89. local HeadHUD = HUD.CreateTextDisplay(5, 55, "Rif's House Casino" , 41, 230, 239)
  90. local CharinfoHUD = HUD.CreateTextDisplay(5, 75, "Character Info" , 234, 244, 23)
  91. local HeadingHUD = HUD.CreateTextDisplay(5, 95, "Croupier:", 255, 255, 255)
  92. local HeadingNameHUD = HUD.CreateTextDisplay(70, 95, Self.Name() , 140, 255, 230)
  93. local latencyHUD = HUD.CreateTextDisplay(5, 115, "Latency:", 255, 255, 255)
  94. local latencyvalueHUD = HUD.CreateTextDisplay(69, 115, Self.Ping() .."", 0, 124, 249)
  95.  
  96. -- Bet Info --
  97. local CasinoInfoHUD = HUD.CreateTextDisplay(5, 165, "Bet Info" , 234, 244, 23)
  98. local PayHUD = HUD.CreateTextDisplay(5, 185, "Payout:", 255, 255, 255)
  99. local PayoutHUD = HUD.CreateTextDisplay(85, 185, Bet.Payout .."%" , 140, 255, 230)
  100. local MaxBetHUD = HUD.CreateTextDisplay(5, 205, "Max:", 255, 255, 255)
  101. local BetMaxHUD = HUD.CreateTextDisplay(86, 205, Bet.Max .."" , 140, 255, 230)
  102. local MinBetHUD = HUD.CreateTextDisplay(5, 225, "Min:", 255, 255, 255)
  103. local BetMinHUD = HUD.CreateTextDisplay(87, 225, Bet.Min .."" , 140, 255, 230)
  104. local BetPingHUD = HUD.CreateTextDisplay(5, 245, "Ping:", 255, 255, 255)
  105. local BetPingHUD = HUD.CreateTextDisplay(85, 245, Ping .."" ,140, 255, 230)
  106.  
  107.  
  108. -- General Info --
  109. local GeneralInfoHUD = HUD.CreateTextDisplay(5, 295, "General Info" , 234, 244, 23)
  110. local StatusHUD = HUD.CreateTextDisplay(5, 315, "Status:", 255, 255, 255)
  111. local StatusFalseHUD = HUD.CreateTextDisplay(65, 315, "", 255, 20, 10)
  112. local StatusTrueHUD = HUD.CreateTextDisplay(65, 315, "", 300, 255, 10)
  113. local BalanceHUD = HUD.CreateTextDisplay(5, 335, "Balance:", 255, 255, 255)
  114. local BalanceCashHUD = HUD.CreateTextDisplay(66, 335, "0", 140, 255, 230)
  115. local CustomerHUD = HUD.CreateTextDisplay(5, 355, "Players: 0", 255, 255, 255)
  116.  
  117.  
  118. print([[--/
  119. House Casino By Rif
  120. Version 1.2
  121. Currently Owner:
  122. Mihelox
  123. /--]])
  124.  
  125. -- FUNCTIONS --
  126.  
  127. function Self.GetIDFromPos(x, y, z)
  128. return (Map.GetTopUseItem(x, y, z).id or Map.GetTopMoveItem(x, y, z).id)
  129. end
  130.  
  131. local Configurations = {
  132. id = {
  133. Dice = Self.GetIDFromPos(Location.Dice[1], Location.Dice[2], Location.Dice[3]),
  134. Counter = Self.GetIDFromPos(Location.Counter[1], Location.Counter[2], Location.Counter[3]),
  135. Yourself = Self.GetIDFromPos(Location.Yourself[1], Location.Yourself[2], Location.Yourself[3]),
  136. PayoutCounter = Self.GetIDFromPos(Location.PayoutCounter[1], Location.PayoutCounter[2], Location.PayoutCounter[3]),
  137. }
  138. }
  139.  
  140. function Self.BanPlayer(name, time, reason)
  141. if name ~= nil and time ~= nil and reason ~= nil then
  142. if not table.exist(name, Banned) then
  143. if type(name) == 'string' then
  144. if tonumber(time) > 0 then
  145. table.insert(Banned, {name = name:lower(), reason = reason, time = (os.time() + (time*60))})
  146. Gambler.Remove()
  147. Self.Say('Banned ' .. name ..' for '.. reason ..'. Ban time ' ..(math.floor(((os.time() + (time*60)) - os.time())/60)+1) ..' min.')
  148. Warring = 0
  149. else
  150. print('Time need be a number.')
  151. end
  152. else
  153. print('Character name cannot be number!')
  154. end
  155. else
  156. print('This player was banned some time ago.')
  157. end
  158. else
  159. print("Miss some argument in function 'Self.BanPlayer()'")
  160. end
  161. end
  162.  
  163. function Self.UnbanPlayer(name)
  164. if table.exist(name, Banned) then
  165. table.remove(Banned, playerindex)
  166. Self.Say(name ..' is valid to enter my house!')
  167. else
  168. print('This player doesnt exist!')
  169. end
  170. end
  171.  
  172. function Self.InstalCasino()
  173. if AutoCast then
  174. print("Open Cast")
  175. Self.Say(CastCommand)
  176. else
  177. print('Loading...')
  178. end
  179. local cashBP = Container.New(Containers.Cash)
  180. local itemsBP = Container.New(Containers.Items)
  181. local bro = Container.New('Browse Field')
  182. while not bro:isOpen() do
  183. if Self.DistanceFromPosition(Location.Dice[1], Location.Dice[2], Location.Dice[3]) <= 1 then
  184. Self.BrowseField(Location.Dice[1], Location.Dice[2], Location.Dice[3])
  185. wait(500+Ping)
  186. bro = Container.New('Browse Field')
  187. else
  188. print('Error in Location.Dice, to far.')
  189. end
  190. if bro:isOpen() then
  191. break
  192. end
  193. end
  194. while not cashBP:isOpen() do
  195. local cashBpID = Item.GetID(Containers.Cash)
  196. for spot, item in bro:iItems() do
  197. if bro:CountItemsOfID(cashBpID) > 0 then
  198. if cashBpID == item.id then
  199. bro:UseItem(spot, true)
  200. wait(500+Ping)
  201. cashBP = Container.New(Containers.Cash)
  202. end
  203. else
  204. print('Cannot find ' ..Containers.Cash)
  205. end
  206. end
  207. if cashBP:isOpen() then
  208. break
  209. end
  210. end
  211. while cashBP:isOpen() do
  212. local cont = Container.GetFirst()
  213. if cont:CountItemsOfID(3043) <= 0 then
  214. print('No cash to start the game.')
  215. else
  216. if cont:isFull() then
  217. for spot, item in cont:iItems() do
  218. if Item.isContainer(item.id) then
  219. cont:UseItem(spot, true)
  220. wait(500+Ping)
  221. end
  222. end
  223. else
  224. print('Casino loaded successfully.')
  225. break
  226. end
  227. end
  228. end
  229. Self.SmartSay('Casino House | Min '.. Bet.Min ..' CC | Max '.. Bet.Max ..' CC | Payout '.. Bet.Payout ..'% | Bot&Cast ON! | AUTO INVITER ON |', 2, 5)
  230. end
  231.  
  232. function Self.AcceptCash()
  233. if Gambler.isExist() then
  234. local cont = Container.GetFirst()
  235. local vBasic = cont:CountItemsOfID(3043)
  236. local playerBalance = Gambler.Cash()
  237. if Map.GetTopUseItem(Location.Counter[1], Location.Counter[2], Location.Counter[3]).id == 3043 then
  238. inform = true
  239. if not cont:isFull() then
  240. Map.PickupItem(Location.Counter[1], Location.Counter[2], Location.Counter[3], Container.GetFirst():Index(), 19, 100)
  241. wait(300+Ping)
  242. player_cash = Gambler.Cash() + cont:CountItemsOfID(3043) - vBasic
  243. Gambler.InsertCash(player_cash)
  244. else
  245. for spot, newbp in Container.GetFirst():iItems() do
  246. if Item.isContainer(newbp.id) then
  247. Container.GetFirst():UseItem(spot, true)
  248. wait(300+Ping)
  249. end
  250. end
  251. end
  252. end
  253. if Map.GetTopUseItem(Location.Counter[1], Location.Counter[2], Location.Counter[3]).id ~= 3043 then
  254. if inform then
  255. inform = nil
  256. if playerBalance ~= Gambler.Cash() then
  257. Self.SmartSay('Balance '..Gambler.Cash(), 0, 10)
  258. end
  259. end
  260. end
  261. end
  262. end
  263.  
  264. function Self.PayoutCash(toPay)
  265. local toPayout = toPay
  266. local vBasic0 = toPay
  267. while toPay >= 1 do
  268. local cont = Container.GetFirst()
  269. if cont:CountItemsOfID(3043) >= 1 then
  270. for spot, item in cont:iItems() do
  271. local spot = 0
  272. if item.id == 3043 then
  273. local vBasic = cont:CountItemsOfID(3043)
  274. if toPay < 1 then
  275. break
  276. end
  277. cont:MoveItemToGround(spot, Location.PayoutCounter[1], Location.PayoutCounter[2], Location.PayoutCounter[3], toPay)
  278. wait(500+Ping)
  279. toPay = vBasic0 -(vBasic-cont:CountItemsOfID(3043))
  280. vBasic0 = vBasic0 - (vBasic-cont:CountItemsOfID(3043))
  281. Gambler.InsertCash(toPay)
  282. end
  283. end
  284. else
  285. cont:GoBack()
  286. wait(300+Ping)
  287. end
  288. end
  289. if (toPay < 1) then
  290. Self.SmartSay('Payoff '..toPayout, 0, 1.2)
  291. time = os.clock()
  292. end
  293. end
  294.  
  295. function Self.BetCheck()
  296. if process_low or process_high then
  297. if player_bet < Bet.Min then
  298. process_high, process_low, player_bet = nil, nil, 0
  299. Self.SmartSay('Minimium '.. Bet.Min, 0, 2)
  300. elseif player_bet > Bet.Max then
  301. if Gambler.Cash() >= Bet.Max then
  302. player_bet = Bet.Max
  303. Roll = true
  304. else
  305. if Gambler.Cash() >= Bet.Min then
  306. player_bet = Gambler.Cash()
  307. Roll = true
  308. else
  309. process_high, process_low, player_bet = nil, nil, 0
  310. Self.SmartSay('Minimium '.. Bet.Min, 0, 2)
  311. end
  312. end
  313. elseif player_bet >= Bet.Min and player_bet <= Bet.Max then
  314. if Gambler.Cash() >= player_bet then
  315. Roll = true
  316. else
  317. if Gambler.Cash() >= Bet.Min and Gambler.Cash() <= Bet.Max then
  318. player_bet = Gambler.Cash()
  319. Roll = true
  320. else
  321. process_high, process_low, player_bet = nil, nil, 0
  322. Self.SmartSay('Minimium '.. Bet.Min, 0, 2)
  323. end
  324. end
  325. end
  326. end
  327. end
  328.  
  329. function Self.UntrashLocations()
  330. local mapDice = Map.GetTopUseItem(Location.Dice[1], Location.Dice[2], Location.Dice[3]).id
  331. local mapPayoutCounter = Map.GetTopUseItem(Location.PayoutCounter[1], Location.PayoutCounter[2], Location.PayoutCounter[3]).id
  332. local mapCounter = Map.GetTopUseItem(Location.Counter[1], Location.Counter[2], Location.Counter[3]).id
  333. local mapYourself = Map.GetTopUseItem(Location.Yourself[1], Location.Yourself[2], Location.Yourself[3]).id
  334. function Self.UntrashDice()
  335. if not table.find({5792, 5793, 5794, 5795, 5796, 5797}, mapDice) then
  336. Warring = Warring + 1
  337. if table.find({3043}, mapDice) then
  338. if Gambler.isExist() then
  339. Map.MoveItem(Location.Dice[1], Location.Dice[2], Location.PayoutCounter[1], Location.PayoutCounter[2])
  340. wait(300+Ping)
  341. else
  342. Map.PickupItem(Location.Dice[1], Location.Dice[2], Location.Dice[3], Container.GetFirst():Index(), 19, 100)
  343. wait(300+Ping)
  344. end
  345. else
  346. if Gambler.isExist() then
  347. toMove = {Location.PayoutCounter[1], Location.PayoutCounter[2]}
  348. else
  349. toMove = {Location.Yourself[1], Location.Yourself[2]}
  350. end
  351. Map.MoveItem(Location.Dice[1], Location.Dice[2], toMove[1], toMove[2])
  352. wait(300+Ping)
  353. end
  354. return true
  355. end
  356. return false
  357. end
  358. function Self.UntrashCounter()
  359. if not table.find({3043, Location.Counter.id}, mapCounter) then
  360. if Gambler.isExist() then
  361. toMove = {Gambler.Position[1], Gambler.Position[2]}
  362. else
  363. toMove = {Location.Yourself[1], Location.Yourself[2]}
  364. end
  365. Map.MoveItem(Location.Counter[1], Location.Counter[2], toMove[1], toMove[2])
  366. wait(300+Ping)
  367. return trued
  368. end
  369. if not Gambler.isExist() and mapCounter == 3043 then
  370. Map.PickupItem(Location.Counter[1], Location.Counter[2], Location.Counter[3], Container.GetFirst():Index(), 19, 100)
  371. wait(300+Ping)
  372. return true
  373. end
  374. return false
  375. end
  376. function Self.UntrashYourself()
  377. if mapYourself == 3043 then
  378. if Gambler.isExist() then
  379. Map.MoveItem(Location.Yourself[1], Location.Yourself[2], Location.PayoutCounter[1], Location.PayoutCounter[2])
  380. wait(300+Ping)
  381. else
  382. Map.PickupItem(Location.Yourself[1], Location.Yourself[2], Location.Yourself[3], Container.GetFirst():Index(), 19, 100)
  383. wait(300+Ping)
  384. end
  385. return true
  386. end
  387. return false
  388. end
  389. function Self.UntrashPayoutCounter()
  390. if not Gambler.isExist() then
  391. if mapPayoutCounter ~= Location.PayoutCounter.id then
  392. if mapPayoutCounter == 3043 then
  393. Map.PickupItem(Location.PayoutCounter[1], Location.PayoutCounter[2], Location.PayoutCounter[3], Container.GetFirst():Index(), 19, 100)
  394. wait(300+Ping)
  395. else
  396. Map.MoveItem(Location.PayoutCounter[1], Location.PayoutCounter[2], Location.Yourself[1], Location.Yourself[2])
  397. wait(300+Ping)
  398. end
  399. return true
  400. end
  401. end
  402. return false
  403. end
  404. function Self.UntrashHouseSquare()
  405. for index, tbl in ipairs(HouseUntrashSQM.inRange) do
  406. if not table.find(tbl.ids, Map.GetTopUseItem(tbl[1], tbl[2], tbl[3]).id) then
  407. if not table.find(PacketIDs, Map.GetTopUseItem(tbl[1], tbl[2], tbl[3]).id) then
  408. Warring = Warring + 1
  409. if Gambler.isExist() then
  410. toMove = {Gambler.Position[1], Gambler.Position[2]}
  411. else
  412. toMove = {Location.Yourself[1], Location.Yourself[2]}
  413. end
  414. Map.MoveItem(tbl[1], tbl[2], toMove[1], toMove[2])
  415. wait(300+Ping)
  416. else
  417. Map.MoveItem(tbl[1], tbl[2], Location.Yourself[1], Location.Yourself[2])
  418. Self.BanPlayer(Invited[1], 24*60, 'trying debug script')
  419. end
  420. return true
  421. end
  422. end
  423. return false
  424. end
  425. Self.UntrashHouseSquare()
  426. if (Self.UntrashDice() or Self.UntrashCounter() or Self.UntrashYourself() or Self.UntrashPayoutCounter()) then
  427. return true
  428. end
  429. return false
  430. end
  431.  
  432. function Self.RollNumber()
  433. if MSG == nil and Roll then
  434. Self.UseDice()
  435. end
  436. end
  437.  
  438. function Self.UseDice()
  439. Spam = os.difftime(os.clock(), Timer)
  440. if Spam > (0.9 + (Ping/1000)) and Roll then
  441. Self.UseItemFromGround(Location.Dice[1], Location.Dice[2], Location.Dice[3])
  442. Timer = os.clock()
  443. end
  444. end
  445.  
  446. function Self.SmartSay(msg, type, delay)
  447. Diff = os.difftime(os.time(), T)
  448. if Diff >= delay then
  449. Self.Speak(msg, type)
  450. T = os.time()
  451. end
  452. end
  453.  
  454. function Self.FirstSay(msg, delay)
  455. Diff1 = os.difftime(os.time(), T1)
  456. if not first_say then
  457. Self.Say(msg)
  458. first_say = true
  459. T1 = os.time()
  460. else
  461. if Diff1 >= delay then
  462. Self.Speak(msg, 0)
  463. T1 = os.time()
  464. end
  465. end
  466. end
  467.  
  468. function Self.SayBanInfo()
  469. if potencialPlayer ~= nil then
  470. if table.exist(potencialPlayer:lower(), Banned) then
  471. local warring = '' ..playername.. ' was banned for ' ..playerreason.. ', remain ~' .. ((math.floor((playertime - os.time())/60)) + 1).. ' min.'
  472. Self.FirstSay(warring, 5)
  473. end
  474. end
  475. end
  476.  
  477. function Self.PayRate()
  478. return {total = (Bet.Payout/100)+1, part = Bet.Payout/100}
  479. end
  480.  
  481. function Interested.PositionMatch(x, y, z)
  482. for j = 1, #InviterSQM do
  483. if (InviterSQM[j][1] == x and InviterSQM[j][2] == y and InviterSQM[j][3] == z) then
  484. return true
  485. end
  486. end
  487. return false
  488. end
  489.  
  490. function Interested.isExist()
  491. for _, c in Creature.iPlayers(7) do
  492. if table.count(Invited) == 0 then
  493. if Interested.PositionMatch(c:Position().x, c:Position().y, c:Position().z) then
  494. if c:Name() == potencialPlayer then
  495. if not table.exist(potencialPlayer:lower(), Banned) then
  496. Interested.Position = {c:Position().x, c:Position().y, c:Position().z}
  497. Interested.Name = c:Name():lower()
  498. return true
  499. else
  500. Self.SayBanInfo()
  501. end
  502. end
  503. end
  504. end
  505. end
  506. return false
  507. end
  508.  
  509. function Gambler.ControlBanList()
  510. for v, t in ipairs(Banned) do
  511. if t.time ~= nil then
  512. if t.time - os.time() <= 0 then
  513. table.remove(Banned, v)
  514. print(t.name ..' was removed from ban list couse of time.')
  515. end
  516. end
  517. end
  518. end
  519.  
  520. function Gambler.Cash()
  521. local cash = 0
  522. for i = 1, #Balance do
  523. if Balance[i].name == Invited[1] then
  524. cash = Balance[i].cash
  525. end
  526. end
  527. return cash
  528. end
  529.  
  530. function Gambler.InsertCash(toInsert)
  531. for i = 1, #Balance do
  532. if Balance[i].name == Invited[1] then
  533. lastName = Balance[i].name
  534. table.remove(Balance, i)
  535. table.insert(Balance, {name = lastName, cash = toInsert})
  536. end
  537. end
  538. end
  539.  
  540. function Gambler.PositionMatch(x, y, z)
  541. for j = 1, #GamblerSQM do
  542. if (GamblerSQM[j][1] == x and GamblerSQM[j][2] == y and GamblerSQM[j][3] == z) then
  543. return true
  544. end
  545. end
  546. return false
  547. end
  548.  
  549. function Gambler.isExist()
  550. for _, c in Creature.iPlayers(7) do
  551. if table.count(Invited) > 0 then
  552. if c:Name() == Invited[1] then
  553. if Gambler.PositionMatch(c:Position().x, c:Position().y, c:Position().z) then
  554. Gambler.Position = {c:Position().x, c:Position().y, c:Position().z}
  555. return true
  556. end
  557. end
  558. end
  559. end
  560. return false
  561. end
  562.  
  563. function Gambler.Remove()
  564. if table.count(Invited) > 0 then
  565. print("Removing "..potencialPlayer.."!")
  566. wait(300+Ping)
  567. Write("nothing")
  568. wait(1000+Ping)
  569. table.remove(Invited, 1)
  570. end
  571. end
  572.  
  573. function table.count(table_name)
  574. local count = 0
  575. for i = 1, #table_name do
  576. if i ~= nil then
  577. count = count + 1
  578. end
  579. end
  580. return count
  581. end
  582.  
  583. function table.exist(name, tbl)
  584. for index, i in ipairs(tbl) do
  585. if i.name:lower() == name:lower() then
  586. playerindex = index
  587. playercash = i.cash
  588. playername = i.name
  589. playerreason = i.reason
  590. playertime = i.time
  591. return true
  592. end
  593. end
  594. return false
  595. end
  596.  
  597. function Write(text)
  598. file = io.open(inviterfile_path, "w+")
  599. file:write(text)
  600. file:close()
  601. end
  602.  
  603. function AntiDebug()
  604. for index, tbl in ipairs(HouseUntrashSQM.toFar) do
  605. if (table.find(PacketIDs, Map.GetTopUseItem(Location.Counter[1], Location.Counter[2], Location.Counter[3]).id) or table.find(PacketIDs, Map.GetTopUseItem(Location.PayoutCounter[1], Location.PayoutCounter[2], Location.PayoutCounter[3]).id)) then
  606. if Invited[1] ~= nil then
  607. Self.BanPlayer(Invited[1], 24*60, 'trying debug script')
  608. end
  609. return true
  610. end
  611. end
  612. return false
  613. end
  614.  
  615. function Casino.isInstalled()
  616. AntiDebug()
  617. Self.UntrashLocations()
  618. if Container.New(Containers.Cash):isOpen() and Self.DistanceFromPosition(Location.Yourself[1], Location.Yourself[2], Location.Yourself[3]) == 0 then
  619. return true
  620. end
  621. return false
  622. end
  623.  
  624. -- Misc Lua Func --
  625.  
  626. luaSelfUsePartyHat = function ()
  627. Self.UseItemFromEquipment("head")
  628. wait(Ping)
  629. end
  630.  
  631. luaSelfPlayNuts = function ()
  632. Self.UseItemFromEquipment("weapon")
  633. wait(300+Ping)
  634. end
  635.  
  636. -- MODULES --
  637.  
  638. Module.New('Casino functions', function()
  639. if Casino.isInstalled() then
  640. Self.AcceptCash()
  641. Self.BetCheck()
  642. Self.RollNumber()
  643. end
  644. end)
  645.  
  646. Module.New("Party hat", function(ox)
  647. if Casino.isInstalled() then
  648. if not Gambler.isExist() then
  649. luaSelfUsePartyHat()
  650. end
  651. end
  652. ox:Delay(PartyhatTime+200+Ping, PartyhatTime+500+Ping)
  653. end)
  654.  
  655. Module.New('HUD status', function()
  656. if not Casino.isInstalled() then
  657. StatusTrueHUD:SetText("")
  658. StatusFalseHUD:SetText("OFF")
  659. else
  660. StatusFalseHUD:SetText("")
  661. StatusTrueHUD:SetText("ON")
  662. end
  663. end)
  664.  
  665. Module.New('Remove gambler', function()
  666. local unbanProcess = Gambler.ControlBanList()
  667. if Warring == -2 then
  668. Self.BanPlayer(Invited[1], 60, 'trashing house')
  669. Warring = 0
  670. end
  671. if not Gambler.isExist() then
  672. if os.clock() - time >= 3 then
  673. Gambler.Remove()
  674. end
  675. else
  676. if os.clock() - time >= TimetoKick then
  677. Gambler.Remove()
  678. end
  679. if math.floor(os.clock() - time) == 10 then
  680. Self.FirstSay('Kick in 10 seconds.', 2)
  681. end
  682. if math.floor(os.clock() - time) == 18 then
  683. Self.FirstSay('Kick in 5 seconds.', 2)
  684. end
  685. end
  686. end)
  687.  
  688. Module.New('Advertising', function(mod)
  689. if not Gambler.isExist() and Casino.isInstalled() then
  690. Self.SmartSay('Casino House | Min '.. Bet.Min ..' CC | Max '.. Bet.Max ..' CC | Payout '.. Bet.Payout ..'% | Bot&Cast ON! | AUTO INVITER ON |', 2, 5)
  691. end
  692. mod:Delay(17000, 20000)
  693. end, true)
  694.  
  695.  
  696. -- PROXIES --
  697.  
  698. LocalSpeechProxy.OnReceive("Speech._Key", function(proxy, mtype, speaker, level, text)
  699. local text = text:lower()
  700. if table.find({"inv", "invite", "play"}, text) and table.count(Invited) == 0 and Casino.isInstalled() and not Self.UntrashLocations() then
  701. potencialPlayer = speaker
  702. if Interested.isExist() then
  703. print("Inviting "..potencialPlayer.."!")
  704. wait(150+Ping)
  705. Write(""..potencialPlayer.."")
  706. table.insert(Invited, potencialPlayer)
  707. Self.Say("Welcome, "..speaker.."!")
  708. wait(1300+Ping)
  709. time = os.clock()
  710. first_say = nil
  711. Warring = 0
  712. if not table.exist(speaker, Balance) then
  713. table.insert(Balance, {name = potencialPlayer, cash = 0})
  714. CustomerHUD:SetText("Players: " ..table.count(Balance) .. "")
  715. else
  716. player_cash = playercash
  717. end
  718. end
  719. end
  720. for i = 1, #Invited do
  721. if table.find({"bye", "bb", "cya", "good bye"}, text) and speaker == Invited[i] then
  722. Self.Say("Good Bye, "..speaker.."!")
  723. Gambler.Remove()
  724. wait(300+Ping)
  725. break
  726. end
  727. end
  728. if not process_low and not process_high and speaker == Invited[1] and not Self.UntrashLocations() and Casino.isInstalled() then
  729. if Gambler.Cash() >= 1 then
  730. local number = text:match('%d+')
  731. local proxy_msg = text:match('%a+')
  732. if table.find({'123', 'l', 'low'}, text) then
  733. process_low = true
  734. player_bet = Gambler.Cash()
  735. elseif table.find({'456', 'h', 'high'}, text) then
  736. process_high = true
  737. player_bet = Gambler.Cash()
  738. elseif table.find({'pay', 'payout', '>', '<', 'withdraw', 'out', 'payo', 'v', '^'}, text) then
  739. Self.PayoutCash(Gambler.Cash())
  740. end
  741. if tonumber(number) ~= nil then
  742. number = number + 0
  743. if number >= 1 then
  744. if table.find({'123', 'l', 'low'}, proxy_msg) then
  745. process_low = true
  746. player_bet = number
  747. elseif table.find({'456', 'h', 'high'}, proxy_msg) then
  748. process_high = true
  749. player_bet = number
  750. end
  751. end
  752. end
  753. end
  754. if table.find({'bet', 'min', 'max', 'rate'}, text) then
  755. Self.FirstSay('Minimum '.. Bet.Min ..' - Maximum '.. Bet.Max ..'', 2)
  756. elseif table.find({'info', 'inform', 'information', '%'}, text) then
  757. Self.FirstSay('Min '.. Bet.Min ..' | Max '.. Bet.Max ..' | Payout '.. Bet.Payout ..'%', 2)
  758. elseif table.find({'balance', 'account', 'total'}, text) then
  759. Self.FirstSay('Balance ' ..Gambler.Cash(), 0, 2)
  760. end
  761. if table.find({"credits", "author", "credit", "owner"}, text) and Casino.isInstalled() then
  762. Self.Say("Script By Rif")
  763. wait(Ping)
  764. Self.Say("Current Owner: Mihelox")
  765. end
  766. end
  767. end)
  768.  
  769.  
  770. EffectMessageProxy.OnReceive("DiceSignal", function(proxy, message)
  771. if process_high or process_low and Roll then
  772. MSG = string.match(message, ""..Self.Name().."".." rolled a (.+).")
  773. if tonumber(MSG) ~= nil then
  774. MSG = tonumber(MSG)
  775. if MSG >= 1 and MSG <= 6 then
  776. Roll = nil
  777. end
  778. if process_low then
  779. if MSG >= 1 and MSG < 4 then
  780. local win = math.floor(player_bet*Self.PayRate().part)
  781. local balance = math.floor((Gambler.Cash()-player_bet)+player_bet*Self.PayRate().total)
  782. Profit = Profit - win
  783. Gambler.InsertCash(balance)
  784. process_low, MSG, player_bet = nil, nil, 0
  785. luaSelfPlayNuts()
  786. Self.SmartSay('Won '.. win ..' | Balance '..Gambler.Cash(), 0, 1.2)
  787. time = os.clock()
  788. BalanceCashHUD:SetText(Profit)
  789. elseif MSG >= 4 and MSG < 7 then
  790. local lose = player_bet
  791. local balance = Gambler.Cash()-player_bet
  792. Profit = Profit + lose
  793. Gambler.InsertCash(balance)
  794. process_low, MSG, player_bet = nil, nil, 0
  795. Self.SmartSay('Lost '.. lose ..' | Balance '..Gambler.Cash(), 0, 1.2)
  796. time = os.clock()
  797. BalanceCashHUD:SetText(Profit)
  798. end
  799. elseif process_high then
  800. if MSG >= 1 and MSG < 4 then
  801. local lose = player_bet
  802. local balance = Gambler.Cash()-player_bet
  803. Profit = Profit + lose
  804. Gambler.InsertCash(balance)
  805. process_high, MSG, player_bet = nil, nil, 0
  806. Self.SmartSay('Lost '.. lose ..' | Balance '..Gambler.Cash(), 0, 1.2)
  807. time = os.clock()
  808. BalanceCashHUD:SetText(Profit)
  809. elseif MSG >= 4 and MSG < 7 then
  810. local win = math.floor(player_bet*Self.PayRate().part)
  811. local balance = math.floor((Gambler.Cash()-player_bet)+player_bet*Self.PayRate().total)
  812. Profit = Profit - win
  813. Gambler.InsertCash(balance)
  814. process_high, MSG, player_bet = nil, nil, 0
  815. luaSelfPlayNuts()
  816. Self.SmartSay('Won '.. win ..' | Balance '..Gambler.Cash(), 0, 1.2)
  817. time = os.clock()
  818. BalanceCashHUD:SetText(Profit)
  819. end
  820. end
  821. end
  822. end
  823. end)
  824.  
  825. function onSpeak(chat, msg)
  826. chat:SendYellowMessage(Self.Name(), msg)
  827. local msg1 = msg
  828. local msg = msg:lower()
  829. local value = msg:match('%d+')
  830. local chat_msg = msg:match('%a+')
  831. local valid_settings = (not ban_v1 and not ban_v2 and not ban_v3 and not ban_v4)
  832. if table.find({'/ban', 'ban'}, msg) then
  833. chat:SendOrangeMessage('XenoBot', 'Insert ban name:')
  834. ban_v1 = true
  835. elseif ban_v1 then
  836. banName = msg1
  837. if not table.exist(banName:lower(), Banned) then
  838. ban_v2 = true
  839. ban_v1 = nil
  840. chat:SendOrangeMessage('XenoBot', 'Insert time(1 = 1min):')
  841. end
  842. elseif ban_v2 and banName ~= nil and type(banName) == 'string' then
  843. if tonumber(msg) ~= nil then
  844. msg = msg + 0
  845. if msg > 0 then
  846. banTime = msg
  847. chat:SendOrangeMessage('XenoBot', 'Insert reason:')
  848. ban_v3 = true
  849. ban_v2 = nil
  850. end
  851. else
  852. chat:SendOrangeMessage('XenoBot', 'String message cannot be accepted. Insert number.')
  853. end
  854. elseif ban_v3 then
  855. if tostring(msg) ~= '' then
  856. ban_v3 = nil
  857. banReason = msg
  858. Self.BanPlayer(banName, banTime, banReason)
  859. chat:SendOrangeMessage('XenoBot', banName.. ' was banned.')
  860. end
  861. elseif table.find({'/unban', 'unban'}, msg) then
  862. ban_v4 = true
  863. chat:SendOrangeMessage('XenoBot', 'Insert unban name:')
  864. elseif ban_v4 then
  865. unbanName = msg
  866. Self.UnbanPlayer(unbanName)
  867. ban_v4 = false
  868. chat:SendOrangeMessage('XenoBot', unbanName.. 'was unbaned.')
  869. end
  870. if table.find({'/start', 'start'}, msg) and valid_settings then
  871. if not Casino.isInstalled() then
  872. chat:SendOrangeMessage('XenoBot', 'Starting Script.')
  873. Self.InstalCasino()
  874. end
  875. end
  876. if table.find({'/cast', 'cast'}, msg) and valid_settings then
  877. if Casino.isInstalled() then
  878. chat:SendOrangeMessage('XenoBot', 'Opening Broadcast.')
  879. Self.Say(CastCommand)
  880. end
  881. end
  882. if table.find({'/stopcast', 'stopcast'}, msg) and valid_settings then
  883. if Casino.isInstalled() then
  884. chat:SendOrangeMessage('XenoBot', 'Closing Broadcast.')
  885. Self.Say(StopCastCommand)
  886. end
  887. end
  888. if table.find({'/stop', 'stop'}, msg) and valid_settings then
  889. if Casino.isInstalled() then
  890. if Gambler.isExist() then
  891. chat:SendOrangeMessage('XenoBot', 'Kicking Gambler and Stopping Game.')
  892. print("Stopping Script...")
  893. Self.Say("Game Stopped")
  894. Self.CloseContainers()
  895. Gambler.Remove()
  896. else
  897. chat:SendOrangeMessage('XenoBot', 'Pausing Game.')
  898. print("Stopping Script...")
  899. Self.CloseContainers()
  900. end
  901. end
  902. end
  903. if table.find({'/kick', 'kick'}, msg) and valid_settings and Casino.isInstalled() and not Self.UntrashLocations() and Gambler.isExist() then
  904. chat:SendOrangeMessage('XenoBot', 'Kicking Actual Gambler.')
  905. print("Removing "..potencialPlayer.."!")
  906. Gambler.Remove()
  907. Self.Say(''..potencialPlayer..', Was Kicked By Console!')
  908. wait(500+Ping)
  909. end
  910. end
  911. if tonumber(value) ~= nil then
  912. value = value + 0
  913. if value >= 0 and valid_settings then
  914. if table.find({'/ping', 'ping'}, chat_msg) then
  915. Ping = value
  916. chat:SendOrangeMessage('XenoBot', 'Ping setup to '.. value ..'ms')
  917. end
  918. if value >= 1 then
  919. if table.find({'/min', '/minbet', 'min', 'minbet'}, chat_msg) then
  920. Bet = {Max = Bet.Max, Min = value, Payout = Bet.Payout}
  921. if Gambler.isExist() then
  922. Self.Say('Minimum is '.. value ..' now.')
  923. end
  924. chat:SendOrangeMessage('XenoBot', 'Minimum is '.. value ..' now.')
  925. elseif table.find({'/max', '/maxbet', 'max', 'maxbet'}, chat_msg) then
  926. Bet = {Max = value, Min = Bet.Min, Payout = Bet.Payout}
  927. if Gambler.isExist() then
  928. Self.Say('Maximum is '.. value ..' now.')
  929. end
  930. chat:SendOrangeMessage('XenoBot', 'Maximum is '.. value ..' now.')
  931. elseif table.find({'/payout', '/%', 'payout', '%'}, chat_msg) then
  932. Bet = {Max = Bet.Max, Min = Bet.Min, Payout = value}
  933. if Gambler.isExist() then
  934. Self.Say('Payout is '.. value ..'% now.')
  935. end
  936. chat:SendOrangeMessage('XenoBot', 'Payout is '.. value ..'% now.')
  937. end
  938. end
  939. end
  940. end
  941. function onClose() end
  942. local chat = Channel("</Config/>", onSpeak, onClose)
  943. chat:SendOrangeMessage('XenoBot', 'Commands:\n[#1] /start or /stop - start or stop script\n[#2] /ping - actions delay, eg. ping 200\n[#3] /min or /max or /payout - bet config eg. max 25, payout 80\n[#4] /ban or /unban - add or remove players to ban list\n[#5] /kick - kick the actual player\n[#6] /cast or /stopcast - Open Broadcasting or Close Broadcast')
  944.  
  945. Module.New("dir", function(module)
  946. if Self.LookDirection() ~= 0 then
  947. Self.Turn('SOUTH')
  948. end
  949. end)
  950.  
  951. Module.New("autoreset", function(module)
  952. if #Container.GetAll() == 0 or not Casino.isInstalled() then -- Self.LookDirection()
  953. Self.InstalCasino()
  954. end
  955. module:Delay(10)
  956. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement