111111
112112local function AdvDupe2_ReceiveFile (len , ply )
113113 if (not IsValid (ply ))then return end
114-
115- if ply .AdvDupe2 .Uploading then
116- umsg .Start (" AdvDupe2_UploadRejected" , ply )
117- umsg .Bool (false )
118- umsg .End ()
119- AdvDupe2 .Notify (ply , " Duplicator is Busy!" ,NOTIFY_ERROR ,5 )
120- return
121- end
122-
123- ply .AdvDupe2 .Uploading = true
124- AdvDupe2 .InitProgressBar (ply , " Opening: " )
125-
114+
126115 local name = net .ReadString ()
127116 local _1 , _2 , _3 = string.find (name , " ([%w_]+)" )
128117 if _3 then
@@ -131,13 +120,23 @@ local function AdvDupe2_ReceiveFile(len, ply)
131120 ply .AdvDupe2 .Name = " Advanced Duplication"
132121 end
133122
134- net .ReadStream (ply , function (data )
135- AdvDupe2 .LoadDupe (ply , AdvDupe2 .Decode (data ))
123+ local stream = net .ReadStream (ply , function (data )
124+ if data then
125+ AdvDupe2 .LoadDupe (ply , AdvDupe2 .Decode (data ))
126+ else
127+ AdvDupe2 .Notify (ply , " Duplicator Upload Failed!" , NOTIFY_ERROR , 5 )
128+ end
136129 ply .AdvDupe2 .Uploading = false
137-
138- umsg .Start (" AdvDupe2_UploadRejected" , ply )
139- umsg .Bool (true )
140- umsg .End ()
141130 end )
131+
132+ if ply .AdvDupe2 .Uploading then
133+ if stream then
134+ stream :Remove ()
135+ end
136+ AdvDupe2 .Notify (ply , " Duplicator is Busy!" , NOTIFY_ERROR , 5 )
137+ elseif stream then
138+ ply .AdvDupe2 .Uploading = true
139+ AdvDupe2 .InitProgressBar (ply , " Opening: " )
140+ end
142141end
143142net .Receive (" AdvDupe2_ReceiveFile" , AdvDupe2_ReceiveFile )
0 commit comments