From 023a3ca0560383dffffb35a90ed3659da68670ae Mon Sep 17 00:00:00 2001 From: Luki Date: Mon, 20 Jun 2016 14:24:36 +0200 Subject: [PATCH] Change behaviour for mass renaming (#521) Append number instead of randomizing when renaming multiple players. Before the change: sm_rename @all "Random Name" - this would rename everyone but the names would be randomized (random characters and numbers) After the change: sm_rename @all "Random Name" - this would rename everyone to: Random Name 1, Random Name 2, Random Name 3 ... etc. Description: sm_rename can only rename 1 player at a time, when you specify a name. If you use this command on multiple players (like sm_rename @bots "A random bot"), their names get randomized(just like when you dont specify a name). So I propose this change, so you can rename multiple people. PS:The funny thing is that there was a comment in the code about not wanting everyone to have a same name, but sm_rename doesnt a have check for this so you could use sm_rename to rename everyone, one by one, using the same name. --- plugins/playercommands/rename.sp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/playercommands/rename.sp b/plugins/playercommands/rename.sp index b3d6b9d0..17ceeba4 100644 --- a/plugins/playercommands/rename.sp +++ b/plugins/playercommands/rename.sp @@ -174,20 +174,22 @@ public Action Command_Rename(int client, int args) ShowActivity2(client, "[SM] ", "%t", "Renamed target", "_s", target_name); } - if (target_count > 1) /* We cannot name everyone the same thing. */ - { - randomize = true; - } - for (int i = 0; i < target_count; i++) { - if(randomize) + if (randomize) { RandomizeName(target_list[i]); } else { - Format(g_NewName[target_list[i]], MAX_NAME_LENGTH, "%s", arg2); + if (target_count > 1) + { + Format(g_NewName[target_list[i]], MAX_NAME_LENGTH, "%s %i", arg2, i+1); + } + else + { + Format(g_NewName[target_list[i]], MAX_NAME_LENGTH, "%s", arg2); + } } PerformRename(client, target_list[i]); }