Problema con dialog y condicionales
#1

Hola tengo problemas con mi funcion esta no funciona como quiero.

Lo que quiero es que; Compruebe la clave del usuario y si es correcta, comprobar si esta baneado, comprobar si es admin y hacer spawn.

Si ingresa la clave incorrecta 3 veces le de kick al usuario, si el usuario es admin lo lleve al dialog "DIALOGO_ADMIN_CLAVE".

pawn Код:
#define LIMITE_INTENTOS_INGRESO 3 // Intentos de clave

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case DIALOGO_INGRESAR:
        {
            new string[256];
            if (!response) return Kick(playerid);
            if(!strlen(inputtext))
            {
                format(string, sizeof(string), "{FFFFFF}Hola, %s!\n\nBienvenido de nuevo a {D69929}Servidor Roleplay{FFFFFF}.\nPor favor ingrese su clave para ingresar.", NombreLimpio(playerid));
                ShowPlayerDialog(playerid, DIALOGO_INGRESAR, DIALOG_STYLE_PASSWORD, "{00C6FF}› Bienvenido, ingrese su clave", string, "Ingresar", "Cancelar");
            }
            if (!strcmp(inputtext, JugadorInfo[playerid][Clave]))
            {
                if (JugadorInfo[playerid][Baneado] == 1)
                {
                    LimpiarChat(playerid);
                    SendClientMessage(playerid, COLOR_NARANJA, "Has sido kickeado automбticamente. (Razуn: Tu nombre de usuario se encuentra baneado)");
                    KickJugador(playerid);
                    return 1;
                }
                if (JugadorInfo[playerid][Admin] > 0)
                {
                    ShowPlayerDialog(playerid, DIALOGO_ADMIN_CLAVE, DIALOG_STYLE_PASSWORD, "Seguridad Administrativa", "Por favor ingrese su clave administrativa", "Continuar", "Cancelar");
                }
                else if (JugadorInfo[playerid][Admin] == 0)
                {
                    format(string, sizeof(string), "SERVIDOR: Bienvenido %s.", NombreLimpio(playerid));
                    SendClientMessage(playerid, COLOR_BLANCO, string);
                    JugadorLogueado[playerid] = 1;
                }
            }
            else
            {
                SetPVarInt(playerid, "IntentosIngreso", GetPVarInt(playerid, "IntentosIngreso") +1 );
                format(string, sizeof(string), " La contraseсa introducida es incorrecta. (%d/%d)", GetPVarInt(playerid, "IntentosIngreso"), LIMITE_INTENTOS_INGRESO);
                SendClientMessage(playerid, COLOR_GRIS, string);
                if (GetPVarInt(playerid, "IntentosIngreso") == LIMITE_INTENTOS_INGRESO)
                {
                    SendClientMessage(playerid, COLOR_NARANJA, "Has sido baneado automбticamente. (Razуn: Lнmite de intentos de ingreso)");
                    BanEx(playerid, "Lнmite de intentos de ingreso.");
                    return 1;
                }

                format(string, sizeof(string), "{FFFFFF}Hola, %s!\n\nBienvenido de nuevo a {D69929}Servidor Roleplay{FFFFFF}.\nPor favor ingrese su clave para ingresar.", NombreLimpio(playerid));
                ShowPlayerDialog(playerid, DIALOGO_INGRESAR, DIALOG_STYLE_PASSWORD, "{00C6FF}› Bienvenido, ingrese su clave", string, "Ingresar", "Cancelar");
            }
        }
        case DIALOGO_ADMIN_CLAVE:
        {
            new string[256];
            if(!strlen(inputtext) || strval(inputtext) == 0)
            {
                ShowPlayerDialog(playerid, DIALOGO_ADMIN_CLAVE, DIALOG_STYLE_PASSWORD, "Seguridad Administrativa", "Por favor ingrese su clave administrativa", "Continuar", "Cancelar");
            }
            if(strval(inputtext) == JugadorInfo[playerid][AdminClave])
            {
                format(string, sizeof(string), "SERVIDOR: Bienvenido %s.", NombreLimpio(playerid));
                SendClientMessage(playerid, COLOR_BLANCO, string);
                JugadorLogueado[playerid] = 1;
                format(string, sizeof(string), "Te has identificado como Administrador.");
                SendClientMessage(playerid, COLOR_BLANCO, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_NARANJA, "Has sido kickeado automбticamente. (Razуn: Clave de administracion invalida)");
                KickJugador(playerid);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Problema con dialog y condicionales - by YazukiAkira - 07.07.2014, 01:58
Re: Problema con dialog y condicionales - by YazukiAkira - 07.07.2014, 03:19

Forum Jump:


Users browsing this thread: 1 Guest(s)