[Ayuda] LuxAdmin /register & /login FAAAIL.
#1

Bueno, asi como lo digo xD.
Ninguno de los dos comandos anda, estan bien definidos y todo.

Les dejo los CMDs a ver si pueden ayudarme!
(PD: Ya solucione lo del admin apenas logueabas )


DIALOGS:
pawn Код:
dcmd_CMD_REGISTER(playerid,params[])
{
    #pragma unused params
   
    if (AccInfo[playerid][LoggedIn] == 1)
    return SendClientMessage(playerid,red,"ERROR: You are already registered and logged in.");
   
    if (udb_Exists(Nickname[playerid]))
    return SendClientMessage(playerid,red,"ERROR: This account already exists") &&
    SendClientMessage(playerid,orange,"Login to access your account ('/"#LoginCommand"').");
   
    new rs2tring[256];
    format(rs2tring,256,"Register new Account: '%s'\n\nEnter the password to Register your Account:",pName(playerid));
    ShowPlayerDialog(playerid,DIALOGID+66,DIALOG_STYLE_INPUT,"Register Account",rs2tring,"Register","Quit");
    return 1;
}
dcmd_CMD_LOGIN(playerid,params[])
{
    #pragma unused params
   
    new file[128];
    format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(Nickname[playerid]) );

    if (AccInfo[playerid][LoggedIn] == 1)
    return SendClientMessage(playerid,red,"ERROR: You are already logged in!.");

    if (!udb_Exists(Nickname[playerid])) return
    SendClientMessage(playerid,red,"ERROR: Account doesn't exist!") &&
    SendClientMessage(playerid,orange,"Register to create your account ('/"#RegisterCommand" [Password]').");
   
    new lstring[256];
    format(lstring,256,"Access Account: %s\n\nTo access your Account, enter your Password below:",pName(playerid));
    ShowPlayerDialog(playerid,DIALOGID+67,DIALOG_STYLE_INPUT,"Login Account",lstring,"Login","Quit");
    return 1;
}
REGISTRO NORMAL:
pawn Код:
dcmd_CMD_REGISTER(playerid,params[])
{
    if (AccInfo[playerid][LoggedIn] == 1)
    return SendClientMessage(playerid,red,"ERROR: You are already registered and logged in.");

    if (udb_Exists(Nickname[playerid]))
    return SendClientMessage(playerid,red,"ERROR: This account already exists") &&
    SendClientMessage(playerid,orange,"Login to access your account ('/"#LoginCommand" [password]').");

    if (strlen(params) == 0)
    return SendClientMessage(playerid,orange,"Usage: '/"#RegisterCommand" [password]'");

    if (strlen(params) < 4 || strlen(params) > 20)
    return SendClientMessage(playerid,red,"ERROR: Your password length must be greater than 3 characters");

    if (udb_Create(Nickname[playerid]))
    {
        new file[256],name[MAX_PLAYER_NAME], buf[145],tmp3[100];
        new strdate[20], year,month,day;
        getdate(year, month, day);
        WP_Hash(buf, sizeof(buf), params);
        GetPlayerName(playerid,name,sizeof(name));

        format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(name));
        GetPlayerIp(playerid,tmp3,100);
        dini_Set(file,"Password",buf);
        dini_Set(file,"Ip",tmp3);
        dUserSetINT(Nickname[playerid]).("Registered",1);
        format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
        dini_Set(file,"RegisteredDate",strdate);
        dUserSetINT(Nickname[playerid]).("Loggedin",1);
        dUserSetINT(Nickname[playerid]).("Banned",0);
        dUserSetINT(Nickname[playerid]).("Level",0);
        dUserSetINT(Nickname[playerid]).("AccountType",0);
        dUserSetINT(Nickname[playerid]).("LastOn",0);
        dUserSetINT(Nickname[playerid]).("Money",0);
        dUserSetINT(Nickname[playerid]).("Kills",0);
        dUserSetINT(Nickname[playerid]).("Deaths",0);
        dUserSetINT(Nickname[playerid]).("WantedLevel",0);
        #if SaveScore == true
        dUserSetINT(Nickname[playerid]).("Score",0);
        #endif
        dUserSetINT(Nickname[playerid]).("Hours",0);
        dUserSetINT(Nickname[playerid]).("Minutes",0);
        dUserSetINT(Nickname[playerid]).("Seconds",0);
        AccInfo[playerid][LoggedIn] = 1;
        AccInfo[playerid][Registered] = 1;
        SendClientMessage(playerid, green, "|- You are now Registered, and have been automaticaly Logged in! -|");
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        return 1;
    }
    return 1;
}
dcmd_CMD_LOGIN(playerid,params[])
{
    new file[128], Pass[256];
    format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(Nickname[playerid]) );

    if (AccInfo[playerid][LoggedIn] == 1)
    return SendClientMessage(playerid,red,"ERROR: You are already logged in!.");

    if (!udb_Exists(Nickname[playerid])) return
    SendClientMessage(playerid,red,"ERROR: Account doesn't exist!") &&
    SendClientMessage(playerid,orange,"Register to create your account ('/"#RegisterCommand" [Password]').");

    if (strlen(params)==0) return
    SendClientMessage(playerid,orange,"Usage: '/"#LoginCommand" [Password]'");

    Pass = dini_Get(file, "Password");
    new buf[145];
    WP_Hash(buf, sizeof(buf), params);

    if(strcmp(Pass, buf, false) == 0)
    {
    new tmp3[100], string[128];
    format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(Nickname[playerid]) );
    GetPlayerIp(playerid,tmp3,100);
    dini_Set(file,"Ip",tmp3);
    LoginPlayer(playerid);
    PlayerPlaySound(playerid,1057,0.0,0.0,0.0);

    if(AccInfo[playerid][Level] > 0)
    {
        switch(AccInfo[playerid][Level])
        {
        case 1: AdmRank = "Basic Moderator";
        case 2: AdmRank = "Moderator";
        case 3: AdmRank = "Master Moderator";
        case 4: AdmRank = "Administrator";
        case 5: AdmRank = "Master Administrator";
        }
        if(AccInfo[playerid][Level] > 5)
        {
            AdmRank = "Professional Admin";
        }
        if(AccInfo[playerid][pVip] > 0)
        {
            switch(AccInfo[playerid][pVip])
            {
            case 1: AccType = "Silver";
            case 2: AccType = "Gold";
            case 3: AccType = "Premium";
            }
            format(string,sizeof(string),"|- You have Successfully Logged! | Account: %s | Level %d - %s -|", AccType, AccInfo[playerid][Level], AdmRank);
            return SendClientMessage(playerid,0x00C378AA,string);
        }
        else
        {
            format(string,sizeof(string),"|- You have Successfully Logged! | Level %d - %s -|", AccInfo[playerid][Level], AdmRank);
            return SendClientMessage(playerid,green,string);
        }
    }
    else
    {
        if(AccInfo[playerid][pVip] > 0)
        {
            switch(AccInfo[playerid][pVip])
            {
            case 1: AccType = "Silver";
            case 2: AccType = "Gold";
            case 3: AccType = "Premium";
            }
            format(string,sizeof(string),"|- You have Successfully logged! | Account: %s -|", AccType);
            return SendClientMessage(playerid,0x00C896AA,string);
        }
        else return SendClientMessage(playerid,green,"|- You have Successfully logged! -|");
        }
    }
    else
    {
        AccInfo[playerid][FailLogin]++;
        printf("LOGIN: Failed Login: %s. Wrong password (%s) (%d)", Nickname[playerid], params, AccInfo[playerid][FailLogin] );
        if(AccInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
        {
        new string[128]; format(string, sizeof(string), "|- Player %s has been automatically kicked (Reason: Many attempts Incorrect Passwords) -|", Nickname[playerid] );
        SendClientMessageToAll(red, string);
        print(string);
        Kick(playerid);
        }
        return SendClientMessage(playerid,red,"ERROR: Login failed! Incorrect Password.");
    }
}
Definiciones:
pawn Код:
#define RegisterCommand    register    // Define the Register Command
#define LoginCommand       login       // Define the Login Command
#define ChangePassCommand  changepass  // Define the ChangePassword Command

enum e_Register {
    sCommand[12],
    CommandLen
}

new RegisterCommands[3][e_Register]= {
    {""#RegisterCommand"",-1},{""#LoginCommand"",-1},{""#ChangePassCommand"",-1}
};

#define CMD_REGISTER \
    RegisterCommands[0][sCommand]
#define CMD_REGISTER_LEN \
    RegisterCommands[0][CommandLen]

#define CMD_LOGIN \
    RegisterCommands[1][sCommand]
#define CMD_LOGIN_LEN \
    RegisterCommands[1][CommandLen]
   
#define CMD_CHANGEPASS \
    RegisterCommands[2][sCommand]
#define CMD_CHANGEPASS_LEN \
    RegisterCommands[2][CommandLen]
Creo que eso es todo lo que se necesita.
Es bastaaante urgente, asique si pudieran contestar rapido, estaria agradecido! Muchas gracias!
Reply
#2

sera que te falta

#define DIALOGID 2222

o talvez el numero definido interfiere con otro dialog :O

o que es lo que no sirve xD
Reply
#3

Ya tengo el define del dialogo.

El problema es que cuando los users utilizan /login o /register, les tira el "Server: Unknown Command", de cuando el CMD no existe.
Reply
#4

O no sera q borraste alguno de los:


#if USE_DIALOGS == true
#else
#endif

.....

A mi una vez me paso pero porque movi los dcmd_... a otro lugar del GM y no me los reconocia
hasta que puse los dcmd_ abajo de la callback OnPlayerCommandText.
Reply
#5

Nopeless, tampoco es eso:S
Reply
#6

Porque no usas el viejo ladmin ? ami nunca me gusto LuxAdmin .
Reply
#7

Porqe LAdmin esta muy desactualizado, Luxadmin es mas completo y estable.

El prolema era que habian "cuentas malcriadas", lo solucione con un reset de cuentas y reinicio del servidor.
Muchas gracias por la buena onda!
Reply
#8

Pero podrias modificar el ladmin a tu gusto y ponerle cosas del luxadmin, asi tengo mi ladmin ^^

yo antes usaba el luxadmin cuando usaba vps y se apagaba el server por el whirlpool.so que estaba mal programado

creo, porque con el ladmin no se apagaba por eso decidi cambiar y ponerle cosas del luxadmin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)