Skip to content

Commit

Permalink
Added 'involved+admins' and 'involved+superadmins'
Browse files Browse the repository at this point in the history
  • Loading branch information
FPtje committed Dec 13, 2015
1 parent 318d725 commit 94ff9e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gamemode/modules/fadmin/fadmin/messaging/sh_shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local validNotification = tc.assertTable{
hasTarget = tc.assert(tc.optional(isbool), "hasTarget must either be true, false or nil!"),

-- Receivers - optional on the client
receivers = tc.assert(fn.FOr{tc.client, isfunction, tc.oneOf{"everyone", "admins", "superadmins", "self", "targets", "involved"}}, "receivers must either be a function returning a list of players or one of 'admins', 'superadmins', 'everyone', 'self', 'targets', 'involved'"),
receivers = tc.assert(fn.FOr{tc.client, isfunction, tc.oneOf{"everyone", "admins", "superadmins", "self", "targets", "involved", "involved+admins", "involved+superadmins"}}, "receivers must either be a function returning a list of players or one of 'admins', 'superadmins', 'everyone', 'self', 'targets', 'involved', 'involved+admins', 'involved+superadmins'"),
message = tc.assert(fn.FOr{tc.server, tc.tableOf(isstring)}, "The message field must be a table of strings! with special strings 'targets', 'you', 'instigator', 'extraInfo.#', with # a number."),

-- The message type when chat notifications are disabled. NOTIFY by default
Expand Down
4 changes: 3 additions & 1 deletion gamemode/modules/fadmin/fadmin/messaging/sv_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ local receiversToPlayers = {
superadmins = function() return fn.Filter(tc.player.IsSuperAdmin, player.GetAll()) end,
self = fn.Id,
targets = function(_, t) return t end,
involved = function(i, t) local res = table.Copy(istable(t) and t or {t}) table.insert(res, i) return res end
involved = function(i, t) local res = table.Copy(istable(t) and t or {t}) table.insert(res, i) return res end,
["involved+admins"] = function(i, t) return table.Add(receiversToPlayers.admins(i, t), receiversToPlayers.involved(i, t)) end,
["involved+superadmins"] = function(i, t) return table.Add(receiversToPlayers.superadmins(i, t), receiversToPlayers.involved(i, t)) end,
}
function FAdmin.Messages.FireNotification(name, instigator, targets, extraInfo)
local notId = FAdmin.NotificationNames[name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ FAdmin.StartHooks["VoiceMute"] = function()
FAdmin.Messages.RegisterNotification{
name = "voicemute",
hasTarget = true,
receivers = "involved",
receivers = "involved+admins",
writeExtraInfo = function(info) net.WriteUInt(info, 16) end,
}

FAdmin.Messages.RegisterNotification{
name = "voiceunmute",
hasTarget = true,
receivers = "involved",
receivers = "involved+admins",
}

FAdmin.Commands.AddCommand("Voicemute", MuteVoice)
Expand Down

0 comments on commit 94ff9e8

Please sign in to comment.