Added Auto Message

This commit is contained in:
Cooldude2606
2018-01-05 22:52:11 +00:00
parent 4f144da4cb
commit f633d8485c
3 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
Event.register(-1,function(event)
Server.new_thread{
name='auto-message',
timeout=3240000, -- 3240000 = 15 minutes
reopen=true,
data={
high_rank= 'Owner',
low_rank= 'Regular',
low={
{'auto-message.join-us'},
{'auto-message.discord'},
{'auto-message.website'},
{'auto-message.custom-commands'},
{'auto-message.read-readme'}
}
}
}:on_event('timeout',function(self)
local data = self.data
if not data.high_rank or not data.low_rank
or not data.low then self.reopen = false return end
local _high = Ranking.get_rank(data.high_rank)
local _low = Ranking.get_rank(data.low_rank)
Ranking.print(_high,{'auto-message.players-online',#game.connected_players},nil,true)
Ranking.print(_high,{'auto-message.map-time',tick_to_display_format(game.tick)},nil,true)
for _,line in pairs(data.low) do
Ranking.print(_low,line,nil,true)
end
self.reopen = true
end):on_event('error',function(self,err)
discord_emit{
title='Auto Message Error',
color=Color.to_hex(defines.text_color.bg),
description='Auto Message Error - Closed Thread',
Error=err
}
self.reopen = false
self:close()
end):open()
end)

View File

@@ -20,6 +20,7 @@ end
require('Admin/player-info')
require('Admin/admin') -- used with Guis/admin-gui, but can work without
require('Admin/discord')
require('Admin/auto-message')
-- commands dir
require('Commands/cheat-mode')

View File

@@ -0,0 +1,9 @@
[auto-message]
players-online=There are __1__ players online
map-time=This map has been on for __1__
line-8=Do /help <command> for more info
join-us=Please join us on:
discord=Discord: https://discord.me/explosivegaming
website=Website: explosivegaming.nl
custom-commands=We use custom commands such as /tag and /report
read-readme=Make sure you have read the readme (top left question mark)