mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 22:36:03 +01:00
Update commands.lua
Bug fixes and code improvements
This commit is contained in:
@@ -1,30 +1,65 @@
|
|||||||
------------------------------------------------------------------------
|
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
||||||
------------------------------------------------------------------------
|
|
||||||
-- DO NOT EDIT IF YOU DON'T KNOW WHAT YOU'RE DOING --
|
|
||||||
-- --
|
|
||||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6 --
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
local aop = "Unknown" -- aop unknown if it's not set.
|
|
||||||
playerBank = nil
|
|
||||||
|
|
||||||
-- Aop command events
|
local aop = config.defaultAop
|
||||||
RegisterNetEvent("registerAop")
|
|
||||||
AddEventHandler("registerAop", function(aopRegistered)
|
if config.enableAopCommand then
|
||||||
local player = source
|
local priority = "Priority Status: ~g~Available"
|
||||||
if IsRolePresent(player, "ADMIN") then
|
RegisterNetEvent("getAop")
|
||||||
aop = aopRegistered
|
AddEventHandler("getAop", function()
|
||||||
TriggerClientEvent("setAop", -1, aop)
|
local player = source
|
||||||
else
|
TriggerClientEvent("returnAop", player, aop)
|
||||||
DropPlayer(player, "Tried to use a mod menu to change the aop.")
|
end)
|
||||||
|
RegisterCommand(config.aopCommand, function(source, args, rawCommand)
|
||||||
|
local player = source
|
||||||
|
local canChangeAOP = false
|
||||||
|
for role, _ in pairs(config.canChangeAOP) do
|
||||||
|
if IsRolePresent(player, role, config.canChangeAOP) then
|
||||||
|
canChangeAOP = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if canChangeAOP then
|
||||||
|
aop = string.sub(rawCommand, string.len(config.aopCommand) + 1, string.len(rawCommand))
|
||||||
|
TriggerClientEvent("setAop", -1, aop)
|
||||||
|
else
|
||||||
|
TriggerClientEvent("chat:addMessage", player, {
|
||||||
|
args = {"~r~You don't have permission to set the aop."}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
if config.enablePriorityCooldown then
|
||||||
|
RegisterNetEvent("getPriority")
|
||||||
|
AddEventHandler("getPriority", function() -- update priority
|
||||||
|
local player = source
|
||||||
|
TriggerClientEvent("returnPriority", player, priority)
|
||||||
|
end)
|
||||||
|
RegisterCommand(config.startPriorityCommand, function(source, args, rawCommand) -- start a priority & update.
|
||||||
|
local player = source
|
||||||
|
priority = "Priority Status: ~r~Active ~c~(" .. GetPlayerName(player) .. ")"
|
||||||
|
TriggerClientEvent("returnPriority", -1, priority)
|
||||||
|
end, false)
|
||||||
|
RegisterCommand(config.stopPriorityCommand, function(source, args, rawCommand) -- stop the priority & update.
|
||||||
|
priorityCooldown(config.cooldownAfterPriority)
|
||||||
|
end, false)
|
||||||
|
|
||||||
|
-- Priority count down and updates.
|
||||||
|
function priorityCooldown(time)
|
||||||
|
for cooldown = time, 1, -1 do
|
||||||
|
if cooldown > 1 then
|
||||||
|
priority = "Priority Cooldown: ~c~" .. cooldown .. " minutes"
|
||||||
|
else
|
||||||
|
priority = "Priority Cooldown: ~c~" .. cooldown .. " minute"
|
||||||
|
end
|
||||||
|
TriggerClientEvent("returnPriority", -1, priority)
|
||||||
|
Citizen.Wait(60000)
|
||||||
|
end
|
||||||
|
priority = "Priority Status: ~g~Available"
|
||||||
|
TriggerClientEvent("returnPriority", -1, priority)
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
RegisterNetEvent("getAop")
|
|
||||||
AddEventHandler("getAop", function()
|
|
||||||
local player = source
|
|
||||||
TriggerClientEvent("returnAop", player, aop)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Twotter command
|
-- Twotter command
|
||||||
RegisterCommand("twt", function(source, args, rawCommand)
|
RegisterCommand("twt", function(source, args, rawCommand)
|
||||||
local player = source
|
local player = source
|
||||||
@@ -62,13 +97,22 @@ RegisterCommand("ooc", function(source, args, rawCommand)
|
|||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
-- Darkweb command event
|
-- Darkweb command event
|
||||||
RegisterCommand("darkweb", function(source, args, rawCommand)
|
if config.enableDarkweb then
|
||||||
local player = source
|
RegisterCommand("darkweb", function(source, args, rawCommand)
|
||||||
TriggerClientEvent("chat:addMessage", -1, {
|
local player = source
|
||||||
color = {0, 0, 0},
|
for playerId, playerData in pairs(onlinePlayers) do
|
||||||
args = {"^*Dark web | ^0Anonymous (#" .. player .. ")", string.sub(rawCommand, 8, string.len(rawCommand))}
|
for _, department in pairs(config.canSeeDarkweb) do
|
||||||
})
|
if playerData.dept == department then
|
||||||
end, false)
|
TriggerClientEvent("chat:addMessage", playerId, {
|
||||||
|
color = {0, 0, 0},
|
||||||
|
args = {"^*Dark web | ^0Anonymous (#" .. player .. ")", string.sub(rawCommand, 8, string.len(rawCommand))}
|
||||||
|
})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, false)
|
||||||
|
end
|
||||||
|
|
||||||
-- 911 command event
|
-- 911 command event
|
||||||
RegisterCommand("911", function(source, args, rawCommand)
|
RegisterCommand("911", function(source, args, rawCommand)
|
||||||
|
|||||||
Reference in New Issue
Block a user