Files
2021-12-03 01:19:31 +00:00

16 lines
1.1 KiB
Lua

AddEventHandler('chatMessage', function(source, name, message)
if message == nil or message == '' or message:sub(1, 1) == '/' then return FALSE end
PerformHttpRequest('https://discordapp.com/api/webhooks/547208563680870400/ucatxdILDNy59VSRYYfRY3Qgy1ZjSujraB2hA_-Gy52eUGjF9jVfg5yhue697fMYfTE5', function(err, text, headers) end, 'POST', json.encode({username = name, content = message}), { ['Content-Type'] = 'application/json' })
end)
function sendToDiscord(name, message)
if message == nil or message == '' or message:sub(1, 1) == '/' then return FALSE end
PerformHttpRequest('https://discordapp.com/api/webhooks/547208563680870400/ucatxdILDNy59VSRYYfRY3Qgy1ZjSujraB2hA_-Gy52eUGjF9jVfg5yhue697fMYfTE5', function(err, text, headers) end, 'POST', json.encode({username = name, content = message}), { ['Content-Type'] = 'application/json' })
end
AddEventHandler('playerConnecting', function()
sendToDiscord('SYSTEM', GetPlayerName(source) .. ' has joined. ')
end)
AddEventHandler('playerDropped', function(reason)
sendToDiscord('SYSTEM', GetPlayerName(source) .. ' has left. (' .. reason .. ')')
end)