From 74a502d25a05e2422580221e3b16735bd5f81cd2 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 13 Sep 2024 15:01:29 +0100 Subject: [PATCH] can only overwrite existing passwords --- locale/en/pirates.cfg | 2 ++ maps/pirates/commands.lua | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/locale/en/pirates.cfg b/locale/en/pirates.cfg index e2fc1868..fb17f04c 100644 --- a/locale/en/pirates.cfg +++ b/locale/en/pirates.cfg @@ -550,6 +550,7 @@ cmd_notify_set_private_run_password=The password for __1__ has been set to __2__ + gui_runs_launch=Launch crew gui_runs_launch_error_2=The number of concurrent crews on the server has reached the cap set by the admins. gui_runs_launch_error_4=No sloops available. Join an existing crew instead. @@ -615,6 +616,7 @@ cmd_error_invalid_player_name=[ERROR] Player __1__ not found. cmd_error_invalid_class_name=[ERROR] Class __1__ not found. cmd_error_color_not_found=[ERROR] Color __1__ not found. cmd_error_not_creator_of_crew=[ERROR] Only the original creator of the crew can run this command. +cmd_error_no_existing_password=There is no existing password to overwrite for this crew. cmd_explain_set_max_crews=is an admin command to set the maximum number of concurrent crews allowed on the server. cmd_explain_sail=is an admin command to set the ship sailing after an island, in case there's a problem with the captain doing so. diff --git a/maps/pirates/commands.lua b/maps/pirates/commands.lua index 6d861eba..38c0a1b6 100644 --- a/maps/pirates/commands.lua +++ b/maps/pirates/commands.lua @@ -374,6 +374,11 @@ commands.add_command( if check_creator_of_crew(cmd) then local player = game.players[cmd.player_index] + if not memory.private_run_password then + Common.notify_player_error(player, { 'pirates.cmd_error_no_existing_password' }) + return false + end + memory.private_run_password = param Common.notify_player_expected(player, { 'pirates.cmd_notify_set_private_run_password', memory.name, param }) end