SQLite problem with login password - 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: SQLite problem with login password (
/showthread.php?tid=575136)
SQLite problem with login password -
FplayerGR - 24.05.2015
Hello guys i have one problem.
my problem is here
Код:
if(!strcmp(inputtext,P_DATA[playerid][password],false))return ShowPlayerDialog(playerid,DIALOG_LOG,DIALOG_STYLE_INPUT,"LOGIN","TYPE YOUR PASSWORD","LOGIN","KICK");
if player input false password again login without any problems.
onplayerconnect function for get password.
Код:
public OnPlayerConnect(playerid){
for(var i;i<_:info;++i)P_DATA[playerid][info:i]=0;
//var is new in pawn, why i like javascript :D
var name[MAX_PLAYER_NAME];
static Q[256],DBResult:Result;
GetPlayerName(playerid,name,sizeof(name));
format(Q,sizeof(Q),"SELECT password FROM USERS WHERE username = '%s'",name);
Result = db_query(database,Q);
if(db_num_rows(Result)){
db_get_field_assoc(Result,"password",P_DATA[playerid][password],256);
ShowPlayerDialog(playerid,DIALOG_LOG,DIALOG_STYLE_INPUT,"LOGIN","TYPE YOUR PASSWORD","LOGIN","KICK");
}
else{
ShowPlayerDialog(playerid,DIALOG_REG,DIALOG_STYLE_INPUT,"REGISTER","TYPE YOUR PASSWORD","REGISTER","KICK");
}
db_free_result(Result);
over 1; //over is return :D #define over return
}
Thanks!
Re: SQLite problem with login password -
Konstantinos - 24.05.2015
strcmp returns 0 when both strings are equal/same or even if one/both is/are NULL.
pawn Код:
if(strcmp(inputtext,P_DATA[playerid][password],false))return ShowPlayerDialog(playerid,DIALOG_LOG,DIALOG_STYLE_INPUT,"LOGIN","TYPE YOUR PASSWORD","LOGIN","KICK");
This will show the dialog when the inputtext does not match with the password you stored before.
Re: SQLite problem with login password -
FplayerGR - 24.05.2015
Quote:
Originally Posted by Konstantinos
strcmp returns 0 when both strings are equal/same or even if one/both is/are NULL.
pawn Код:
if(strcmp(inputtext,P_DATA[playerid][password],false))return ShowPlayerDialog(playerid,DIALOG_LOG,DIALOG_STYLE_INPUT,"LOGIN","TYPE YOUR PASSWORD","LOGIN","KICK");
This will show the dialog when the inputtext does not match with the password you stored before.
|
oh thank you very much
if i use
Код:
if(!strcmp(inputtext,P_DATA[playerid][password],true))retrun Show...
else{
update stats
}
can use this?
Re: SQLite problem with login password -
Konstantinos - 24.05.2015
The false/true is about case sensitive/case insensitive in string comparison. All you have to do is to check if what strcmp returns is not 0 and re-show the dialog.
Re: SQLite problem with login password -
FplayerGR - 24.05.2015
aa okey thanks!