diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index f5fea366fe73cc0d0c80004429cbe370588fe8c2..a4e1ba423aada0fee1d6cca9185ff285026ffb88 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -2513,7 +2513,7 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
 #ifdef HAVE_BLUA
 		// Call ViewpointSwitch hooks here.
 		// The viewpoint was forcibly changed.
-		LUAh_ViewpointSwitch(&players[consoleplayer], &players[displayplayer], true);
+		LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
 #endif
 		displayplayer = consoleplayer;
 	}
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index c25929929a2e46fe840253dcc965b48f973d4a4e..95cb9291f05ebe24bf989a90b9c82f8f79460a54 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -2843,7 +2843,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
 		// Call ViewpointSwitch hooks here.
 		// The viewpoint was forcibly changed.
 		if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
-			LUAh_ViewpointSwitch(&players[playernum], &players[displayplayer], true);
+			LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
 #endif
 		displayplayer = consoleplayer;
 	}
@@ -3753,11 +3753,11 @@ static void ExitMove_OnChange(void)
 			{
 				if (players[i].mo->target && players[i].mo->target->type == MT_SIGN)
 					P_SetTarget(&players[i].mo->target, NULL);
-				
+
 				if (players[i].pflags & PF_FINISHED)
 					P_GiveFinishFlags(&players[i]);
 			}
-			
+
 		CONS_Printf(M_GetText("Players can now move after completing the level.\n"));
 	}
 	else
diff --git a/src/g_game.c b/src/g_game.c
index 08192bfb8b82247a0f3c391fb97a143a32f5eb2b..3eeb2fa2b34714319175f331cc755f1a83b4c28d 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1718,7 +1718,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
 #ifdef HAVE_BLUA
 		// Call ViewpointSwitch hooks here.
 		// The viewpoint was forcibly changed.
-		LUAh_ViewpointSwitch(player, &players[displayplayer], true);
+		LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
 #endif
 		displayplayer = consoleplayer;
 	}
diff --git a/src/p_user.c b/src/p_user.c
index 880d932af85e7b22025f63c81bab5b8ae12e4296..9b0be6e535fecbbb34e3307b56076a2be6add928 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -392,7 +392,7 @@ void P_GiveFinishFlags(player_t *player)
 		mobj_t* flag = P_SpawnMobjFromMobj(player->mo, xoffs, yoffs, 0, MT_FINISHFLAG);
 		flag->angle = angle;
 		angle += FixedAngle(120*FRACUNIT);
-		
+
 		P_SetTarget(&flag->target, player->mo);
 	}
 }
@@ -10650,7 +10650,7 @@ boolean P_SpectatorJoinGame(player_t *player)
 #ifdef HAVE_BLUA
 			// Call ViewpointSwitch hooks here.
 			// The viewpoint was forcibly changed.
-			LUAh_ViewpointSwitch(player, &players[displayplayer], true);
+			LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
 #endif
 			displayplayer = consoleplayer;
 		}
@@ -10699,7 +10699,7 @@ boolean P_SpectatorJoinGame(player_t *player)
 #ifdef HAVE_BLUA
 				// Call ViewpointSwitch hooks here.
 				// The viewpoint was forcibly changed.
-				LUAh_ViewpointSwitch(player, &players[displayplayer], true);
+				LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
 #endif
 				displayplayer = consoleplayer;
 			}