尝试修复幽灵玩家问题

This commit is contained in:
MrZ626
2021-02-11 16:19:42 +08:00
parent 33ec4897f6
commit ececb31307
2 changed files with 9 additions and 11 deletions

View File

@@ -5,11 +5,14 @@ return{
},
load=function(playerData)
PLY.newPlayer(1)
if playerData[1]then
PLAYERS[1].subID=playerData[1].sid
end
for i=2,#playerData do
PLY.newRemotePlayer(i,false,playerData[i])
local N=2
for i=1,#playerData do
if playerData[i].id==tostring(USER.id)then
PLAYERS[1].subID=playerData[1].sid
else
PLY.newRemotePlayer(N,false,playerData[i])
N=N+1
end
end
end,
}

View File

@@ -165,12 +165,7 @@ function scene.socketRead(mes)
end
for i=1,#args do
local L=splitStr(args[i],",")
L={name=L[1],id=L[2],sid=L[3],conf=L[4],ready=L[5]=="1"}
if tostring(USER.id)~=L.id then
ins(playerData,L)
else
ins(playerData,1,L)
end
ins(playerData,{name=L[1],id=L[2],sid=L[3],conf=L[4],ready=L[5]=="1"})
end
playerInitialized=true
SFX.play("click")