Skip to content

Instantly share code, notes, and snippets.

@Adrodoc
Last active April 22, 2017 11:48
Show Gist options
  • Save Adrodoc/dae74abe87357d2e3a6fe0daf0243f46 to your computer and use it in GitHub Desktop.
Save Adrodoc/dae74abe87357d2e3a6fe0daf0243f46 to your computer and use it in GitHub Desktop.
require 'https://gist.github.com/mkarneim/8deed890e0d92ef19506e889819b2e97'
function plot_books()
print('Starting Plot Books')
event = events.register('stop_plot_books')
while not event.hasNext() do
print('tick')
for _, name in pairs(players.list()) do
if 0 != cmd('testfor @p[name='..name..'] {Inventory:[{id:minecraft:writable_book,tag:{pages:["hello"]}}]}') then
cmd('gamemode @p[name='..name..'] 0')
end
player = players.get(name)
plaer.getInventory()
print(toString(player))
end
sleep(1)
end
end
function stop_plot_books()
print('Stopping Plot Books')
events.fire('stop_plot_books')
end
function toString(var)
if type(var) == 'table' then
return table.toString(var)
end
t = type(var)
if t == 'function' or t == 'userdata' then
return t
end
return var
end
function table.toString(table)
result = '{'
for k, v in pairs(table) do
result = result .. toString(k) .. '=' .. toString(v) .. ','
end
endIndex = next(table) and -2 or -1
return string.sub(result, 1, endIndex) .. '}'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment