Last active
April 22, 2017 11:48
-
-
Save Adrodoc/dae74abe87357d2e3a6fe0daf0243f46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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