@@ -176,8 +176,10 @@ NET_MESSAGES = {
176
176
local bits = read :ReadWord ()
177
177
write :WriteWord (bits )
178
178
179
- local data = read :ReadBits (bits )
180
- write :WriteBits (data )
179
+ if bits > 0 then
180
+ local data = read :ReadBits (bits )
181
+ write :WriteBits (data )
182
+ end
181
183
182
184
SourceNetMsg (string.format (" clc_Move %i,%i,%i\n " , new , backup , bits ))
183
185
end
@@ -190,8 +192,10 @@ NET_MESSAGES = {
190
192
local bits = read :ReadWord ()
191
193
write :WriteWord (bits )
192
194
193
- local data = read :ReadBits (bits )
194
- write :WriteBits (data )
195
+ if bits > 0 then
196
+ local data = read :ReadBits (bits )
197
+ write :WriteBits (data )
198
+ end
195
199
196
200
SourceNetMsg (string.format (" clc_VoiceData %i\n " , bits ))
197
201
end
@@ -281,8 +285,10 @@ NET_MESSAGES = {
281
285
local length = read :ReadLong ()
282
286
write :WriteLong (length )
283
287
284
- local keyvalues = read :ReadBits (length * 8 )
285
- write :WriteBits (keyvalues )
288
+ if length > 0 then
289
+ local keyvalues = read :ReadBytes (length )
290
+ write :WriteBits (keyvalues )
291
+ end
286
292
287
293
SourceNetMsg (string.format (" clc_CmdKeyValues %i\n " , length ))
288
294
end
@@ -471,8 +477,10 @@ NET_MESSAGES = {
471
477
local bits = read :ReadShort ()
472
478
write :WriteShort (bits )
473
479
474
- local data = read :ReadBits (bits )
475
- write :WriteBits (data )
480
+ if bits > 0 then
481
+ local data = read :ReadBits (bits )
482
+ write :WriteBits (data )
483
+ end
476
484
477
485
SourceNetMsg (string.format (" svc_SendTable %i,%i\n " , encoded , bits ))
478
486
end
@@ -578,8 +586,10 @@ NET_MESSAGES = {
578
586
local bits = read :ReadUInt (20 )
579
587
write :WriteUInt (bits , 20 )
580
588
581
- local data = read :ReadBits (bits )
582
- write :WriteBits (data )
589
+ if bits > 0 then
590
+ local data = read :ReadBits (bits )
591
+ write :WriteBits (data )
592
+ end
583
593
584
594
SourceNetMsg (string.format (" svc_UpdateStringTable tableid=%i,morechanged=%i,changed=%i,bits=%i\n " , tableid , morechanged , changed , bits ))
585
595
end
@@ -612,8 +622,10 @@ NET_MESSAGES = {
612
622
local bits = read :ReadWord ()
613
623
write :WriteWord (bits )
614
624
615
- local voicedata = read :ReadBits (bits )
616
- write :WriteBits (voicedata )
625
+ if bits > 0 then
626
+ local voicedata = read :ReadBits (bits )
627
+ write :WriteBits (voicedata )
628
+ end
617
629
618
630
SourceNetMsg (string.format (" svc_VoiceData client=%i,proximity=%i,bits=%i\n " , client , proximity , bits ))
619
631
end
@@ -642,8 +654,11 @@ NET_MESSAGES = {
642
654
write :WriteUInt (bits , 8 )
643
655
end
644
656
645
- local data = read :ReadBits (bits )
646
- write :WriteBits (data )
657
+
658
+ if bits > 0 then
659
+ local data = read :ReadBits (bits )
660
+ write :WriteBits (data )
661
+ end
647
662
648
663
SourceNetMsg (string.format (" svc_Sounds reliable=%i,num=%i,bits=%i\n " , reliable , num , bits ))
649
664
end
@@ -763,8 +778,10 @@ NET_MESSAGES = {
763
778
local bits = read :ReadUInt (MAX_ENTITYMESSAGE_BITS )
764
779
write :WriteUInt (bits , MAX_ENTITYMESSAGE_BITS )
765
780
766
- local data = read :ReadBits (bits )
767
- write :WriteBits (data )
781
+ if bits > 0 then
782
+ local data = read :ReadBits (bits )
783
+ write :WriteBits (data )
784
+ end
768
785
769
786
SourceNetMsg (string.format (" svc_EntityMessage entity=%i,class=%i,bits=%i\n " , entity , class , bits ))
770
787
end
@@ -777,8 +794,10 @@ NET_MESSAGES = {
777
794
local bits = read :ReadUInt (11 )
778
795
write :WriteUInt (bits , 11 )
779
796
780
- local data = read :ReadBits (bits )
781
- write :WriteBits (data )
797
+ if bits > 0 then
798
+ local data = read :ReadBits (bits )
799
+ write :WriteBits (data )
800
+ end
782
801
783
802
SourceNetMsg (string.format (" svc_GameEvent bits=%i\n " , bits ))
784
803
end
@@ -813,8 +832,10 @@ NET_MESSAGES = {
813
832
local updatebaseline = read :ReadBit ()
814
833
write :WriteBit (updatebaseline )
815
834
816
- local data = read :ReadBits (bits )
817
- write :WriteBits (data )
835
+ if bits > 0 then
836
+ local data = read :ReadBits (bits )
837
+ write :WriteBits (data )
838
+ end
818
839
819
840
SourceNetMsg (string.format (" svc_PacketEntities %i,%i,%i,%i,%i,%i,%i\n " , max , isdelta , delta , baseline , changed , bits , updatebaseline ))
820
841
end
@@ -833,8 +854,10 @@ NET_MESSAGES = {
833
854
local bits = read :ReadVarInt32 ()
834
855
write :WriteVarInt32 (bits )
835
856
836
- local data = read :ReadBits (bits )
837
- write :WriteBits (data )
857
+ if bits > 0 then
858
+ local data = read :ReadBits (bits )
859
+ write :WriteBits (data )
860
+ end
838
861
839
862
SourceNetMsg (string.format (" svc_TempEntities %i,%i\n " , num , bits ))
840
863
end
@@ -861,8 +884,10 @@ NET_MESSAGES = {
861
884
local bytes = read :ReadWord ()
862
885
write :WriteWord (bytes )
863
886
864
- local data = read :ReadBytes (bytes )
865
- write :WriteBytes (data , bytes )
887
+ if bytes > 0 then
888
+ local data = read :ReadBytes (bytes )
889
+ write :WriteBytes (data , bytes )
890
+ end
866
891
867
892
SourceNetMsg (string.format (" svc_Menu menutype=%i,bytes=%i\n " , menutype , bytes ))
868
893
end
@@ -878,8 +903,10 @@ NET_MESSAGES = {
878
903
local bits = read :ReadUInt (20 )
879
904
write :WriteUInt (bits , 20 )
880
905
881
- local data = read :ReadBits (bits )
882
- write :WriteBits (data )
906
+ if bits > 0 then
907
+ local data = read :ReadBits (bits )
908
+ write :WriteBits (data )
909
+ end
883
910
884
911
SourceNetMsg (string.format (" svc_GameEventList num=%i,bits=%i\n " , num , bits ))
885
912
end
@@ -906,8 +933,10 @@ NET_MESSAGES = {
906
933
local length = read :ReadLong ()
907
934
write :WriteLong (length )
908
935
909
- local keyvalues = read :ReadBits (length * 8 )
910
- write :WriteBits (keyvalues )
936
+ if length > 0 then
937
+ local keyvalues = read :ReadBytes (length )
938
+ write :WriteBits (keyvalues )
939
+ end
911
940
912
941
SourceNetMsg (string.format (" svc_CmdKeyValues length=%i\n " , length ))
913
942
end
@@ -942,8 +971,10 @@ NET_MESSAGES = {
942
971
local length = read :ReadUInt (32 )
943
972
write :WriteUInt (length )
944
973
945
- local data = read :ReadBytes (length )
946
- write :WriteBytes (data )
974
+ if length > 0 then
975
+ local data = read :ReadBytes (length )
976
+ write :WriteBytes (data )
977
+ end
947
978
948
979
SourceNetMsg (string.format (" svc_GMod_ServerToClient auto-refresh length=%i,path=%s\n " , length , path ))
949
980
elseif msgtype == 3 then
@@ -952,8 +983,10 @@ NET_MESSAGES = {
952
983
local length = read :ReadUInt (16 )
953
984
write :WriteUInt (length , 16 )
954
985
955
- local data = read :ReadBytes (length )
956
- write :WriteBytes (data )
986
+ if length > 0 then
987
+ local data = read :ReadBytes (length )
988
+ write :WriteBytes (data )
989
+ end
957
990
958
991
SourceNetMsg (string.format (" svc_GMod_ServerToClient GModDataPack::UpdateFile length=%i\n " , length ))
959
992
end
0 commit comments