if(dialogid == LOGIN_DIALOG)
{
if(!response)
{
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", "Type in your password", "Login", "Cancel");
}
else
{
new escapedPassword[129];
WP_Hash(escapedPassword, sizeof(escapedPassword), inputtext);
if(!strcmp(escapedPassword,PlayerInfo[playerid][pPass],true))
{
SendClientMessage(playerid, -1, "Incorrect Password Entered - Please try again.");
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", "Type in your password", "Login", "Cancel");
}
else
{
format(GlobalString, sizeof(GlobalString), "Welcome "COL_LIGHTBLUE"%s!",GetName(playerid));
SendClientMessage(playerid, -1, GlobalString);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
TogglePlayerSpectating(playerid, false);
}
new escapedPassword[129];
WP_Hash(escapedPassword, sizeof(escapedPassword), inputtext);
if(!strcmp(escapedPassword,PlayerInfo[playerid][pPass],true))
if(!strcmp(escapedPassword,PlayerInfo[playerid][pPass],false)
That boolean is the ignore case. When set to true, it ignores case sensitivity.
pawn Код:
|
if(dialogid == LOGIN_DIALOG)
{
if(!response)
{
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", "Type in your password", "Login", "Cancel");
}
else
{
new escapedPassword[129];
WP_Hash(escapedPassword, sizeof(escapedPassword), inputtext);
if(strcmp(escapedPassword,PlayerInfo[playerid][pPass],true))
{
SendClientMessage(playerid, -1, "Incorrect Password Entered - Please try again.");
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", "Type in your password", "Login", "Cancel");
}
else
{
format(GlobalString, sizeof(GlobalString), "Welcome "COL_LIGHTBLUE"%s!",GetName(playerid));
SendClientMessage(playerid, -1, GlobalString);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
TogglePlayerSpectating(playerid, false);
}
Strcmp returns 0 if the strings you compare match and 1/-1 if they don't. So bassicaly if you introduce your good password you won't be able to login. Change the if condition
pawn Код:
|
Strcmp returns 0 if the strings you compare match and 1/-1 if they don't. So bassicaly if you introduce your good password you won't be able to login.
|
Oh I misread that. Remove the exclamation point, and change your "true" to "false."
|
if(dialogid == LOGIN_DIALOG)
{
if(!response)
{
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", "Type in your password", "Login", "Cancel");
}
else
{
new escapedPassword[129];
WP_Hash(escapedPassword, sizeof(escapedPassword), inputtext);
if(strcmp(escapedPassword,PlayerInfo[playerid][pPass],false))
{
SendClientMessage(playerid, -1, "Incorrect Password Entered - Please try again.");
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", "Type in your password", "Login", "Cancel");
}
else
{
LoadPlayer(playerid);
format(GlobalString, sizeof(GlobalString), "Welcome "COL_LIGHTBLUE"%s!",GetName(playerid));
SendClientMessage(playerid, -1, GlobalString);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
mysql_format(sqldb, query, sizeof(query), "SELECT * FROM vehicles WHERE owner = '%s'", GetName(playerid));
mysql_tquery(sqldb, query, "VehicleCheck", "i", playerid);
TogglePlayerSpectating(playerid, false);
}
}
return 1;
}
printf("Password Length: %d", strlen(PlayerInfo[playerid][pPass]));