mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 18:41:21 +00:00
added method for ownership transference
This commit is contained in:
parent
d2aceab50d
commit
c33b0c2a4b
1 changed files with 32 additions and 0 deletions
32
init.lua
32
init.lua
|
@ -476,3 +476,35 @@ minetest.register_chatcommand("enable_blast_damage", {
|
||||||
storage:set_int("blast_damage", save)
|
storage:set_int("blast_damage", save)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("transfer_ownership", {
|
||||||
|
params = "<new_owner>",
|
||||||
|
description = "Transfer the property of a plane to another player",
|
||||||
|
privs = {interact=true},
|
||||||
|
func = function(name, param)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
local target_player = minetest.get_player_by_name(param)
|
||||||
|
local attached_to = player:get_attach()
|
||||||
|
|
||||||
|
if attached_to ~= nil then
|
||||||
|
if target_player ~= nil then
|
||||||
|
local seat = attached_to:get_attach()
|
||||||
|
if seat ~= nil then
|
||||||
|
local entity = seat:get_luaentity()
|
||||||
|
if entity then
|
||||||
|
if entity.owner == name or minetest.check_player_privs(name, {protection_bypass=true}) then
|
||||||
|
entity.owner = param
|
||||||
|
minetest.chat_send_player(name,core.colorize('#00ff00', " >>> This plane now is property of: "..param))
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,core.colorize('#ff0000', " >>> only the owner or moderators can transfer this airplane"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,core.colorize('#ff0000', " >>> the target player must be logged in"))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,core.colorize('#ff0000', " >>> you are not inside a plane to perform the command"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue