add sborka
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
net.Receive("AnnounceMessage", function()
|
||||
local msg = net.ReadString()
|
||||
chat.AddText(Color(255, 0, 0), msg)
|
||||
end)
|
||||
|
||||
local eventText = ""
|
||||
local eventTime = 0
|
||||
|
||||
net.Receive("EventMessage", function()
|
||||
eventText = net.ReadString()
|
||||
eventTime = CurTime() + 5 -- show for 5 seconds
|
||||
end)
|
||||
|
||||
function PLUGIN:HUDPaint()
|
||||
if CurTime() < eventTime then
|
||||
surface.SetFont("ixBigFont")
|
||||
local w, h = surface.GetTextSize(eventText)
|
||||
surface.SetTextColor(255, 255, 255)
|
||||
surface.SetTextPos(ScrW() / 2 - w / 2, 50)
|
||||
surface.DrawText(eventText)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
PLUGIN.name = "Event Announce"
|
||||
PLUGIN.author = "Scripty"
|
||||
PLUGIN.description = "/event /annonce"
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
@@ -0,0 +1,21 @@
|
||||
util.AddNetworkString("EventMessage")
|
||||
util.AddNetworkString("AnnounceMessage")
|
||||
|
||||
function PLUGIN:PlayerSay(ply, text)
|
||||
local userGroup = ply:GetUserGroup() or ""
|
||||
if userGroup == "superadmin" or userGroup == "ivent" then
|
||||
if string.StartWith(text, "/event ") then
|
||||
local msg = string.sub(text, 8)
|
||||
net.Start("EventMessage")
|
||||
net.WriteString(msg)
|
||||
net.Broadcast()
|
||||
return ""
|
||||
elseif string.StartWith(text, "/annonce ") then
|
||||
local msg = string.sub(text, 10)
|
||||
net.Start("AnnounceMessage")
|
||||
net.WriteString(msg)
|
||||
net.Broadcast()
|
||||
return ""
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user