forked from mtcontrib/factions
Bug: you can promote someone in another faction
This commit is contained in:
parent
4e21583536
commit
dd88c61009
@ -1204,8 +1204,23 @@ factions.register_command("promote", {
|
|||||||
on_success = function(player, faction, pos, parcelpos, args)
|
on_success = function(player, faction, pos, parcelpos, args)
|
||||||
local rank = args.strings[1]
|
local rank = args.strings[1]
|
||||||
if faction.ranks[rank] then
|
if faction.ranks[rank] then
|
||||||
factions.promote(faction.name, args.players[1]:get_player_name(), rank)
|
local player_to_promote = args.players[1]
|
||||||
return true
|
local name = player_to_promote:get_player_name()
|
||||||
|
|
||||||
|
local player_faction, facname = factions.get_player_faction(name)
|
||||||
|
|
||||||
|
local promoter_faction, promoter_facname = factions.get_player_faction(player)
|
||||||
|
|
||||||
|
if player_faction and promoter_facname == facname then
|
||||||
|
factions.promote(faction.name, name, rank)
|
||||||
|
return true
|
||||||
|
elseif not player_faction or promoter_facname ~= facname then
|
||||||
|
send_error(player, name .. " is not in your faction")
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
send_error(player, name .. " cannot be promoted from your faction")
|
||||||
|
return false
|
||||||
|
end
|
||||||
else
|
else
|
||||||
send_error(player, "The specified rank does not exist.")
|
send_error(player, "The specified rank does not exist.")
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user