Update 19.06.2021

This commit is contained in:
ENoir420
2021-06-19 13:49:16 +02:00
parent 6831a026cb
commit a8cb3cb554
6 changed files with 65 additions and 217 deletions

View File

@@ -24,11 +24,11 @@ exports('discord', function(message, id, id2, color, channel)
local _message = message
if message == nil then print("^1Error: Enoir Export. Invalid message.^0") return end
if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir Export. Invalid player id.^0") return end
if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir Export. Invalid second player id.^0") return end
if color == nil then print("^1Error: ENoir Export. Invalid color.^0") return end
if channel == nil or channel == "" then print("^1Error: ENoir Export. Invalid channel.^0") return end
if message == nil then print("^1Error: ENoir_Logs Export. Invalid message.^0") return end
if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir_Logs Export. Invalid player id.^0") return end
if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir_Logs Export. Invalid second player id.^0") return end
if color == nil then print("^1Error: ENoir_Logs Export. Invalid color.^0") return end
if channel == nil or channel == "" then print("^1Error: ENoir_Logs Export. Invalid channel.^0") return end
if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end
@@ -390,31 +390,30 @@ end
AddEventHandler("playerConnecting", function(name, setReason, deferrals)
SinglePlayerLogs('**' ..GetPlayerName(source).. '** si sta collegando al server.', Config.BaseColors['Connessione'], source, 'Connessione')
SinglePlayerLogs('**' ..GetPlayerName(source).. '** si sta connettendo al server.', Config.BaseColors['Connessione'], source, 'Connessione')
end)
AddEventHandler('playerDropped', function(reason)
SinglePlayerLogs('**' ..GetPlayerName(source).. '** è uscito dal server. (Reason: ' .. reason .. ')', Config.BaseColors['Uscita'], source, 'Uscita')
SinglePlayerLogs('**' ..GetPlayerName(source).. '** ha quittato il server. (Reason: ' .. reason .. ')', Config.BaseColors['Disconnesso'], source, 'Disconnesso')
end)
-- Send message when Player creates a chat message (Does not show commands)
AddEventHandler('chatMessage', function(source, name, msg)
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '**: `' .. msg..'`', Config.BaseColors['chat'], source, 'chat')
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** ha scritto in chat `' .. msg..'`', Config.BaseColors['chat'], source, 'chat')
end)
-- Send message when Player died (including reason/killer check) (Not always working)
RegisterServerEvent('playerDied')
AddEventHandler('playerDied',function(id,player,killer,DeathReason, Weapon)
if Weapon == nil then _Weapon = "" else _Weapon = "`"..Weapon.."`" end
if id == 1 then -- Suicide/died
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** `'..DeathReason..'` '.._Weapon, Config.BaseColors['deaths'], source, 'deaths') -- sending to deaths channel
elseif id == 2 then -- Killed by other player
DualPlayerLogs('**' .. GetPlayerName(killer) .. '** è stato ucciso da'..DeathReason..' ' .. GetPlayerName(source).. ' `('.._Weapon..')`', Config.BaseColors['deaths'], killer, source, 'deaths')
else -- When gets killed by something else
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** `died`', Config.BaseColors['deaths'], source, 'deaths') -- sending to deaths channel
if id == 1 then
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** si è suicidato per colpa di '.._Weapon, Config.BaseColors['morte/suicidio'], source, 'morte/suicidio')
elseif id == 2 then
DualPlayerLogs('**' .. GetPlayerName(killer) .. '** è stato ucciso da ' .. GetPlayerName(source).. ' `('.._Weapon..')`', Config.BaseColors['morte/suicidio'], killer, source, 'morte/suicidio')
else
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** `è morto per colpa di`', Config.BaseColors['morte/suicidio'], source, 'morte/suicidio')
end
end)
@@ -423,7 +422,7 @@ RegisterServerEvent('playerShotWeapon')
AddEventHandler('playerShotWeapon', function(weapon)
local info = GetPlayerDetails(source)
if Config.weaponLog then
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** a sparato con `' .. weapon .. '`', Config.BaseColors['shooting'], source, 'shooting')
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** ha sparato con `' .. weapon .. '`', Config.BaseColors['shooting'], source, 'shooting')
end
end)
@@ -432,11 +431,11 @@ RegisterServerEvent('ClientDiscord')
AddEventHandler('ClientDiscord', function(message, id, id2, color, channel)
local _message = message
if message == nil then print("^1Error: ENoir Export. Invalid message.^0") return end
if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir Export. Invalid player id.^0") return end
if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir Export. Invalid second player id.^0") return end
if color == nil then print("^1Error: ENoir Export. Invalid color.^0") return end
if channel == nil or channel == "" then print("^1Error: ENoir Export. Invalid channel.^0") return end
if message == nil then print("^1Error: ENoir_Logs Export. Invalid message.^0") return end
if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir_Logs Export. Invalid player id.^0") return end
if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir_Logs Export. Invalid second player id.^0") return end
if color == nil then print("^1Error: ENoir_Logs Export. Invalid color.^0") return end
if channel == nil or channel == "" then print("^1Error: Enoir_Logs Export. Invalid channel.^0") return end
if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end
@@ -454,13 +453,13 @@ end)
AddEventHandler('onResourceStop', function (resourceName)
HidePlayerDetails('** è stata stoppata la seguente risorsa' '**' .. resourceName .. , Config.BaseColors['risorse server'], 'risorse server')
HidePlayerDetails('**' .. resourceName .. '** è stata stoppata.', Config.BaseColors['resources'], 'resources')
end)
AddEventHandler('onResourceStart', function (resourceName)
Wait(100)
HidePlayerDetails('** è stata startata la seguente risorsa' '**' .. resourceName .. , Config.BaseColors['risorse server'], 'risorse server')
HidePlayerDetails('**' .. resourceName .. '** è stata startata.', Config.BaseColors['resources'], 'resources')
end)
function GetPlayerDetails(src)
@@ -549,4 +548,3 @@ end
function firstToUpper(str)
return (str:gsub("^%l", string.upper))
end