--// C Y L E X.
if GetCurrentResourceName() == "CYLEX_LOGSYSTEM" then
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
--!
local LogAdmin = ""
local LogAmbulance = ""
local LogMecano = ""
local LogPolice = ""
local LogTaxi = ""
local LogVehicleShop = ""
--Discorda mesaj göndermek için gerekli fonksiyon
function sendToDiscord (webhook, name, message, color)
local DiscordWebHook = webhook
local date = os.date('*t')
if date.day < 10 then date.day = '0' .. tostring(date.day) end
if date.month < 10 then date.month = '0' .. tostring(date.month) end
if date.hour < 10 then date.hour = '0' .. tostring(date.hour) end
if date.min < 10 then date.min = '0' .. tostring(date.min) end
if date.sec < 10 then date.sec = '0' .. tostring(date.sec) end
local embeds = {
{
["title"]=message,
["type"]="rich",
["color"] =color,
["footer"]= {
["text"]= "[" .. date.day .. '.' .. date.month .. '.' .. date.year .. ' - ' .. date.hour .. ':' .. date.min .. ':' .. date.sec .. "] made by CYLEX ",
},
}
}
if message == nil or message == '' then return FALSE end
PerformHttpRequest(DiscordWebHook, function(err, text, headers) end, 'POST', json.encode({ username = name,embeds = embeds}), { ['Content-Type'] = 'application/json' })
end
--Meslek logları için
------------------------------------------------------------------------------------------------
function loadLogs()
LogAdmin = LoadResourceFile("cylexLOG", "Logs/admin.log") or ""
LogAmbulance = LoadResourceFile("cylexLOG", "Logs/ambulance.log") or ""
LogVehicleShop = LoadResourceFile("cylexLOG", "Logs/vehicleshop.log") or ""
LogMecano = LoadResourceFile("cylexLOG", "Logs/mecano.log") or ""
LogPolice = LoadResourceFile("cylexLOG", "Logs/police.log") or ""
LogTaxi = LoadResourceFile("cylexLOG", "Logs/taxi.log") or ""
end
sendToDiscord(Config.SistemLogu, "C Y L E X ", "BU LOG SISTEMI CYLEXTARAFINDAN YAPILMISTIR!\n SIZDIRILMASI DURUMUNDA DOSYA KENDİNİ KAPATMAYA AYARLANMISTIR.", Config.orange)
function SaveInLog(job, message)
if job == "admin" then
LogAdmin = LogAdmin .. message .. "\n"
SaveResourceFile("cylexLOG", "Logs/admin.log", LogAdmin, -1)
sendToDiscord(Config.webhookadmin, _U('admin_bot_name'), message, Config.orange)
elseif job == "ambulance" then
LogAmbulance = LogAmbulance .. message .. "\n"
SaveResourceFile("cylexLOG", "Logs/ambulance.log", LogAmbulance, -1)
sendToDiscord(Config.webhookambulance, _U('ambulance_bot_name'), message, Config.orange)
elseif job == "vehicleshop" then
LogVehicleShop = LogVehicleShop .. message .. "\n"
SaveResourceFile("cylexLOG", "Logs/vehicleshop.log", LogVehicleShop, -1)
sendToDiscord(Config.webhookvehicleshop, _U('vehicleshop_bot_name'), message, Config.orange)
elseif job == "mecano" then
LogMecano = LogMecano .. message .. "\n"
SaveResourceFile("cylexLOG", "Logs/mecano.log", LogMecano, -1)
sendToDiscord(Config.webhookmecano, _U('mecano_bot_name'), message, Config.orange)
elseif job == "police" then
LogPolice = LogPolice .. message .. "\n"
SaveResourceFile("cylexLOG", "Logs/police.log", LogPolice, -1)
sendToDiscord(Config.webhookpolice, _U('police_bot_name'), message, Config.orange)
elseif job == "taxi" then
LogTaxi = LogTaxi .. message .. "\n"
SaveResourceFile("cylexLOG", "Logs/taxi.log", LogTaxi, -1)
sendToDiscord(Config.webhooktaxi, _U('taxi_bot_name'), message, Config.orange)
else
print(" " ..job.. "meslegi bilinmiyor.")
end
end
RegisterServerEvent('cylex:AddInLog')
AddEventHandler('cylex:AddInLog', function(job, localetxt, info1, info2, info3, info4)
local _job = job
local _localetxt = localetxt
local _info1 = info1
local _info2 = ''
local _info3 = ''
local _info4 = ''
if info2 ~= nil then
_info2 = info2
end
if info3 ~= nil then
_info3 = info3
end
if info4 ~= nil then
_info4 = info4
end
local message = _U(_localetxt, _info1, _info2, _info3, _info4)
SaveInLog(_job, message)
end)
else
print("=========================================")
print("BU SCRIPT C Y L E X TARAFINDAN YAPILMISTIR")
print("".. GetCurrentResourceName() .. " ISMINI DERHAL CYLEX_LOGSYSTEM OLARAK DEGISTIR!")
print("EGER DEGISTIRMEZSEN SCRIPT CALISMAYACAKTIR!")
print("=========================================")
end