Skip to content

Commit

Permalink
fix encoders.Player, userid can grow so high so it's better to use En…
Browse files Browse the repository at this point in the history
…tity index
  • Loading branch information
Srlion committed Oct 27, 2024
1 parent 7945a84 commit 78016d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sfs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ do
write_u16(buf, Entity_EntIndex(ent))
end

local Player_UserID = FindMetaTable and FindMetaTable("Player").UserID
-- range between 1 and 128 for players, so we can safely use uint8
encoders.Player = function(buf, ply)
write_byte(buf, PLAYER)
write_u8(buf, Player_UserID(ply))
write_u8(buf, Entity_EntIndex(ply))
end

local Vector_Unpack = FindMetaTable and FindMetaTable("Vector").Unpack
Expand Down Expand Up @@ -1326,5 +1326,5 @@ return {
end,

chars = chars,
VERSION = "3.0.1"
VERSION = "3.0.2"
}

0 comments on commit 78016d6

Please sign in to comment.