El cуdigo no funciona correctamente.
#1

Estoy haciendo un sistema de idiomas pero tengo un pequeсo problema.
Cuando usar el comando y estas solo conociendo dicho idioma sale bien pero si hay otra persona cerca y no conoce el idioma a ti te sale idioma desconocido y a el el texto...
їQue falla ?.

pawn Код:
CMD:ejemplo(playerid, params[])
{
    if(PlayerInfo[playerid][pIdiomas][4] == 0)  return SendClientMessage(playerid, Color_Error, "{33CCFF}[ERROR]{FFFFFF} Tu no sabes este idioma.");
    if(sscanf(params,"s[128]",params[0]))       return SendClientMessage(playerid, Color_Info, "[USO] '/ejemplo' [Texto]");
    MandarMensaje(playerid, params[0], 4);
    return 1;
}
pawn Код:
funcion MandarMensaje(Jugador, Texto[], Idioma)
{
    new string[128];
    new string2[128];
    new Float:x, Float:y, Float:z;
    GetPlayerPos(Jugador,x,y,z);
    new Idioma2[10];
    switch(Idioma)
    {
        case 1: Idioma2 = "alemбn";
        case 2: Idioma2 = "бrabe";
        case 3: Idioma2 = "chino";
        case 4: Idioma2 = "espaсol";
        case 5: Idioma2 = "francйs";
        case 6: Idioma2 = "italiano";
        case 7: Idioma2 = "japonйs";
        case 8: Idioma2 = "portuguйs";
        case 9: Idioma2 = "ruso";
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerToPoint(20,i, x, y, z))
            //if(JugadorEnArea(20, i, x, y, z))
            {
                if(PlayerInfo[i][pIdiomas][Idioma] == 1)
                {
                    if(strlen(Texto) > 75)
                    {
                        format(string2,256," ... %s ))",Texto[75]);
                        strdel(Texto,75,strlen(Texto));
                        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
                        ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                        ProxDetector(20.0, i, string2,OOC1,OOC2,OOC3,OOC4,OOC5);
                        return 1;
                    }
                    else if(strlen(Texto) <= 75)
                    {
                        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
                        ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                        return 1;
                    }
                }
                else
                {
                    format(string, sizeof(string), "%s dice: [Lenguaje Desconocido]", NombreEx(Jugador));
                    ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                    return 1;
                }
            }
        }
    }
    return 1;
}
Reply
#2

Proba asн:

pawn Код:
funcion MandarMensaje(Jugador, Texto[], Idioma)
{
    new string[128];
    new string2[128];
    new Float:x, Float:y, Float:z;
    GetPlayerPos(Jugador,x,y,z);
    new Idioma2[10];
    switch(Idioma)
    {
        case 1: Idioma2 = "alemбn";
        case 2: Idioma2 = "бrabe";
        case 3: Idioma2 = "chino";
        case 4: Idioma2 = "espaсol";
        case 5: Idioma2 = "francйs";
        case 6: Idioma2 = "italiano";
        case 7: Idioma2 = "japonйs";
        case 8: Idioma2 = "portuguйs";
        case 9: Idioma2 = "ruso";
    }
    if(strlen(Texto) > 75)
    {
        format(string2,256," ... %s ))",Texto[75]);
        strdel(Texto,75,strlen(Texto));
        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
        ProxDetector(20.0, playerid, string,OOC1,OOC2,OOC3,OOC4,OOC5);
        ProxDetector(20.0, playerid, string2,OOC1,OOC2,OOC3,OOC4,OOC5);
        return 1;
    }
    else if(strlen(Texto) <= 75)
    {
        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
        ProxDetector(20.0, playerid, string,OOC1,OOC2,OOC3,OOC4,OOC5);
        return 1;
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i != playerid)
        {
            if(PlayerToPoint(20,i, x, y, z))
            //if(JugadorEnArea(20, i, x, y, z))
            {
                if(PlayerInfo[i][pIdiomas][Idioma] == 1)
                {
                    if(strlen(Texto) > 75)
                    {
/*                      format(string2,256," ... %s ))",Texto[75]);
                        strdel(Texto,75,strlen(Texto));
                        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);*/

                        ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                        ProxDetector(20.0, i, string2,OOC1,OOC2,OOC3,OOC4,OOC5);
                        return 1;
                    }
                    else if(strlen(Texto) <= 75)
                    {
//                      format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
                        ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                        return 1;
                    }
                }
                else
                {
                    format(string, sizeof(string), "%s dice: [Lenguaje Desconocido]", NombreEx(Jugador));
                    ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                    return 1;
                }
            }
        }
    }
    return 1;
}
Reply
#3

Asн a todo el mundo le sale el mensaje, sabiendo el idioma o no.
Reply
#4

Si, perdуn (olvidй cambiar los ProxDetector en la primera parte). Asн prueba:

pawn Код:
funcion MandarMensaje(Jugador, Texto[], Idioma)
{
    new string[128];
    new string2[128];
    new Float:x, Float:y, Float:z;
    GetPlayerPos(Jugador,x,y,z);
    new Idioma2[10];
    switch(Idioma)
    {
        case 1: Idioma2 = "alemбn";
        case 2: Idioma2 = "бrabe";
        case 3: Idioma2 = "chino";
        case 4: Idioma2 = "espaсol";
        case 5: Idioma2 = "francйs";
        case 6: Idioma2 = "italiano";
        case 7: Idioma2 = "japonйs";
        case 8: Idioma2 = "portuguйs";
        case 9: Idioma2 = "ruso";
    }
    if(strlen(Texto) > 75)
    {
        format(string2,256," ... %s ))",Texto[75]);
        strdel(Texto,75,strlen(Texto));
        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
        SendClientMessage(Jugador, OOC1, string);
        SendClientMessage(Jugador, OOC1, string2);
/*      ProxDetector(20.0, Jugador, string,OOC1,OOC2,OOC3,OOC4,OOC5);
        ProxDetector(20.0, Jugador, string2,OOC1,OOC2,OOC3,OOC4,OOC5);*/

    }
    else if(strlen(Texto) <= 75)
    {
        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
        SendClientMessage(Jugador, OOC1, string);
//      ProxDetector(20.0, Jugador, string,OOC1,OOC2,OOC3,OOC4,OOC5);
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i != Jugador)
        {
            if(PlayerToPoint(20,i, x, y, z))
            //if(JugadorEnArea(20, i, x, y, z))
            {
                if(PlayerInfo[i][pIdiomas][Idioma] == 1)
                {
                    if(strlen(Texto) > 75)
                    {
/*                                            format(string2,256," ... %s ))",Texto[75]);
                        strdel(Texto,75,strlen(Texto));
                        format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);*/

                        ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                        ProxDetector(20.0, i, string2,OOC1,OOC2,OOC3,OOC4,OOC5);
                        return 1;
                    }
                    else if(strlen(Texto) <= 75)
                    {
                        //                      format(string, sizeof(string), "%s dice: [%s] %s", NombreEx(Jugador), Idioma2, Texto);
                        ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                        return 1;
                    }
                }
                else
                {
                    format(string, sizeof(string), "%s dice: [Lenguaje Desconocido]", NombreEx(Jugador));
                    ProxDetector(20.0, i, string,OOC1,OOC2,OOC3,OOC4,OOC5);
                    return 1;
                }
            }
        }
    }
    return 1;
}
Igual ahora que veo, el problema es otro. El problema esta en que estбs cortando el ProxDetector al encontrar el jugador. Lo que tenes que hacer es quitar proxdetector (o modificarlo) y usar mensajes comunes, asн como lo estas haciendo (con proxdetector "original") no se puede hacer lo que quieres hacer.
Reply
#5

Con ese cуdigo solo leo yo lo que escribo, los demбs ni ven el texto ni lo de idioma desconocido.
Reply
#6

Quote:
Originally Posted by Jose_grana
Посмотреть сообщение
Con ese cуdigo solo leo yo lo que escribo, los demбs ni ven el texto ni lo de idioma desconocido.
Si, quitale los return 1 del principio (donde estan los format sin comentario).
Reply
#7

Muchas gracias [J]ulian, el fallo estaba en lo que dijiste, usaba mal el proxdetector.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)