1+ -- Made by Tazio
2+
3+ local DISCORD_WEBHOOK = " "
4+ local DISCORD_NAME = " System"
5+ -- local DISCORD_IMAGE = "" !coming soon!
6+
7+ -- PerformHttpRequest(DISCORD_WEBHOOK, function(err, text, headers) end, 'POST', json.encode({username = DISCORD_NAME, content = "**Serverlogging is ONLINE**"}), { ['Content-Type'] = 'application/json' })
8+
9+
10+ AddEventHandler (' chatMessage' , function (source , name , message )
11+ PerformHttpRequest (DISCORD_WEBHOOK , function (err , text , headers ) end , ' POST' , json .encode ({username = name , content = message }), { [' Content-Type' ] = ' application/json' })
12+ end )
13+
14+ AddEventHandler (' playerConnecting' , function ()
15+ PerformHttpRequest (DISCORD_WEBHOOK , function (err , text , headers ) end , ' POST' , json .encode ({username = DISCORD_NAME , content = " ```" .. GetPlayerName (source ) .. " connecting ```" }), { [' Content-Type' ] = ' application/json' })
16+ end )
17+
18+ AddEventHandler (' playerDropped' , function (reason )
19+ PerformHttpRequest (DISCORD_WEBHOOK , function (err , text , headers ) end , ' POST' , json .encode ({username = DISCORD_NAME , content = " ```" .. GetPlayerName (source ) .. " left ( " .. reason .. " )```" }), { [' Content-Type' ] = ' application/json' })
20+ end )
21+
22+ RegisterServerEvent (' playerDied' )
23+ AddEventHandler (' playerDied' ,function (killer ,reason )
24+ if killer == " **Invalid**" then -- Can't figure out what's generating invalid, it's late. If you figure it out, let me know. I just handle it as a string for now.
25+ reason = 2
26+ end
27+ if reason == 0 then
28+ -- TriggerClientEvent('showNotification', -1,"~o~".. GetPlayerName(source).."~w~ committed suicide. ")
29+ PerformHttpRequest (DISCORD_WEBHOOK , function (err , text , headers ) end , ' POST' , json .encode ({username = DISCORD_NAME , content = GetPlayerName (source ) .. " committed suicide" }), { [' Content-Type' ] = ' application/json' })
30+ elseif reason == 1 then
31+ -- TriggerClientEvent('showNotification', -1,"~o~".. killer .. "~w~ killed ~o~"..GetPlayerName(source).."~w~.")
32+ PerformHttpRequest (DISCORD_WEBHOOK , function (err , text , headers ) end , ' POST' , json .encode ({username = DISCORD_NAME , content = GetPlayerName (source ) .. " was killed by: " .. killer }), { [' Content-Type' ] = ' application/json' })
33+ else
34+ -- TriggerClientEvent('showNotification', -1,"~o~".. GetPlayerName(source).."~w~ died.")
35+ PerformHttpRequest (DISCORD_WEBHOOK , function (err , text , headers ) end , ' POST' , json .encode ({username = DISCORD_NAME , content = GetPlayerName (source ) .. " died" }), { [' Content-Type' ] = ' application/json' })
36+
37+ end
38+ end )
0 commit comments