diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index f7b98c4db..5b077817f 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -2510,11 +2510,11 @@ static void MutePlayer(boolean mute) if (COM_Argc() < 2) { - CONS_Printf(M_GetText("muteplayer : mute a player\n")); + CONS_Printf(M_GetText("muteplayer : mute a player\n")); return; } - data[0] = atoi(COM_Argv(1)); + data[0] = nametonum(COM_Argv(1)); if (data[0] >= MAXPLAYERS || !playeringame[data[0]]) { CONS_Alert(CONS_NOTICE, M_GetText("There is no player %u!\n"), (unsigned int)data[0]); @@ -2603,11 +2603,11 @@ static void Command_ServerTeamChange_f(void) if (COM_Argc() < 3) { if (G_TagGametype()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); else if (G_GametypeHasTeams()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); else if (G_GametypeHasSpectators()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); else CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n")); return; @@ -2655,19 +2655,19 @@ static void Command_ServerTeamChange_f(void) if (error) { if (G_TagGametype()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); else if (G_GametypeHasTeams()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); else if (G_GametypeHasSpectators()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); return; } - NetPacket.packet.playernum = atoi(COM_Argv(1)); + NetPacket.packet.playernum = nametonum(COM_Argv(1)); - if (!playeringame[NetPacket.packet.playernum]) + if (NetPacket.packet.playernum == -1 || !playeringame[NetPacket.packet.playernum]) { - CONS_Alert(CONS_NOTICE, M_GetText("There is no player %d!\n"), NetPacket.packet.playernum); + CONS_Alert(CONS_NOTICE, M_GetText("There is no player %s!\n"), COM_Argv(1)); return; } @@ -3106,13 +3106,16 @@ static void Command_Verify_f(void) if (COM_Argc() != 2) { - CONS_Printf(M_GetText("promote : give admin privileges to a player\n")); + CONS_Printf(M_GetText("promote : give admin privileges to a player\n")); return; } - strlcpy(buf, COM_Argv(1), sizeof (buf)); - - playernum = atoi(buf); + playernum = nametonum(COM_Argv(1)); + if (playernum == -1) + { + CONS_Alert(CONS_NOTICE, M_GetText("There is no player %s!\n"), COM_Argv(1)); + return; + } temp = buf; @@ -3156,13 +3159,16 @@ static void Command_RemoveAdmin_f(void) if (COM_Argc() != 2) { - CONS_Printf(M_GetText("demote : remove admin privileges from a player\n")); + CONS_Printf(M_GetText("demote : remove admin privileges from a player\n")); return; } - strlcpy(buf, COM_Argv(1), sizeof(buf)); - - playernum = atoi(buf); + playernum = nametonum(COM_Argv(1)); + if (playernum == -1) + { + CONS_Alert(CONS_NOTICE, M_GetText("There is no player %s!\n"), COM_Argv(1)); + return; + } temp = buf;