mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 14:26:03 +01:00
Update server.lua
This commit is contained in:
@@ -10,19 +10,27 @@ function sendToDiscord(name, message, color)
|
|||||||
color = color
|
color = color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PerformHttpRequest(config.discordWebhook, function(err, text, headers) end, 'POST', json.encode({username = "ND Jailing", embeds = embed}), {["Content-Type"] = "application/json"})
|
PerformHttpRequest(server_config.discordWebhook, function(err, text, headers) end, 'POST', json.encode({username = "ND Jailing", embeds = embed}), {["Content-Type"] = "application/json"})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Jail player discord log, trigger the even on the players client and send a message to everyone.
|
-- Jail player discord log, trigger the even on the players client and send a message to everyone.
|
||||||
RegisterNetEvent("ND_Jailing:jailPlayer")
|
RegisterNetEvent("ND_Jailing:jailPlayer")
|
||||||
AddEventHandler("ND_Jailing:jailPlayer", function(id, name, time, reason)
|
AddEventHandler("ND_Jailing:jailPlayer", function(id, name, time, reason)
|
||||||
TriggerClientEvent("ND_Jailing:jailPlayer", id, time)
|
local player = source
|
||||||
sendToDiscord("Jail Logs", "**" .. GetPlayerName(source) .. "** Jailed **" .. name .. "** for **" .. time .. " seconds** with the reason: **" .. reason .. "**.", 1595381)
|
local players = exports["ND_Core"]:getCharacterTable()
|
||||||
TriggerClientEvent('chat:addMessage', -1, {
|
local dept = players[player].dept
|
||||||
color = { 255, 0, 0},
|
for department in pairs(config.accessDepartments) do
|
||||||
multiline = true,
|
if department == dept then
|
||||||
args = {"[Judge]", name .. " was charaged with " .. reason .. " and will be spending " .. time .. " months in jail."}
|
TriggerClientEvent("ND_Jailing:jailPlayer", id, time)
|
||||||
})
|
sendToDiscord("Jail Logs", "**" .. GetPlayerName(source) .. "** Jailed **" .. name .. "** for **" .. time .. " seconds** with the reason: **" .. reason .. "**.", 1595381)
|
||||||
|
TriggerClientEvent('chat:addMessage', -1, {
|
||||||
|
color = { 255, 0, 0},
|
||||||
|
multiline = true,
|
||||||
|
args = {"[Judge]", name .. " was charaged with " .. reason .. " and will be spending " .. time .. " months in jail."}
|
||||||
|
})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Gets all players on the server and adds them to a table.
|
-- Gets all players on the server and adds them to a table.
|
||||||
|
|||||||
Reference in New Issue
Block a user