Как на дрп сделать команды /do и /ad
Как на дрп сделать команды /do и /ad
net.Receive("ad_revamp", function()
local tableread = net.ReadTable()
local nick = tableread.player:Nick()
local ply = LocalPlayer()
local jobc = team.GetColor( ply:Team() )
chat.AddText(Color(255,255,0), "[Реклама] ", jobc, nick, ": ", Color(255, 255, 255, 255), tableread.message)
end)
net.Receive("error_message_revamp", function()
chat.AddText( Color(255,0,0), "[Ошибка] ", Color(255, 255, 255, 255), "Тебе нужно вписать сообщение!" )
end)
if SERVER then
util.AddNetworkString("ad_revamp")
util.AddNetworkString("ano_revamp")
util.AddNetworkString("error_message_revamp")
CONFIG = {}
CONFIG.ADVERT = true
CONFIG.ANO = true
end
hook.Add( "PlayerSay", "CreateAdvert", function( call, text, teamchat )
local args = string.Explode(" ", text)
local argument = string.lower(args[1])
if argument == "/ad" or argument == "/advert" or argument == "/adv" then
if CONFIG.ADVERT == true then
local text = table.concat(args, " ", 2, #args)
if text != "" then
local tablesend = {}
tablesend.player = call
tablesend.message = text
net.Start("ad_revamp")
net.WriteTable(tablesend)
net.Broadcast()
return ""
else
net.Start("error_message_revamp")
net.Send(call)
return ""
end
end
end
end )
concommand.Add("enable_ano", function(ply)
if ply:IsSuperAdmin() then
if CONFIG.ANO == false then
V.ANO = true
ply:PrintMessage(3, "Ano has been enabled")
else
ply:PrintMessage(3, "OOC is already enabled")
end
end
end)
concommand.Add("disable_ano", function(ply)
if ply:IsSuperAdmin() then
if CONFIG.ANO == true then
CONFIG.ANO = false
ply:PrintMessage(3, "Ano has been disabled")
else
ply:PrintMessage(3, "Ano is already disabled")
end
end
end)
addons/script/lua/autorun/Куда это вставлять?