Encrypted password help
#1

Hello, I have built a system to encrypt passwords, and for now I was just having a command to insert a string and see what is the encrypted string. The problem is it only returns the first character as encrypted and the whole other characters are nowhere to be found. When I enter 'abc' it returns the encrypted state of 'a' only and when I enter 'hdfgdfg' it returns the encrypted state of 'h'. Please help! Thanks!
Reply
#2

Nevermind about what I wrote above, its fixed now.
I have a minor problem now that goes like this: I set it so maximum string length is 20 but when I do more than 20, it should return a "String is too long" message, and it does if the string is between 21 to 23 characters. When the string is above 23, it tells me "ERROR: Command does not exist!". Please help me if you know how to fix it!

pawn Код:
#define PASSWORD_MAXIMUM_CHARS 20

COMMAND:encrypt(playerid, params[])
{
    if(isPlayerAdmin(playerid) >= 2)
    {
        new pass[PASSWORD_MAXIMUM_CHARS];
        if(!sscanf(params, "s", pass))
        {
            if(strlen(pass) > PASSWORD_MAXIMUM_CHARS)
                return SendClientMessageEx(playerid, 0xFF0000FF, "ERROR: String entered is too long!");
            else
                EncryptPass(playerid, pass);
        }
        else SendClientMessageEx(playerid, -1, "USAGE: /encrypt <string/pass>");
    }
    else SendClientMessageEx(playerid, 0xFFFF0000, "ERROR: Insufficient permission!");
    return 1;
}
Reply
#3

Try changing:
pawn Код:
if(!sscanf(params, "s", pass))
to
pawn Код:
if(!sscanf(params, "s[20]", pass))

This forum requires that you wait 120 seconds between posts. Please try again in 30 seconds.
Reply
#4

Thanks, though I fixed it already a while ago!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)