HaodongMo / tacrp

3 stars 8 forks source link

Fix for Attachments didn't sync correctly #18

Closed modcrafts closed 5 months ago

modcrafts commented 5 months ago

Fix for Attachments didn't sync correctly when tacrp_free_atts is 0

When tacrp_free_atts is 0, the Attachment of the gun can not be synced correctly

this is because the function SWEP:NetworkWeapon never works

by following the sourcecode of net.ReadEntity()

local wpn = net.ReadEntity()

the wpn will always be Invalid when IsValid(wpn) is false

Changes

just transfer the entIndex instead of the original WriteEntity and use local wpn = Entity(index) to get the weapon everytime

this code is tested and its works for me