РП Команды!

ВАЖНО

Для работы нужно модифицировать файл гейммода, по пути - gamemodes/darkrp/gamemode/modules/base/sv_util.lua

туда вставить

function DarkRP.talkToRange_col(ply, prefixColor, color, PlayerName, Message, size)
    local ents = player.GetHumans()
    local col = team.GetColor(ply:Team())
    local filter = {}

    local plyPos = ply:EyePos()
    local sizeSqr = size * size

    for _, v in ipairs(ents) do
        if (v:EyePos():DistToSqr(plyPos) <= sizeSqr) and (v == ply or hook.Run("PlayerCanSeePlayersChat", PlayerName .. ": " .. Message, false, v, ply) ~= false) then
            table.insert(filter, v)
        end
    end

    if PlayerName == ply:Nick() then PlayerName = "" end -- If it's just normal chat, why not cut down on networking and get the name on the client

    net.Start("DarkRP_Chat")
        net.WriteUInt(prefixColor.r, 8)
        net.WriteUInt(prefixColor.g, 8)
        net.WriteUInt(prefixColor.b, 8)
        net.WriteString(PlayerName)
        net.WriteEntity(ply)
        net.WriteUInt(color.r, 8)
        net.WriteUInt(color.g, 8)
        net.WriteUInt(color.b, 8)
        net.WriteString(Message)
    net.Send(filter)
end

function DarkRP.talkToRange_do(ply, prefixColor, color, PlayerName, Message, size)
    local ents = player.GetHumans()
    local col = team.GetColor(ply:Team())
    local filter = {}

    local plyPos = ply:EyePos()
    local sizeSqr = size * size

    for _, v in ipairs(ents) do
        if (v:EyePos():DistToSqr(plyPos) <= sizeSqr) and (v == ply or hook.Run("PlayerCanSeePlayersChat", PlayerName .. ": " .. Message, false, v, ply) ~= false) then
            table.insert(filter, v)
        end
    end

    if PlayerName == ply:Nick() then PlayerName = "" end -- If it's just normal chat, why not cut down on networking and get the name on the client

    net.Start("DarkRP_Chat")
        net.WriteUInt(prefixColor.r, 8)
        net.WriteUInt(prefixColor.g, 8)
        net.WriteUInt(prefixColor.b, 8)
        net.WriteString(PlayerName)
        net.WriteEntity(ply)
        net.WriteUInt(color.r, 8)
        net.WriteUInt(color.g, 8)
        net.WriteUInt(color.b, 8)
        net.WriteString(Message)
    net.Send(filter)
end

function DarkRP.talkToPerson_col(receiver, col1, text1, col2, col3, text2, sender)
    if not IsValid(receiver) then return end
    if receiver:IsBot() then return end
    local concatenatedText = (text1 or "") .. ": " .. (text2 or "")

    if sender == receiver or hook.Run("PlayerCanSeePlayersChat", concatenatedText, false, receiver, sender) ~= false then
        net.Start("DarkRP_Chat")
            net.WriteUInt(col1.r, 8)
            net.WriteUInt(col1.g, 8)
            net.WriteUInt(col1.b, 8)
            net.WriteString(text1)
        
            sender = sender or Entity(0)
            net.WriteEntity(sender)

            col3 = col3 or color_black
            net.WriteUInt(col3.r, 8)
            net.WriteUInt(col3.g, 8)
            net.WriteUInt(col3.b, 8)
            net.WriteString(text2 or "")
        net.Send(receiver)
    end
end

ТО ЧТО НИЖЕ КЛАДЁМ В ЛЮБУЮ SV ЧАСТЬ!!!

local function looc(ply, args)
    if args == "" then
        DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
        return ""
    end
    local DoSay = function(text)
        if text == "" then
            DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
            return
        end
        local col = team.GetColor(ply:Team())
        DarkRP.talkToRange_col(ply, Color(51,51,51), Color(255,255,255), '[LOOC] ' .. ply:Name() .. " ", text, GAMEMODE.Config.meDistance or 250)
    end
    return args, DoSay
end

local function try(ply, args)
    if args == '' then
        DarkRP.notify(ply, 1, 4, DarkRP.getPhrase('invalid_x', DarkRP.getPhrase('arguments'), ""))
        return ''
    end

    local DoSay = function(text)
        if text == "" then
            DarkRP.notify(ply, 1, 4, DarkRP.getPhrase('invalid_x', DarkRP.getPhrase('arguments'), ''))
            return ""
        end
        local success = math.random(0,1) == 1

        DarkRP.talkToRange_do(ply, Color(80,80,80), Color(255,255,255), "[TRY]: " .. ply:Name() .. " попытался " .. text .. ' [' .. (success and 'Удачно' or 'Неудачно') .. ']', "", GAMEMODE.Config.meDistance or 250)
    end
    return args, DoSay
end

local function roll(ply)
    local DoSay = function(text)
        local roll = math.random(0,100)
        DarkRP.talkToRange_col(ply, Color(51,51,51), Color(255,255,255), '[ROLL] ' .. ply:Name() .. " подбросил кубик и поулчил " .. roll, text, GAMEMODE.Config.meDistance or 250)
    end
    return DoSay
end

local function do_comm(ply, args)
    if args == '' then
        DarkRP.notify(ply, 1, 4, DarkRP.getPhrase('invalid_x', DarkRP.getPhrase("arguments"), ""))
        return ''
    end

    local DoSay = function(text)
        if text == '' then
            DarkRP.notify(ply, 1, 4, DarkRP.getPhrase('invalid_x', DarkRP.getPhrase('arguments'), ''))
            return ''
        end
        DarkRP.talkToRange(ply, text .. ' ('..ply:Name()..')', '', GAMEMODE.Config.meDistance or 250)
    end
    return args, DoSay
end

local function ad(ply, args)
    if args == "" then
        DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
        return ""
    end
    local DoSay = function(text)
        if text == "" then
            DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
            return
        end
        for k,v in pairs(player.GetAll()) do
            local col = team.GetColor(ply:Team())
            DarkRP.talkToPerson_col(v, col, "[AD] " .. ply:Nick(), Color(255,255,255), Color(255, 255, 0, 255), text, ply)
        end
    end
    hook.Call("playerAdverted", nil, ply, args)
    return args, DoSay
end

local function darkweb(ply, args)
    if args == "" then
        DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
        return ""
    end
    local DoSay = function(text)
        if text == "" then
            DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
            return
        end
        for k,v in pairs(player.GetAll()) do
            local col = team.GetColor(ply:Team())
            if GAMEMODE.CivilProtection[v:Team()] then
                DarkRP.talkToPerson_col(v, Color(80,80,80), "[DARKWEB] " .. "Поступило новое сообщение!", Color(255,255,255), Color(120,120,120), "", ply)
            else
                DarkRP.talkToPerson_col(v, Color(80,80,80), "[DARKWEB] " .. ply:Nick(), Color(255,255,255), Color(120,120,120), text, ply)
            end
        end
    end
    hook.Call("playerAdverted", nil, ply, args)
    return args, DoSay
end

DarkRP.defineChatCommand('darkweb', darkweb)
DarkRP.defineChatCommand('ad', ad)
DarkRP.defineChatCommand('roll', roll)
DarkRP.defineChatCommand('try', try)
DarkRP.defineChatCommand('looc', looc)
DarkRP.defineChatCommand('do', do_comm)

надеюсь кому-то помог :slight_smile: