MD5_Hash help
#1

Hi,

I'm wondering if somebody could help me with this, every time I use /register it doesn't hash into the file, but it just gets saved the way I typed it. I'm wondering what's wrong. Also, would this login command work?

http://pastebin.com/m70ac397b

Thanks, bye!
Reply
#2

Anyone?
Reply
#3

I believe MD5_Hash was created by ****** for YSI, so go and ask in that topic.
Reply
#4

I am not sure but I think you have todo:

pawn Код:
dcmd_register(playerid, params[])
{
  new pName[24], PlayerFile[50],hashedPassword = strval(params);
  GetPlayerName(playerid, pName, sizeof(pName));
  format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName);

  if(dini_Exists(PlayerFile))
  {
    SendClientMessage(playerid, COLOR_BRIGHTRED, "You have already registered! Please use /login to login or choose another nicknname.");
    return 1;
  }

  if(!dini_Exists(PlayerFile))
  {
    if (!strlen(params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /register [password]");
       
    dini_Create(PlayerFile);
    dini_Set(PlayerFile, "Password", MD5_Hash(hashedPassword));
    printf("Geregistreerd: %s, Pass: %s", pName, MD5_Hash(hashedPassword));
    dini_IntSet(PlayerFile, "AdminLevel", 0);
    dini_IntSet(PlayerFile, "Deaths", 0);
    dini_IntSet(PlayerFile, "Kills", 0);
    dini_IntSet(PlayerFile, "Banned", 0);

    SendClientMessage(playerid, COLOR_GREEN, "You have succesfully registered, you have been automatically logged in.");

    PlayerInfo[playerid][Registered] = 1;
    PlayerInfo[playerid][LoggedIn] = 1;
  }
  return 1;
}
Reply
#5

Sneaky: You declare hashedPassword as an integer: strval(params); That is not what you want to do, right?

Anyway, rewrite your command according to this line:
pawn Код:
dini_Set(PlayerFile, "Password", MD5_Hash(params));
Reply
#6

Alright, thanks guys, I'll give it a try .

Thansk for the help Sneaky and Orb
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)