PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You must register to play at "NAME"","Close","");
Kick(playerid);
}
if(response)
{
new str[256],IP[16],hashpass[129];
GetPlayerIp(playerid, IP, sizeof(IP));
if(!strlen(inputtext))
{
format(str,sizeof(str),""chat"Welcome %s to "NAME"",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,str,""chat" Welcome to "NAME" you'll be forced to register please click register!","Register","Quit");
}
WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
new INI:File = INI_Open(UserPath(playerid));
/*new INI:File = INI_Open(UserPath(playerid));
WP_Hash(buf, sizeof(buf), inputtext);*/
INI_SetTag(File,"data");
//INI_WriteString(File, "pPassword", buf);
INI_WriteString(File,"Password",inputtext);
INI_WriteInt(File,"pXP",0);
INI_WriteInt(File,"pKills",0);
INI_WriteInt(File,"pDeaths",0);
INI_WriteInt(File,"pRank",0);
INI_WriteInt(File,"pEvac",0);
INI_WriteInt(File,"pAdminLevel",0);
INI_WriteInt(File,"pAdminDuty",0);
INI_WriteInt(File,"pVipLevel",0);
INI_WriteInt(File,"pHour",0);
INI_WriteInt(File,"pMin",0);
INI_WriteInt(File,"pSec",0);
INI_WriteInt(File,"pMapsPlayed",0);
INI_WriteInt(File,"pCoins",0);
INI_WriteString(File,"pIP",IP);
INI_WriteInt(File,"pBanned",0);
INI_WriteInt(File,"gLeader",0);
INI_WriteInt(File,"gMember",0);
INI_Close(File);
TextDrawHideForPlayer(playerid, login0);
TextDrawHideForPlayer(playerid, login1);
TextDrawHideForPlayer(playerid, login2);
TextDrawHideForPlayer(playerid, login3);
playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
pInfo[playerid][pLogged] = 1;
}
}
case DIALOG_LOGIN:
{
if(!response)
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You must login to play at "NAME"","Close","");
Kick(playerid);
}
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(inputtext,pInfo[playerid][pPassword]))
{
//INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
INI_ParseFile(UserPath(playerid), "LoadUser_data",.bExtra = true, .extra = playerid);
pInfo[playerid][pLogged] = 1;
playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
SendClientMessage(playerid,-1,""chat""COL_LGREEN" Logged in!");
printf("%s",pInfo[playerid][pPassword]);
TextDrawHideForPlayer(playerid, login0);
TextDrawHideForPlayer(playerid, login1);
TextDrawHideForPlayer(playerid, login2);
TextDrawHideForPlayer(playerid, login3);
}
else
{
new string[256];
format(string,sizeof(string),""chat" Welcome back %s",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,string,""chat" Our system have detected your username registered please login","Login","Quit");
}
return 1;
}
}
Idk what is the problem here but, dont have errors .
strcmp will return 0 when the strings are the same, but also when one of the strings is empty. Have you checked if the password is saved in the ini file? Is the ini file created in the first place?
I can't give you any code. I asked you, if the password string is saved in the ini file. If you don't understand English, ask in the language section for your language. If that language section does not exist, try translating my text with a translation program or let someone translate it who knows both languages.
Heah i want to save the inputtext and in dialog login i want the inputtext
Bump. AnyOne?
For everyone's sake, follow the damn rules...
Don't bump before 24 hours.
You're hashing in DIALOG_LOGIN, but you're not hashing DIALOG_REGISTER.
It's better if you hash them. I wouldn't join your server if you can know my password.