Message to all with language include
#1

Hi, Iґm using this language include for my server :
pawn Код:
#include <foreach>
new PlayerLanguage[MAX_PLAYERS] = 0;

stock SetPlayerLanguage(playerid, language)
{
    if(language == 0)
    {
        return PlayerLanguage[playerid] = 0;
    }
    if(language == 1)
    {
        return PlayerLanguage[playerid] = 1;
    }
    return 1;
}

stock ShowLanguageDialog(playerid, dialogid, style, message0[], message1[], message2[], message3[], message4[], message5[], message6[], message7[])
{
        if(PlayerLanguage[playerid] == 0)
        {
                return ShowPlayerDialog(playerid, dialogid, style, message0, message2, message4, message6);
        }
        if(PlayerLanguage[playerid] == 1)
        {
                return ShowPlayerDialog(playerid, dialogid, style, message1, message3, message5, message7);
        }
        return 1;
}

stock ClientLanguageText(playerid, color, const message0[], const message1[])
{
        if(PlayerLanguage[playerid] == 0)
        {
                return SendClientMessage(playerid, color, message0);
        }
        if(PlayerLanguage[playerid] == 1)
        {
                return SendClientMessage(playerid, color, message1);
        }
        return 1;
}

stock ClientLanguageTextToAll(color, const message0[], const message1[])
{
        foreach (Player, i)
        {
            if(PlayerLanguage[i] == 0)
            {
                return SendClientMessage(i, color, message0);
            }
            if(PlayerLanguage[i] == 1)
            {
                return SendClientMessage(i, color, message1);
            }
        }
        return 1;
}

stock GameLanguageText(playerid, const message0[], const message1[], time, style)
{
        if(PlayerLanguage[playerid] == 0)
        {
                return GameTextForPlayer(playerid, message0, time, style);
        }
        if(PlayerLanguage[playerid] == 1)
        {
                return GameTextForPlayer(playerid, message1, time, style);
        }
        return 1;
}

stock GameLanguageTextToAll(const message0[], const message1[], time, style)
{
        foreach (Player, i)
        {
            if(PlayerLanguage[i] == 0)
            {
                return GameTextForPlayer(i, message0, time, style);
            }
            if(PlayerLanguage[i] == 1)
            {
                return GameTextForPlayer(i, message1, time, style);
            }
        }
        return 1;
}
And, if i call command which use ClientLanguageTextToAll or GameLanguageTextToAll, text (or string) will show only for me
Please, can someone find the problem ?
Reply
#2

Don't return in the loop.
pawn Код:
stock ClientLanguageTextToAll(color, const message0[], const message1[])
{
    foreach (Player, i)
    {
        if(PlayerLanguage[i] == 0)
        {
            SendClientMessage(i, color, message0);
        }
        if(PlayerLanguage[i] == 1)
        {
            SendClientMessage(i, color, message1);
        }
    }
    return 1;
}

stock GameLanguageTextToAll(const message0[], const message1[], time, style)
{
    foreach (Player, i)
    {
        if(PlayerLanguage[i] == 0)
        {
            GameTextForPlayer(i, message0, time, style);
        }
        if(PlayerLanguage[i] == 1)
        {
            GameTextForPlayer(i, message1, time, style);
        }
    }
    return 1;
}
Reply
#3

Thanks you very much ! Reputation added to you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)