-
Notifications
You must be signed in to change notification settings - Fork 1
/
sh_discordadvert.lua
50 lines (42 loc) · 1.67 KB
/
sh_discordadvert.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
local PLUGIN = PLUGIN
PLUGIN.name = "Discord Reminder"
PLUGIN.description = "Discord Invite Reminder"
PLUGIN.author = "eon (bloodycop)"
--[[------------------------------------------------
PLUGIN CONFIGURATION
----------------------------------------------------]]
PLUGIN.discord = "" -- Permanent Discord Invite Link
PLUGIN.serverName = "" -- Name of your server
ix.lang.AddTable("english", {
optdiscordReminder = "Discord Reminder"
})
ix.config.Add("discordReminder", true, "Should the discord reminder function.", nil, {
category = PLUGIN.name
})
if ( SERVER ) then
util.AddNetworkString("SchemaDiscordAdvert")
function Schema:MakeAnnouncement(text)
net.Start("SchemaDiscordAdvert")
net.WriteString(text)
net.Broadcast()
end
if not ( timer.Exists("SchemaDiscordAdvertTimer") ) then
timer.Create("SchemaDiscordAdvertTimer", math.random(120, 360), 0, function()
if ( ix.config.Get("discordReminder", false) ) then
Schema:MakeAnnouncement("Please make sure to join our discord! " .. PLUGIN.discord)
end
end)
else
timer.Remove("SchemaDiscordAdvertTimer")
timer.Create("SchemaDiscordAdvertTimer", math.random(120, 360), 0, function()
if ( ix.config.Get("discordReminder", false) ) then
Schema:MakeAnnouncement("Please make sure to join our discord! " .. PLUGIN.discord)
end
end)
end
else
net.Receive("SchemaDiscordAdvert", function(len)
local txt = net.ReadString() or ""
chat.AddText(ix.config.Get("color"), PLUGIN.serverName .. " Announcement", color_white, ": " .. txt)
end)
end