22.09.2013, 14:29
Quote:
Mh maybe i fail lol
pawn Код:
so you store the player password in PlayerInfo[playerid][pPass] and want check if inputtext is equal to PlayerInfo[playerid][pPass] right? |
PHP код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Login",""COL_ROZZ"please ENTER your password to login to your game account.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Register",""COL_ROZZ"please ENTER your password to register a new game account.","Register","Quit");
}
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Register",""COL_RED"invalid password!.\n"COL_ROZZ"please ENTER your password to register a new game account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Password",inputtext);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SendClientMessage(playerid, COLOR_ROZZ, "Thanks for registering! have a lot of fun on our server.");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(strcmp(inputtext, PlayerInfo[playerid][pPass],true) == 0)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SendClientMessage(playerid, COLOR_ROZZ, "You have logged in!");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered wrong password.\n"COL_WHITE"Please enter you password to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}