From 4e49c1f80d717b262ce014b3c1e7c3efc8ce8824 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 11 Apr 2021 21:38:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9B=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=89=8D=E6=94=B6=E5=88=B0=E9=83=A8=E5=88=86?= =?UTF-8?q?socket=E6=B6=88=E6=81=AF=E4=BC=9A=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/net.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parts/net.lua b/parts/net.lua index d3d64e9c..7921e2c2 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -385,7 +385,7 @@ function NET.updateWS_play() ready=d.ready, config=d.config, }) - SCN.socketRead("Join",d) + if SCN.socketRead then SCN.socketRead("Join",d)end end elseif res.action==3 then--Player leave if not d.uid then @@ -411,10 +411,10 @@ function NET.updateWS_play() break end end - SCN.socketRead("Leave",d) + if SCN.socketRead then SCN.socketRead("Leave",d)end end elseif res.action==4 then--Player talk - SCN.socketRead("Talk",d) + if SCN.socketRead then SCN.socketRead("Talk",d)end elseif res.action==5 then--Player change settings if tostring(USER.uid)~=d.uid then for i=1,#PLY_NET do @@ -454,8 +454,8 @@ function NET.updateWS_play() NET.wsconn_stream() TASK.new(NET.updateWS_stream) elseif res.action==9 then--Game finished - SCN.socketRead("Finish",d) NET.wsclose_stream() + if SCN.socketRead then SCN.socketRead("Finish",d)end end else WS.alert("play")