From 1850123f8bf49ad4fabb11e71d8ec5724b5e5fb7 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 20 Jan 2019 18:50:07 +0100 Subject: [PATCH 1/4] Prevent the use of respawn to cheese SPB and other items --- src/d_netcmd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 41f88ab9..8272b75d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2489,6 +2489,12 @@ static void Command_Respawn(void) UINT8 *cp = buf; WRITEINT32(cp, consoleplayer); + + if (players[consoleplayer].kartstuff[k_spinouttimer]) // KART: Nice try, but no, you won't be cheesing spb anymore. + { + CONS_Printf(M_GetText("Cannot use this while hurt.\n")); + return; + } if (!(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING)) { From e7d730e3b230d9072fc79543b4b1e725ab31298e Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 20 Jan 2019 18:51:45 +0100 Subject: [PATCH 2/4] prevent the use of respawn to cheese items like SPB --- src/d_netcmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8272b75d..8bedb526 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2489,9 +2489,9 @@ static void Command_Respawn(void) UINT8 *cp = buf; WRITEINT32(cp, consoleplayer); - + if (players[consoleplayer].kartstuff[k_spinouttimer]) // KART: Nice try, but no, you won't be cheesing spb anymore. - { + { CONS_Printf(M_GetText("Cannot use this while hurt.\n")); return; } From 9028783190380b1084e6cbc63fbcd3285a9fec2a Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 26 Jan 2019 17:40:05 +0100 Subject: [PATCH 3/4] Only prevent respawn if spun out in midair and added a Got_Respawn check to kick cheaters --- src/d_netcmd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8bedb526..41886d70 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2490,18 +2490,18 @@ static void Command_Respawn(void) WRITEINT32(cp, consoleplayer); - if (players[consoleplayer].kartstuff[k_spinouttimer]) // KART: Nice try, but no, you won't be cheesing spb anymore. - { - CONS_Printf(M_GetText("Cannot use this while hurt.\n")); - return; - } - if (!(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING)) { CONS_Printf(M_GetText("You must be in a level to use this.\n")); return; } + if (players[consoleplayer].kartstuff[k_spinouttimer] && !P_IsObjectOnGround(players[consoleplayer].mo)) // KART: Nice try, but no, you won't be cheesing spb anymore. + { + CONS_Printf(M_GetText("Cannot use this while hurt.\n")); + return; + } + /*if (!G_RaceGametype()) // srb2kart: not necessary, respawning makes you lose a bumper in battle, so it's not desirable to use as a way to escape a hit { CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n")); @@ -2523,8 +2523,8 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum) { INT32 respawnplayer = READINT32(*cp); - // You can't respawn someone else. Nice try, there. - if (respawnplayer != playernum) // srb2kart: "|| (!G_RaceGametype())" + // You can't respawn someone else or cheat your way by removing the send checks above :) Nice try, there. + if ((respawnplayer != playernum) || (players[respawnplayer].mo && players[respawnplayer].kartstuff[k_spinouttimer] && !P_IsObjectOnGround(players[respawnplayer].mo))) // srb2kart: "|| (!G_RaceGametype())" { CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]); if (server) From f8fd2c5190962f424fc0db84fabbc22f28104038 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 26 Jan 2019 19:40:12 +0100 Subject: [PATCH 4/4] Changed condition to being mid-air, changed print and changed the kick to a return --- src/d_netcmd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 41886d70..a015b8e7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2496,9 +2496,9 @@ static void Command_Respawn(void) return; } - if (players[consoleplayer].kartstuff[k_spinouttimer] && !P_IsObjectOnGround(players[consoleplayer].mo)) // KART: Nice try, but no, you won't be cheesing spb anymore. + if (players[consoleplayer].mo && !P_IsObjectOnGround(players[consoleplayer].mo)) // KART: Nice try, but no, you won't be cheesing spb anymore. { - CONS_Printf(M_GetText("Cannot use this while hurt.\n")); + CONS_Printf(M_GetText("You must be on the floor to use this.\n")); return; } @@ -2523,8 +2523,8 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum) { INT32 respawnplayer = READINT32(*cp); - // You can't respawn someone else or cheat your way by removing the send checks above :) Nice try, there. - if ((respawnplayer != playernum) || (players[respawnplayer].mo && players[respawnplayer].kartstuff[k_spinouttimer] && !P_IsObjectOnGround(players[respawnplayer].mo))) // srb2kart: "|| (!G_RaceGametype())" + // You can't respawn someone else. Nice try, there. + if (respawnplayer != playernum) // srb2kart: "|| (!G_RaceGametype())" { CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]); if (server) @@ -2538,6 +2538,10 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum) return; } + // incase the above checks were modified to allow sending a respawn on these occasions: + if (players[respawnplayer].mo && !P_IsObjectOnGround(players[respawnplayer].mo)) + return; + if (players[respawnplayer].mo) P_DamageMobj(players[respawnplayer].mo, NULL, NULL, 10000); }