修复其他玩家进房check是否已存在的时候因为访问不存在的玩家而报错

This commit is contained in:
MrZ_26
2022-11-05 22:59:21 +08:00
parent cb7d3afdfb
commit 267e2dc544
2 changed files with 4 additions and 1 deletions

View File

@@ -650,7 +650,7 @@ function NET.wsCallBack.room_enter(body)
end
else
local p=body.data
if NETPLY.map[p.playerId] then _playerLeaveRoom(p.playerId) end
if NETPLY.exist(p.playerId) then _playerLeaveRoom(p.playerId) end
NETPLY.add{
uid=p.playerId,
group=p.group,

View File

@@ -138,6 +138,9 @@ function NETPLY.remove(uid)
end
end
end
function NETPLY.exist(uid)
return rawget(PLYmap,uid) and true or false
end
function NETPLY.setPlace(uid,place) PLYmap[uid].place=place end
function NETPLY.setStat(uid,S)