@@ -419,10 +419,10 @@ void GhostEntity::FollowPov(ViewSetup *view) {
419419 // want to view from; that way, we can avoid the camera clipping
420420 // into a wall
421421
422- void *player = server ->GetPlayer (1 );
422+ void *player = client ->GetPlayer (GET_SLOT () + 1 );
423423 if (!player) return ; // Probably shouldn't ever happen
424424
425- angles = engine->GetAngles (0 );
425+ angles = engine->GetAngles (GET_SLOT () );
426426
427427 CTraceFilterSimple filter;
428428 filter.SetPassEntity (player);
@@ -445,7 +445,7 @@ void GhostEntity::FollowPov(ViewSetup *view) {
445445
446446 CGameTrace tr;
447447
448- engine->TraceRay (engine->engineTrace ->ThisPtr (), ray, MASK_SOLID_BRUSHONLY, &filter, &tr);
448+ engine->TraceRayClient (engine->engineTraceClient ->ThisPtr (), ray, MASK_SOLID_BRUSHONLY, &filter, &tr);
449449
450450 Vector campos = tr.endpos + forward * cam_wall_dist;
451451
@@ -464,7 +464,7 @@ void GhostEntity::StopFollowing() {
464464 r_portalsopenall.SetValue (r_portalsopenall_value);
465465 r_drawviewmodel.SetValue (r_drawviewmodel_value);
466466 crosshairVariable.SetValue (crosshair_value);
467- void *player = server->GetPlayer (1 );
467+ void *player = server->GetPlayer (GET_SLOT () + 1 );
468468 if (player) {
469469 SE (player)->field <int >(" m_fFlags" ) &= ~FL_GODMODE;
470470 SE (player)->field <int >(" m_fFlags" ) &= ~FL_NOTARGET;
@@ -690,12 +690,12 @@ ON_EVENT(PRE_TICK) {
690690 GhostEntity *ghost = GhostEntity::GetFollowTarget ();
691691 if (!ghost) return ;
692692
693- void *player = server->GetPlayer (1 );
693+ void *player = server->GetPlayer (GET_SLOT () + 1 );
694694 if (!player) return ;
695695
696696 // We use ent_setpos to prevent 'setpos into world' errors being
697697 // spewed in console
698- auto cmd = Utils::ssprintf (" ent_setpos 1 %.6f %.6f %.6f" , ghost->data .position .x , ghost->data .position .y , ghost->data .position .z );
698+ auto cmd = Utils::ssprintf (" ent_setpos %d %.6f %.6f %.6f" , GET_SLOT () + 1 , ghost->data .position .x , ghost->data .position .y , ghost->data .position .z );
699699 engine->ExecuteCommand (cmd.c_str ());
700700
701701 // Make sure we have godmode so we can't die while spectating someone
0 commit comments