This commit is contained in:
EternityDev 2024-04-09 15:49:06 +07:00
parent 739e13537d
commit 8fd9573b8a
3 changed files with 66 additions and 28 deletions

View file

@ -78,18 +78,38 @@ end
function ClientProcess.add(Identifier: any, originId: string)
if not clientQueue[Identifier] then
if not clientRatelimit[Identifier] then
clientRatelimit[Identifier] = RateLimit.create(originId)
end
if not clientQueue[Identifier] then
clientQueue[Identifier] = {}
end
if not unreliableClientQueue[Identifier] then
unreliableClientQueue[Identifier] = {}
end
if not clientRequestQueue[Identifier] then
clientRequestQueue[Identifier] = {}
end
if not clientCallback[Identifier] then
clientCallback[Identifier] = {}
end
if not queueOutRequest[1][Identifier] then
queueOutRequest[1][Identifier] = {}
end
if not queueOutRequest[2][Identifier] then
queueOutRequest[2][Identifier] = {}
end
if not queueInRequest[1][Identifier] then
queueInRequest[1][Identifier] = {}
end
if not queueInRequest[2][Identifier] then
queueInRequest[2][Identifier] = {}
end
if not queueIn[Identifier] then
queueIn[Identifier] = {}
end
end
end
function ClientProcess.logger(Identifier: string, store: boolean, log: boolean)

View file

@ -119,16 +119,34 @@ end
function ServerProcess.add(Identifier: string, originId: string, ratelimit: Type.rateLimitArg)
if not serverQueue[Identifier] then
RateLimit.create(originId, ratelimit.maxEntrance or 200, ratelimit.interval or 2)
if not serverQueue[Identifier] then
serverQueue[Identifier] = {}
end
if not unreliableServerQueue[Identifier] then
unreliableServerQueue[Identifier] = {}
end
if not serverCallback[Identifier] then
serverCallback[Identifier] = {}
end
if not serverRequestQueue[Identifier] then
serverRequestQueue[Identifier] = {}
end
if not queueIn[Identifier] then
queueIn[Identifier] = {}
end
if not queueInRequest[1][Identifier] then
queueInRequest[1][Identifier] = {}
end
if not queueInRequest[2][Identifier] then
queueInRequest[2][Identifier] = {}
end
if not queueOutRequest[1][Identifier] then
queueOutRequest[1][Identifier] = {}
end
if not queueOutRequest[2][Identifier] then
queueOutRequest[2][Identifier] = {}
end
for _, player: Player in ipairs(Players:GetPlayers()) do
task.spawn(initializeEachPlayer, player)

View file

@ -59,55 +59,55 @@ end
function DedicatedBuffer.wi8(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(1)
self:alloc(1)
writei8(self.buffer, self.point, val)
end
function DedicatedBuffer.wi16(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(2)
self:alloc(2)
writei16(self.buffer, self.point, val)
end
function DedicatedBuffer.wi32(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(4)
self:alloc(4)
writei32(self.buffer, self.point, val)
end
function DedicatedBuffer.wu8(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(1)
self:alloc(1)
writeu8(self.buffer, self.point, val)
end
function DedicatedBuffer.wu16(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(2)
self:alloc(2)
writeu16(self.buffer, self.point, val)
end
function DedicatedBuffer.wu32(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(4)
self:alloc(4)
writeu32(self.buffer, self.point, val)
end
function DedicatedBuffer.wf32(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(4)
self:alloc(4)
writef32(self.buffer, self.point, val)
end
function DedicatedBuffer.wf64(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(8)
self:alloc(8)
writef64(self.buffer, self.point, val)
end
function DedicatedBuffer.wstring(self: any, val: string)
if not val then return end
DedicatedBuffer:alloc(#val)
self:alloc(#val)
writestring(self.buffer, self.point, val)
end