forked from mtcontrib/factions
Add: invites cmd
This commit is contained in:
parent
11bc91e21f
commit
2e579c3d0c
@ -459,6 +459,25 @@ factions.register_command("invite", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
factions.invite_player(faction.name, args.players[1])
|
factions.invite_player(faction.name, args.players[1])
|
||||||
|
minetest.chat_send_player(player, "Invite Sent.")
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
},false)
|
||||||
|
|
||||||
|
factions.register_command("invites", {
|
||||||
|
description = "List invited players.",
|
||||||
|
faction_permissions = {"invite"},
|
||||||
|
global_privileges = def_global_privileges,
|
||||||
|
on_success = function(player, faction, pos, parcelpos, args)
|
||||||
|
minetest.chat_send_player(player, "Invited players:")
|
||||||
|
local foundplayer = false
|
||||||
|
for p, _ in pairs(faction.invited_players) do
|
||||||
|
minetest.chat_send_player(player, p)
|
||||||
|
foundplayer = true
|
||||||
|
end
|
||||||
|
if not foundplayer then
|
||||||
|
minetest.chat_send_player(player, "None:")
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -471,6 +490,7 @@ factions.register_command("uninvite", {
|
|||||||
global_privileges = def_global_privileges,
|
global_privileges = def_global_privileges,
|
||||||
on_success = function(player, faction, pos, parcelpos, args)
|
on_success = function(player, faction, pos, parcelpos, args)
|
||||||
factions.revoke_invite(faction.name, args.players[1])
|
factions.revoke_invite(faction.name, args.players[1])
|
||||||
|
minetest.chat_send_player(player, "Invite canceled.")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
},false)
|
},false)
|
||||||
@ -815,17 +835,26 @@ if factions_config.faction_diplomacy == true then
|
|||||||
end
|
end
|
||||||
|
|
||||||
factions.register_command("who", {
|
factions.register_command("who", {
|
||||||
description = "List players in your faction, and their ranks.",
|
description = "List players in a faction, and their ranks.",
|
||||||
|
infaction = false,
|
||||||
global_privileges = def_global_privileges,
|
global_privileges = def_global_privileges,
|
||||||
|
format = {"faction"},
|
||||||
on_success = function(player, faction, pos, parcelpos, args)
|
on_success = function(player, faction, pos, parcelpos, args)
|
||||||
if not faction.players then
|
local f = args.factions[1]
|
||||||
minetest.chat_send_player(player, "There is nobody in this faction (" .. faction.name .. ")")
|
|
||||||
return true
|
if not f then
|
||||||
|
minetest.chat_send_player(player, "There faction (" .. f.name .. ") does not exist.")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(player, "Players in faction " .. faction.name .. ": ")
|
if not f.players then
|
||||||
|
minetest.chat_send_player(player, "There is nobody in this faction (" .. f.name .. ")")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for p, rank in pairs(faction.players) do
|
minetest.chat_send_player(player, "Players in faction " .. f.name .. ": ")
|
||||||
|
|
||||||
|
for p, rank in pairs(f.players) do
|
||||||
minetest.chat_send_player(player, p .." (" .. rank .. ")")
|
minetest.chat_send_player(player, p .." (" .. rank .. ")")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1192,6 +1221,7 @@ factions.register_command("promote", {
|
|||||||
|
|
||||||
if player_faction and promoter_facname == facname then
|
if player_faction and promoter_facname == facname then
|
||||||
factions.promote(faction.name, name, rank)
|
factions.promote(faction.name, name, rank)
|
||||||
|
minetest.chat_send_player(player, "Promoted " .. name .. " to " .. rank .. "!")
|
||||||
return true
|
return true
|
||||||
elseif not player_faction or promoter_facname ~= facname then
|
elseif not player_faction or promoter_facname ~= facname then
|
||||||
send_error(player, name .. " is not in your faction")
|
send_error(player, name .. " is not in your faction")
|
||||||
@ -1289,8 +1319,9 @@ factions.register_command("set_leader", {
|
|||||||
local playername = args.players[1]
|
local playername = args.players[1]
|
||||||
local playerfaction, facname = factions.get_player_faction(playername)
|
local playerfaction, facname = factions.get_player_faction(playername)
|
||||||
local targetfaction = args.factions[1]
|
local targetfaction = args.factions[1]
|
||||||
if playername ~= targetname then
|
|
||||||
send_error(player, "Player " .. playername .. " is not in faction " .. targetname .. ".")
|
if facname ~= targetfaction.name then
|
||||||
|
send_error(player, "Player " .. playername .. " is not in faction " .. targetfaction.name .. ".")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
factions.set_leader(targetfaction.name, playername)
|
factions.set_leader(targetfaction.name, playername)
|
||||||
@ -1381,21 +1412,6 @@ factions.register_command("get_factions_spawn", {
|
|||||||
end
|
end
|
||||||
},false)
|
},false)
|
||||||
|
|
||||||
factions.register_command("whoin", {
|
|
||||||
description = "Get all members of a faction",
|
|
||||||
infaction = false,
|
|
||||||
global_privileges = def_global_privileges,
|
|
||||||
format = {"faction"},
|
|
||||||
on_success = function(player, faction, pos, parcelpos, args)
|
|
||||||
local msg = {}
|
|
||||||
for player, _ in pairs(args.factions[1].players) do
|
|
||||||
table.insert(msg, player)
|
|
||||||
end
|
|
||||||
minetest.chat_send_player(player, table.concat(msg, ", "))
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
},false)
|
|
||||||
|
|
||||||
factions.register_command("stats", {
|
factions.register_command("stats", {
|
||||||
description = "Get stats of a faction",
|
description = "Get stats of a faction",
|
||||||
infaction = false,
|
infaction = false,
|
||||||
|
Loading…
Reference in New Issue
Block a user