Prevented extra long rank names

This commit is contained in:
shamoanjac 2016-08-18 15:29:43 +02:00
parent c552a58b63
commit 0a47417e77
2 changed files with 6 additions and 1 deletions

View File

@ -403,8 +403,12 @@ factions.register_command("newrank", {
faction_permissions = {"ranks"}, faction_permissions = {"ranks"},
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 #rank > factions.rank then
send_error(player, "Go away Todd")
return false
end
if faction.ranks[rank] then if faction.ranks[rank] then
--TODO: rank already exists send_error(player, "Rank already exists")
return false return false
end end
faction:add_rank(rank, args.other) faction:add_rank(rank, args.other)

View File

@ -34,6 +34,7 @@ factions.power_per_tick = .125
factions.tick_time = 60. factions.tick_time = 60.
factions.power_per_attack = 2. factions.power_per_attack = 2.
factions.faction_name_max_length = 50 factions.faction_name_max_length = 50
factions.rank_name_max_length = 25
--------------------- ---------------------
--! @brief returns whether a faction can be created or not (allows for implementation of blacklists and the like) --! @brief returns whether a faction can be created or not (allows for implementation of blacklists and the like)