- Code: Select all
minetest.register_chatcommand("send_spawn", {
params = "",
description = "Send interactless players back to spawn.",
privs = {basic_privs=true},
func = function(name)
for _,player in ipairs(minetest.get_connected_players()) do
local player = player:get_player_name()
local pos = minetest.setting_get_pos("static_spawnpoint")
if not minetest.get_player_privs(player).interact then
player:setpos(pos)
minetest.chat_send_player(player,"Please read the rules.")
return
end
end
minetest.log("action", "player " .. name .. " Used the send_spawn command.")
end,
})
error wrote:2015-07-03 10:39:05: ERROR[main]: UNRECOVERABLE error occurred. Stopping server. Please fix the following error:
2015-07-03 10:39:05: ERROR[main]: ...ocuments/minetest/bin/../mods/keyword_interact2/init.lua:67: attempt to call method 'setpos' (a nil value)
2015-07-03 10:39:05: ERROR[main]: stack traceback:
2015-07-03 10:39:05: ERROR[main]: ...ocuments/minetest/bin/../mods/keyword_interact2/init.lua:67: in function 'func'
2015-07-03 10:39:05: ERROR[main]: .../Documents/minetest/bin/../builtin/game/chatcommands.lua:40: in function <.../Documents/minetest/bin/../builtin/game/chatcommands.lua:29>
2015-07-03 10:39:05: ERROR[main]: ...ormz/Documents/minetest/bin/../builtin/game/register.lua:341: in function <...ormz/Documents/minetest/bin/../builtin/game/register.lua:329>
I am kind of confused to what is wrong with code