Encrypted password help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Encrypted password help (
/showthread.php?tid=537735)
Encrypted password help -
arad55 - 17.09.2014
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!
Re: Encrypted password help -
arad55 - 17.09.2014
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;
}
Re: Encrypted password help -
biker122 - 17.09.2014
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.
Re: Encrypted password help -
arad55 - 17.09.2014
Thanks, though I fixed it already a while ago!