adding new scripts
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
|
||||
|
||||
client_script 'client.lua'
|
||||
|
||||
server_script 'server.lua'
|
||||
@@ -0,0 +1,48 @@
|
||||
local cooldown = 0
|
||||
local ispriority = false
|
||||
local ishold = false
|
||||
|
||||
RegisterCommand("resetpcd", function()
|
||||
TriggerServerEvent("cancelcooldown")
|
||||
end, false)
|
||||
|
||||
RegisterNetEvent('UpdateCooldown')
|
||||
AddEventHandler('UpdateCooldown', function(newCooldown)
|
||||
cooldown = newCooldown
|
||||
end)
|
||||
|
||||
RegisterNetEvent('UpdatePriority')
|
||||
AddEventHandler('UpdatePriority', function(newispriority)
|
||||
ispriority = newispriority
|
||||
end)
|
||||
|
||||
RegisterNetEvent('UpdateHold')
|
||||
AddEventHandler('UpdateHold', function(newishold)
|
||||
ishold = newishold
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
if ishold == true then
|
||||
DrawText2("Priority Cooldown: ~b~Priorities Are On Hold")
|
||||
elseif ispriority == false then
|
||||
DrawText2("Priority Cooldown: ~r~".. cooldown .." ~w~Mins")
|
||||
elseif ispriority == true then
|
||||
DrawText2("Priority Cooldown: ~g~Priority In Progress")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function DrawText2(text)
|
||||
SetTextFont(0)
|
||||
SetTextProportional(1)
|
||||
SetTextScale(0.0, 0.45)
|
||||
SetTextDropshadow(1, 0, 0, 0, 255)
|
||||
SetTextEdge(1, 0, 0, 0, 255)
|
||||
SetTextDropShadow()
|
||||
SetTextOutline()
|
||||
SetTextEntry("STRING")
|
||||
AddTextComponentString(text)
|
||||
DrawText(0.40, 0.10)
|
||||
end
|
||||
@@ -0,0 +1,71 @@
|
||||
-- Config
|
||||
timermax = 10 -- In minutes. Must be one bigger than the max timer you want (Eg if you want 20 it must be 21)
|
||||
|
||||
-- Do not touch
|
||||
cooldown = 0
|
||||
ispriority = false
|
||||
ishold = false
|
||||
|
||||
RegisterCommand("priority", function()
|
||||
TriggerEvent("cooldownt")
|
||||
end, false)
|
||||
|
||||
RegisterCommand("inprogress", function()
|
||||
TriggerEvent('isPriority')
|
||||
end, false)
|
||||
|
||||
RegisterCommand("onhold", function()
|
||||
TriggerEvent('isOnHold')
|
||||
end, false)
|
||||
|
||||
RegisterNetEvent('isPriority')
|
||||
AddEventHandler('isPriority', function()
|
||||
ispriority = true
|
||||
Citizen.Wait(1)
|
||||
TriggerClientEvent('UpdatePriority', -1, ispriority)
|
||||
TriggerClientEvent('chatMessage', -1, "WARNING", {255, 0, 0}, "^1A priority call is in progress. Please do not interfere, otherwise you will be ^1kicked. ^7All calls are on ^3hold ^7until this one concludes.")
|
||||
end)
|
||||
|
||||
RegisterNetEvent('isOnHold')
|
||||
AddEventHandler('isOnHold', function()
|
||||
ishold = true
|
||||
Citizen.Wait(1)
|
||||
TriggerClientEvent('UpdateHold', -1, ishold)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("cooldownt")
|
||||
AddEventHandler("cooldownt", function()
|
||||
if ispriority == true then
|
||||
ispriority = false
|
||||
TriggerClientEvent('UpdatePriority', -1, ispriority)
|
||||
end
|
||||
Citizen.Wait(1)
|
||||
if ishold == true then
|
||||
ishold = false
|
||||
TriggerClientEvent('UpdateHold', -1, ishold)
|
||||
end
|
||||
Citizen.Wait(1)
|
||||
if cooldown == 0 then
|
||||
cooldown = 0
|
||||
cooldown = cooldown + timermax
|
||||
TriggerClientEvent('chatMessage', -1, "WARNING", {255, 0, 0}, "^1A priority call was just conducted. ^3All civilians must wait 20 minutes before conducting another one. ^7Failure to abide by this rule will lead to you being ^1kicked.")
|
||||
while cooldown > 0 do
|
||||
cooldown = cooldown - 1
|
||||
TriggerClientEvent('UpdateCooldown', -1, cooldown)
|
||||
Citizen.Wait(60000)
|
||||
end
|
||||
elseif cooldown ~= 0 then
|
||||
CancelEvent()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("cancelcooldown")
|
||||
AddEventHandler("cancelcooldown", function()
|
||||
Citizen.Wait(1)
|
||||
while cooldown > 0 do
|
||||
cooldown = cooldown - 1
|
||||
TriggerClientEvent('UpdateCooldown', -1, cooldown)
|
||||
Citizen.Wait(100)
|
||||
end
|
||||
|
||||
end)
|
||||
Reference in New Issue
Block a user