mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
55 lines
1.4 KiB
Lua
55 lines
1.4 KiB
Lua
--[[
|
||
| This file was obtained through the combined efforts
|
||
| of Madbluntz & Plymouth Antiquarian Society.
|
||
|
|
||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||
| Maloy, DrPepper10 @ RIP, Atle!
|
||
|
|
||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||
--]]
|
||
|
||
|
||
PLUGIN.name = "Faction Intercoms"
|
||
PLUGIN.author = "Aspect™"
|
||
PLUGIN.description = "Adds faction intercoms."
|
||
|
||
ix.util.Include("sv_hooks.lua")
|
||
|
||
properties.Add("ixChangeIntercomChannel", {
|
||
MenuLabel = "Change Channel",
|
||
Order = 405,
|
||
MenuIcon = "icon16/cog_edit.png",
|
||
|
||
Filter = function(self, entity, client)
|
||
if (entity:GetClass() == "ix_intercom" and CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands", nil)) then return true end
|
||
end,
|
||
|
||
Action = function(self, entity)
|
||
self:MsgStart()
|
||
net.WriteEntity(entity)
|
||
self:MsgEnd()
|
||
end,
|
||
|
||
Receive = function(self, length, client)
|
||
local entity = net.ReadEntity()
|
||
|
||
if (!IsValid(entity)) then return end
|
||
if (!self:Filter(entity, client)) then return end
|
||
|
||
client:RequestString("Change Intercom Channel", "Enter a valid channel to switch to", function(channelID)
|
||
if (!channelID or channelID == "") then return end
|
||
channelID = string.lower(channelID)
|
||
|
||
local channel = ix.radio.channels[channelID]
|
||
if (!channel) then
|
||
client:Notify("Bu geçerli bir kanal değil!")
|
||
|
||
return
|
||
end
|
||
|
||
entity:SetChannel(channelID)
|
||
client:Notify("İnterkom kanalı şu şekilde değiştirildi: " .. channelID)
|
||
end, "")
|
||
end
|
||
})
|