NDCore = exports["ND_Core"]:GetCoreObject()
NDCore.Functions.VersionChecker("ND_Chat", GetCurrentResourceName(), "https://github.com/Andyyy7666/ND_Framework", "https://raw.githubusercontent.com/Andyyy7666/ND_Framework/main/ND_Chat/fxmanifest.lua")
if config["/me"] then
RegisterCommand("me", function(source, args, rawCommand)
local player = source
local players = NDCore.Functions.GetPlayers()
local playerCoords = GetEntityCoords(GetPlayerPed(player))
for serverPlayer, _ in pairs(players) do
local targetCoords = GetEntityCoords(GetPlayerPed(serverPlayer))
if (#(playerCoords - targetCoords) < 20.0) then
TriggerClientEvent("chat:addMessage", serverPlayer, {
color = {255, 0, 0},
args = {"^*ME | ^0" .. players[player].firstName .. " " .. players[player].lastName .. " (#" .. player .. ")", table.concat(args, " ")}
})
end
end
end, false)
end
if config["/gme"] then
RegisterCommand("gme", function(source, args, rawCommand)
local player = source
local players = NDCore.Functions.GetPlayers()
TriggerClientEvent("chat:addMessage", -1, {
color = {255, 0, 0},
args = {"^*GME | ^0" .. players[player].firstName .. " " .. players[player].lastName .. " (#" .. player .. ")", table.concat(args, " ")}
})
end, false)
end
if config["/ooc"] then
RegisterCommand("ooc", function(source, args, rawCommand)
local player = source
TriggerClientEvent("chat:addMessage", -1, {
color = {150, 150, 150},
args = {"^*OOC | ^0" .. GetPlayerName(player) .. " (#" .. player .. ")", table.concat(args, " ")}
})
end, false)
end
if config["/twt"] then
RegisterCommand("twt", function(source, args, rawCommand)
local player = source
local players = NDCore.Functions.GetPlayers()
TriggerClientEvent("chat:addMessage", -1, {
template = "
{0}: {1}",
multiline = true,
args = {"^4@" .. players[player].twt .. " (#" .. player .. ")", table.concat(args, " ")}
})
end, false)
end
if config["pay"] then
RegisterCommand("pay", function(source, args, rawCommand)
local player = source
local target = tonumber(args[1])
local amount = tonumber(args[2])
if target and amount ~= nil then
NDCore.Functions.TransferBank(amount, player, target)
else
-- Wrong syntax, it's /pay
TriggerClientEvent('chatMessage', source, '^1ERROR: Wrong usage. /pay ')
end
end, false)
end
if config["give"] then
RegisterCommand("give", function(source, args, rawCommand)
local player = source
local amount = tonumber(args[1])
if amount ~= nil then
NDCore.Functions.GiveCashToNearbyPlayer(player, amount)
else
-- Wrong syntax, it's /give
TriggerClientEvent('chatMessage', source, '^1ERROR: Wrong usage. /give ')
end
end, false)
end
function hasDarkWebPermission(player, players, args)
for _, department in pairs(config["/darkweb"].canNotSee) do
if players[player].job == department then
TriggerClientEvent("chat:addMessage", player, {
color = {255, 0, 0},
args = {"^*Error", players[player].job .. " cannot access this command."}
})
return false
end
end
for serverPlayer, playerInfo in pairs(players) do
for _, department in pairs(config["/darkweb"].canNotSee) do
if playerInfo.job == department then
return false
end
end
TriggerClientEvent("chat:addMessage", serverPlayer, {
color = {0, 0, 0},
args = {"^*Dark web | ^0Anonymous (#" .. player .. ")", table.concat(args, " ")}
})
end
end
if config["/darkweb"].enabled then
RegisterCommand("darkweb", function(source, args, rawCommand)
local player = source
local players = NDCore.Functions.GetPlayers()
hasDarkWebPermission(player, players, args)
end, false)
end
if config["/911"].enabled then
RegisterCommand("911", function(source, args, rawCommand)
local player = source
TriggerClientEvent("ND_Chat:911", -1, GetEntityCoords(GetPlayerPed(player)), table.concat(args, " "))
end, false)
end