My password is 123 but it also accepts 12? - 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: My password is 123 but it also accepts 12? (
/showthread.php?tid=546385)
My password is 123 but it also accepts 12? -
Sellize - 15.11.2014
Why does it think 12 is a good password while my pass is 123?
Код:
case DIALOG_LOGIN:
{
if (!response) return Kick(playerid);
if(response)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(inputtext, PlayerInfo[playerid][pPass], false))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoneyEx(playerid, PlayerInfo[playerid][pCash]);
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
welcome(playerid);
NewMoney[playerid] = GetPlayerMoney(playerid);
PlayerInfo[playerid][pLogged] = 1;
ForceClassSelection(playerid);
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
printf("%s logged in with IP: %s", name, plrIP);
}
else
{
slowkick(playerid, "Invalid password");
PlayerInfo[playerid][pLogged] = 0;
}
return 1;
}
}
Re: My password is 123 but it also accepts 12? -
Sellize - 15.11.2014
Anyone?
Re: My password is 123 but it also accepts 12? -
DavidBilla - 15.11.2014
Have you declared you pPass as string or integer?
Do you mind showing the PlayerInfo enum?
Re: My password is 123 but it also accepts 12? -
Sellize - 15.11.2014
Quote:
Originally Posted by DavidBilla
Have you declared you pPass as string or integer?
Do you mind showing the PlayerInfo enum?
|
Quote:
enum pInfo
{
pPass,
pCash,
pBank,
pAdmin,
pKills,
pDeaths,
pGroup,
pGroupRank,
pLogged
}
new PlayerInfo[MAX_PLAYERS][pInfo];
|
Stored as a string
Re : My password is 123 but it also accepts 12? -
Dutheil - 15.11.2014
Re: Re : My password is 123 but it also accepts 12? -
DavidBilla - 15.11.2014
Quote:
Originally Posted by Dutheil
|
Ye that ^
And everywhere replace PlayerInfo[playerid][pPass] with. PlayerInfo[playerid][pPass][32]
Re: Re : My password is 123 but it also accepts 12? -
Sellize - 15.11.2014
Quote:
Originally Posted by Dutheil
|
That didn't fix it
Re: Re : My password is 123 but it also accepts 12? -
Sellize - 15.11.2014
Quote:
Originally Posted by DavidBilla
Ye that ^
And everywhere replace PlayerInfo[playerid][pPass] with. PlayerInfo[playerid][pPass][32]
|
That also does not fix it
Re: My password is 123 but it also accepts 12? -
sammp - 15.11.2014
change
pawn Код:
if(!strcmp(inputtext, PlayerInfo[playerid][pPass], false))
to
pawn Код:
if(!strcmp(inputtext, PlayerInfo[playerid][pPass]))
Re: My password is 123 but it also accepts 12? -
Threshold - 15.11.2014
This is being created as an integer. Therefore, you have been saving, loading and modifying this variable as an integer and not a string. You need to alter everything to do with this variable to make sure it is being treated as a string. Also make sure you hash your passwords...