forked from Developer-Bear/RNG_FrontDeskPage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver-FrontDeskPage.lua
38 lines (34 loc) · 1.12 KB
/
server-FrontDeskPage.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
local CooldownActive = false
-- Broadcast to all players
RegisterServerEvent('RNG_FrontDeskPage:SendPage')
AddEventHandler('RNG_FrontDeskPage:SendPage', function(location)
if not CooldownActive then
if Config.UseMythicNotify then
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'success', text = _U('successfulPage')})
else
TriggerClientEvent('esx:showNotification', source, _U('successfulPage'))
end
TriggerClientEvent('RNG_FrontDeskPage:Page', -1, location)
if Config.CoolDown ~= 0 then
CooldownTimer()
end
else
if Config.UseMythicNotify then
TriggerClientEvent('mythic_notify:client:SendAlert', source,{ type = 'error', text = _U('recentPage')})
else
TriggerClientEvent('esx:showNotification', source, _U('recentPage'))
end
end
end)
function CooldownTimer()
timeLeft = Config.CoolDown
CooldownActive = true
while true do
Citizen.Wait(60000)
timeLeft = timeLeft - 1
if timeLeft <= 0 then
CooldownActive = false
break
end
end
end