Guest User

Untitled

a guest
Jun 3rd, 2013
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Set up table(s)
  2.     local jails = {}
  3.    
  4. -- Load jail positions
  5.     local savefile  = io.open(minetest.get_worldpath() .. "/jails.data","r")
  6.     local getjails  = savefile:read("*a")
  7.     jails   = minetest.deserialize(getjails)
  8.     savefile:close()
  9.     getjails = nil
  10.    
  11. -- Register command for admin which allows him to create a new jail position
  12.     minetest.register_chatcommand("createjail", {
  13.     params = "",
  14.     description = "Create a new jail position",
  15.     privs   = {admin=true},
  16.     func = function(name, param)
  17.         local admin = minetest.get_player_by_name(name)
  18.         local pos   = admin:getpos()
  19.         local raw   = {
  20.             position    = pos,
  21.             player  = false
  22.         }
  23.         table.insert(jails, raw)
  24.         local prepare4save  = minetest.serialize(jails)
  25.         local savefile  = io.open(minetest.get_worldpath() .. "/jails.data","w")
  26.         savefile:write(prepare4save)
  27.         savefile:close()
  28.     end
  29. })
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×