Skip to content

Commit 78800aa

Browse files
committed
Update v1.7.2
* Added MSK.AddTimeout for serverside
1 parent 8835d95 commit 78800aa

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.7
1+
1.7.2

client.lua

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
MSK = {}
22

3-
local Timeouts = {}
4-
local callbackRequest = {}
3+
local Timeouts, callbackRequest = {}, {}
54

65
if Config.Framework:match('esx') then
76
ESX = exports["es_extended"]:getSharedObject()
@@ -101,7 +100,6 @@ MSK.AddTimeout = function(ms, cb)
101100
local requestId = Timeout + 1
102101

103102
SetTimeout(ms, function()
104-
logging('debug', 'Timeouts[requestId]', Timeouts[requestId])
105103
if Timeouts[requestId] then Timeouts[requestId] = nil return end
106104
cb()
107105
end)

fxmanifest.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ games { 'gta5' }
44
author 'Musiker15 - MSK Scripts'
55
name 'msk_core'
66
description 'Core functions for MSK Scripts'
7-
version '1.7'
7+
version '1.7.2'
88

99
lua54 'yes'
1010

server.lua

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
MSK = {}
22

3-
local RegisteredCommands = {}
4-
local Callbacks = {}
3+
local Timeouts, RegisteredCommands, Callbacks = {}, {}, {}
54

65
AddEventHandler('onResourceStart', function(resource)
76
if GetCurrentResourceName() ~= 'msk_core' then
@@ -208,6 +207,24 @@ MSK.logging = function(script, code, ...)
208207
end
209208
end
210209

210+
local Timeout = 0
211+
MSK.AddTimeout = function(ms, cb)
212+
local requestId = Timeout + 1
213+
214+
SetTimeout(ms, function()
215+
if Timeouts[requestId] then Timeouts[requestId] = nil return end
216+
cb()
217+
end)
218+
219+
Timeout = requestId
220+
return requestId
221+
end
222+
223+
MSK.DelTimeout = function(requestId)
224+
if not requestId then return end
225+
Timeouts[requestId] = true
226+
end
227+
211228
MSK.HasItem = function(xPlayer, item)
212229
if not xPlayer then logging('error', 'Player on Function MSK.HasItem does not exist!') return end
213230
if not Config.Framework:match('esx') or Config.Framework:match('qbcore') then

0 commit comments

Comments
 (0)