Dini_Get?
#1

Hey, there i am using dini and i am trying to make a command which gives me the password of a offline player, but it doesnt seems to work.Here is my command!
pawn Код:
CMD:getpass(playerid, params[])
{
    new file[32], playerb[32], string[128], password[256];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /getpass [username]");
    format(file, sizeof(file), "users/%s.ini", playerb);
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    dini_Get(file, "Password", password);
    WP_Hash(password, sizeof(password), password);
    format(string, sizeof(string), "Username: %s | Password: %s", playerb, password);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
}
Reply
#2

Don't use sscanf if you only want a string.

And you're hashing the password, and storing it into 'password'?
That doesn't really make sense.

And what's playerb?
Reply
#3

How should i do it then? playerb refers to the player whose password i am gonna retrieve
Reply
#4

Well if you hash your users' passwords, you can't get it as not hashed.
But this should get you the hashed password:
pawn Код:
CMD:getpass(playerid, params[])
{
    new file[35], password[129];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /getpass [username]");
    format(file, sizeof(file), "users/%s.ini", playerb);
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    dini_Get(file, "Password", password);
    format(string, sizeof(string), "Username: %s | Password: %s", params, password);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
}
Reply
#5

says player name not found.
Reply
#6

Oh sorry, get the player's name and replace playerb with it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)