inputtext help -
tyler12 - 03.08.2012
Hello,
Im trying to get my register system to work.
On this line, im getting many errors.
pawn Код:
if(inputtext) == PlayerInfo[playerid][pPass])
NFT.pwn(386) : error 033: array must be indexed (variable "inputtext")
NFT.pwn(386) : error 029: invalid expression, assumed zero
NFT.pwn(386) : warning 215: expression has no effect
NFT.pwn(386) : error 001: expected token: ";", but found ")"
NFT.pwn(386) : fatal error 107: too many error messages on one line
Ive tried alot of things to try and fix it, but cant find anything
Also
pawn Код:
INI_WriteInt(File,"Password",inputtext);
gives an error: NFT.pwn(372) : error 035: argument type mismatch (argument 3)
Im not sure what to do.
Any help would be appreciated.
- Tyler.
Re: inputtext help -
Sascha - 03.08.2012
you can't compare 2 strings with "=="
use "strcmp"
https://sampwiki.blast.hk/wiki/Strcmp
in your case:
pawn Код:
if(!strcmp(inputtext, PlayerInfo[playerid][pPass], false))
Re: inputtext help -
Johnson_boy - 03.08.2012
Quote:
Originally Posted by tyler12
Hello,
Im trying to get my register system to work.
On this line, im getting many errors.
pawn Код:
if(inputtext) == PlayerInfo[playerid][pPass])
NFT.pwn(386) : error 033: array must be indexed (variable "inputtext")
NFT.pwn(386) : error 029: invalid expression, assumed zero
NFT.pwn(386) : warning 215: expression has no effect
NFT.pwn(386) : error 001: expected token: ";", but found ")"
NFT.pwn(386) : fatal error 107: too many error messages on one line
|
You cannot compare strings with ==, you must use strcmp. However, I still don't quite
understand what you are trying to achieve by comparing inputtext to pPass variable. Or
did you load the password of the player to the variable before this check?
But if you have the password stored in pPass variable, you should use this script then.
pawn Код:
if(!strcmp(PlayerInfo[playerid][pPass], inputtext, false)) { // Passwords do match
And you should also hash your passwords (Whirlpool/SHA2), salting wouldn't hurt either.
Storing passwords as plain text is a great security vulnerability.
Re: inputtext help -
tyler12 - 03.08.2012
Quote:
Originally Posted by Sascha
|
Thanks for that.
Repped.
What can i do for the 2nd? :S
Re: inputtext help -
Vince - 03.08.2012
Sigh. I wish people would try to actually understand what a function
does before trying to use it. INI_WriteInt ... Writes an
INTeger to an ini file. Password is a
string. You get the point?
Re: inputtext help -
Johnson_boy - 03.08.2012
Quote:
INI_WriteInt(File,"Password",inputtext);
|
You are using a function to set integer value, but the parameter you are giving is a string.
INI_WriteInt stands for INI_WriteInteger. I am not sure what the function is called, but my
guess is that it could be INI_Write(File, "Password", inputtext); You can check that from
your include.
EDIT: Someone is always faster :P The reply above is correct.
Re: inputtext help -
tyler12 - 03.08.2012
Quote:
Originally Posted by Vince
Sigh. I wish people would try to actually understand what a function does before trying to use it. INI_WriteInt ... Writes an INTeger to an ini file. Password is a string. You get the point?
|
Quote:
Originally Posted by Johnson_boy
You are using a function to set integer value, but the parameter you are giving is a string.
INI_WriteInt stands for INI_WriteInteger. I am not sure what the function is called, but my
guess is that it could be INI_Write(File, "Password", inputtext); You can check that from
your include.
EDIT: Someone is always faster :P The reply above is correct.
|
Thanks, both repped..
Re: inputtext help -
Hayden_Almeida - 12.11.2015
Quote:
Originally Posted by Sascha
|
Even typping the wrong password, the player is connecting in the account :/
Inside Dialog REGISTER:
Код:
format(PlayerInfo[playerid][pPass], 29, inputtext);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Password", PlayerInfo[playerid][pPass]);
Inside DIALOG LOGIN:
Код:
if(!strcmp(inputtext, PlayerInfo[playerid][pPass], false))
{