Skip to content

Commit be5732e

Browse files
author
Dr.Abc
committed
fix listen server playertrace shit game
1 parent afdedf3 commit be5732e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Source/Var/voice_banmgr.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bool CVoiceBanMgr::Init(){
2222
std::ifstream ifs(filename, std::ios::binary);
2323
if (ifs.is_open()) {
2424
while (!ifs.eof()) {
25-
uint64 steamid;
25+
uint64 steamid = 0;
2626
ifs.read(reinterpret_cast<char*>(&steamid), sizeof(uint64));
2727
m_aryBannedPlayer.push_back(steamid);
2828
}

src/Source/playertrace.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,30 @@
55
#include "mathlib/vector.h"
66
#include "mymathlib.h"
77

8+
#include "vguilocal.h"
9+
#include "Viewport.h"
10+
811
#include "playertrace.h"
912

1013
extern cl_enginefunc_t gEngfuncs;
1114

1215
static CPlayerTrace s_PlayerTrace;
1316

1417
void CPlayerTrace::Update(){
18+
if (!g_pViewPort->IsVisible())
19+
return;
1520
auto local = gEngfuncs.GetLocalPlayer();
1621
if (!local)
1722
return;
18-
if (local->player == false) //Íæ¼Ò²»´æÔÚ
19-
return;
2023
//vp
2124
Vector vecAngles;
2225
gEngfuncs.GetViewAngles(vecAngles);
2326
Vector vecForward;
2427
CMathlib::AngleVectors(vecAngles, vecForward, nullptr, nullptr);
2528
Vector vecEnd;
26-
VectorMA(local->origin, 8192, vecForward, vecEnd);
27-
pmtrace_t tr;
2829
Vector vecSrc = local->origin;
30+
VectorMA(vecSrc, 8192, vecForward, vecEnd);
31+
pmtrace_t tr;
2932
Vector vecOfs;
3033
gEngfuncs.pEventAPI->EV_LocalPlayerViewheight(vecOfs);
3134
gEngfuncs.pEventAPI->EV_SetTraceHull(2);

0 commit comments

Comments
 (0)