Advertisement
kreezxil

ComputerCraft EnderPay XP Shop 1.12.2

Jan 4th, 2018
1,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.57 KB | None | 0 0
  1. --# Kreezxil's EnderPay Shop
  2. --# based on the following
  3. --# pastebin: https://pastebin.com/23ddYhRi
  4. --# Wojbie's Xp Shoppe
  5. --# Uses touchpoint api
  6. --# http://pastebin.com/cRTsaYaK
  7.  
  8. --# Uncomment next line to remove Op message spam
  9. --commands.exec("gamerule commandBlockOutput false")
  10.  
  11. local Shop={}
  12.  
  13. --# table.insert(Shop,{["name"]="Stone Brick",["price"]=1,["item"]="minecraft:stonebrick 64"})
  14. --# table.insert(Shop,{["name"]="Tin Gear",["price"]=5,["item"]="Railcraft:part.gear 1 3",}) --3 is damage value for basic tin gear
  15.  
  16. --# table.insert(Shop,{["name"]="1 Credit", ["price"]=1,["item"]="enderpay:filled_banknote 1 0 {DateIssued:365000L,Amount:1}",})
  17. table.insert(Shop,{["name"]="1CR", ["price"]=1,["item"]="1",})
  18. table.insert(Shop,{["name"]="10CR", ["price"]=10,["item"]="10",})
  19. table.insert(Shop,{["name"]="100CR", ["price"]=100,["item"]="100",})
  20. table.insert(Shop,{["name"]="1000CR", ["price"]=1000,["item"]="1000",})
  21. table.insert(Shop,{["name"]="10000CR", ["price"]=10000,["item"]="10000",})
  22. table.insert(Shop,{["name"]="100000CR", ["price"]=100000,["item"]="100000",})
  23.  
  24.  
  25. --# Default shop zone to CommandComputer coords
  26. local range = 5
  27.  
  28. --# Load touchpoint api
  29. if not fs.exists("/touchpoint") then shell.run("pastebin get pFHeia96 /touchpoint") end
  30. os.loadAPI("touchpoint")
  31.  
  32. --# Assuming that monitor is on top of commandComputer
  33. local t = touchpoint.new("top")
  34.  
  35. --# Commands Backup
  36. --# give @p[lm=10,x=-532,y=69,z=1084,r=3] Railcraft:part.gear 1 3
  37. --# xp -10L @p[lm=10,x=-532,y=69,z=1084,r=3]
  38.  
  39. local jump=false
  40.  
  41. print("Adding "..#Shop.." Items to shop")
  42.  
  43. for i,k in pairs(Shop) do
  44.     local name = k.name.." = "..k.price.."L"
  45.     print(name)
  46.  
  47.     t:add(name, function()
  48.         commands.exec("tellraw @p[l="..(k.price-1)..",r="..range.."] "..'["",{"text":"You don\'t have lvl for '..k.name..'","color":"red"}]')
  49.         commands.exec("playsound minecraft:entity.villager.no player @p[l="..(k.price-1)..",r="..range.."]")
  50.         --wiadomosc masz xp
  51.         commands.exec("tellraw @p[lm="..k.price..",r="..range.."] "..'["",{"text":"Sold '..k.name.." for "..k.price..' lvls","color":"green"}]')
  52.         commands.exec("playsound minecraft:entity.villager.yes player @p[lm="..k.price..",r="..range.."]")
  53.         --# commands.exec("give @p[lm="..k.price..",r="..range.."] "..k.item)
  54.         commands.exec("wallet give @p[lm="..k.price..",r="..range.."] "..k.item)
  55.         commands.exec("xp -"..k.price.."L @p[lm="..k.price..",r="..range.."]")
  56.         t:flash(name)
  57.     end , 3+25*(jump and 1 or 0), 2+2*math.floor((i-1)/2), 23+24*(jump and 1 or 0),2+2*math.floor((i-1)/2), colors.red, colors.lime)
  58.  
  59.     jump=not jump
  60. end
  61.  
  62. t:run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement