mirror of
https://github.com/mt-mods/playerfactions.git
synced 2024-11-22 07:13:50 +01:00
Fixed critical bugs
This commit is contained in:
parent
db86cabb04
commit
f9ce04c4c4
8
init.lua
8
init.lua
@ -8,7 +8,7 @@ factions = {}
|
|||||||
local facts = {}
|
local facts = {}
|
||||||
local storage = minetest.get_mod_storage()
|
local storage = minetest.get_mod_storage()
|
||||||
|
|
||||||
if storage:get_string("facts") ~= nil then
|
if storage:get_string("facts") ~= "" then
|
||||||
facts = minetest.deserialize(storage:get_string("facts"))
|
facts = minetest.deserialize(storage:get_string("facts"))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -62,11 +62,11 @@ function factions.set_password(name, password)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function factions.join_faction(name, player)
|
function factions.join_faction(name, player)
|
||||||
factions.get_player_by_name(player):get_meta():set_string("faction", name)
|
minetest.get_player_by_name(player):get_meta():set_string("faction", name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.leave_faction(name)
|
function factions.leave_faction(name)
|
||||||
factions.get_player_by_name(name):get_meta():set_string("faction", "")
|
minetest.get_player_by_name(name):get_meta():set_string("faction", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Chat commands
|
-- Chat commands
|
||||||
@ -152,7 +152,7 @@ local function handle_command(name, param)
|
|||||||
elseif action == "leave" then
|
elseif action == "leave" then
|
||||||
local faction_name = factions.get_player_faction(name)
|
local faction_name = factions.get_player_faction(name)
|
||||||
if faction_name == nil then
|
if faction_name == nil then
|
||||||
minetest.chat.send_player(name, S("You are not in a faction"))
|
minetest.chat_send_player(name, S("You are not in a faction"))
|
||||||
elseif factions.get_owner(faction_name) == name then
|
elseif factions.get_owner(faction_name) == name then
|
||||||
minetest.chat_send_player(name, S("You cannot leave your own faction"))
|
minetest.chat_send_player(name, S("You cannot leave your own faction"))
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user