Admin Chat помощь с плагином

VSN7

Участник
Сообщения
26
Реакции
4
Здравствуйте господа, проблема такова, файл с переводом не нашёл фразу, как исправить?
C-подобный:
[SM] Exception reported: Language phrase "Team" not found
[SM] Blaming: Admin-Util-Chat.smx
[SM] Call stack trace:
[SM]   [0] Format
[SM]   [1] Line 98, \addons\sourcemod\scripting\Admin-Util-Chat.sp::SendCustomMessage
[SM]   [2] Line 71, \addons\sourcemod\scripting\Admin-Util-Chat.sp::lSayTeam

PHP:
public void OnPluginStart() {
    AddCommandListener(lSay, "say");
    AddCommandListener(lSayTeam, "say_team");

    g_cvDeadTalk = FindConVar("sv_deadtalk");

    LoadTranslations("admin-util-chat.phrases");
}

Action lSay(int iClient, const char[] cCommand, int iArgc) {
    if (!IsValidClient(iClient)) return;

    ArrayList aAdmins = new ArrayList();
    FindSuitableAdmins(aAdmins, ADMFLAG_GENERIC);

    char cMessage[512];
    int iClientAlive = IsPlayerAlive(iClient);

    GetCmdArgString(cMessage, sizeof(cMessage));
    if (strlen(cMessage) <= 2) return;

    cMessage[strlen(cMessage) - 1] = '\0';

    if (g_cvDeadTalk.BoolValue) return;

    for (int i = 0; i < aAdmins.Length; i++) {
        bool bCheckAlive = !iClientAlive && IsPlayerAlive(aAdmins.Get(i));

        if (bCheckAlive) SendCustomMessage(aAdmins.Get(i), iClient, bCheckAlive, false, cMessage[1]);
    }

    delete aAdmins;
}

Action lSayTeam(int iClient, const char[] cCommand, int iArgc) {
    if (!IsValidClient(iClient)) return;

    ArrayList aAdmins = new ArrayList();
    FindSuitableAdmins(aAdmins, ADMFLAG_GENERIC);

    char cMessage[512];
    int iClientAlive = IsPlayerAlive(iClient);
    int iClientTeam = GetClientTeam(iClient);

    GetCmdArgString(cMessage, sizeof(cMessage));
    if (strlen(cMessage) <= 2) return;

    cMessage[strlen(cMessage) - 1] = '\0';

    for (int i = 0; i < aAdmins.Length; i++) {
        bool bCheckAlive = !iClientAlive && IsPlayerAlive(aAdmins.Get(i));
        bool bCheckTeam = iClientTeam != GetClientTeam(aAdmins.Get(i));

        if (bCheckAlive || bCheckTeam) SendCustomMessage(aAdmins.Get(i), iClient, bCheckAlive, bCheckTeam, cMessage[1]);
    }

    delete aAdmins;
}

void FindSuitableAdmins(ArrayList aAdmins, int iFlag) {
    for (int i = 0; i <= MaxClients; i++) {
        if (IsValidClient(i)) {
            if (CheckCommandAccess(i, "", iFlag, true)) {
                aAdmins.Push(i);
            }
        }
    }
}

void SendCustomMessage(int iClient, int iTarget, bool bDeadChat, bool bDiffChat, char[] cMessage) {
    char cBuffer[512];
    char cTargetName[64];

    GetClientName(iTarget, cTargetName, sizeof(cTargetName));
    Format(cBuffer, sizeof(cBuffer), "%s", PLUGIN_PREFIX);

    if (bDeadChat) { Format(cBuffer, sizeof(cBuffer), "%s (\x0F%T\x01)", cBuffer, "Dead", iClient); }

    if (bDiffChat) {
        switch (GetClientTeam(iTarget)) {
            case 1: {
                Format(cBuffer, sizeof(cBuffer), "%s (\x10%T \x0DS.\x01)", cBuffer, "Team", iClient);
            }
            case 2: {
                Format(cBuffer, sizeof(cBuffer), "%s (\x10%T \x07T\x01)", cBuffer, "Team", iClient);
            }
            case 3: {
                Format(cBuffer, sizeof(cBuffer), "%s (\x10%T \x0BCT\x01)", cBuffer, "Team", iClient);
            }
        }
    }

    Format(cBuffer, sizeof(cBuffer), "%s \x09%s\x01: %s", cBuffer, cTargetName, cMessage);
    PrintToChat(iClient, cBuffer);
}

bool IsValidClient(int iClient) {
    if (iClient > 0 && iClient <= MaxClients && IsValidEntity(iClient) && IsClientConnected(iClient) && IsClientInGame(iClient) && !IsFakeClient(iClient)) {
        return true;
    }

    return false;
}
Заранее спасибо
 

Grey83

не пишу плагины с весны 2022
Сообщения
8,560
Реакции
5,063
добавь в файл перевода что-то вроде
PHP:
"Team"
{
    "en"    "Team"
    "ru"    "Команда"
}
 
Сверху Снизу