enum pData
{
Password[64],
..
}
new p_Data[MAX_PLAYERS][pData];
public LoadUser_data(playerid,name[],value[])
{
INI_String( "Password", p_Data[playerid][Password], 64);
..
return 1;
}
format(pTxt, 64, "%s", inputtext);
INI_WriteString(AccountData, "Password", pTxt);
if(strcmp(inputtext, p_Data[playerid][Password], true) == 0) {
case d_Login: {
if(!response) {
SendClientMessage(playerid, COLOR_ERROR, "Sorry! You are required to register before playing!");
return Kick(playerid);
}
if(!strlen(inputtext))
return ShowPlayerDialog(playerid, d_Login, DIALOG_STYLE_PASSWORD, "{009AC9}Welcome back!", "{FFFFFF}Please type your {2A9107}password {FFFFFF}below to access your account information!", "Connect", "Quit");
printf("%s", inputtext);
if(strcmp(inputtext, p_Data[playerid][Password], true) == 0) {
TogglePlayerSpectating(playerid, 0);
INI_ParseFile(FetchTheirAccountLocation(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, p_Data[playerid][Money]);
SetSpawnInfo(playerid, 0, p_Data[playerid][SkinModel], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else return ShowPlayerDialog(playerid, d_Login, DIALOG_STYLE_PASSWORD, "{009AC9}Welcome back!", "{FFFF00}You have entered an incorrect password!\n{FFFFFF}Please type your {2A9107}password {FFFFFF}below to access your account information!", "Connect", "Quit");
}
public OnPlayerConnect(playerid)
{
INI_ParseFile(FetchTheirAccountLocation(playerid), "LoadPass_%s", .bExtra = true, .extra = playerid);
}
public LoadPass_data(playerid,name[],value[])
{
INI_String("Password", p_Data[playerid][Password], 64);
return 1;
}
format(pTxt, 64, "%s", inputtext);
p_Data[playerid][Password] = pTxt;
INI_WriteString(AccountData, "Password", pTxt);
You need to load the password before checking if its correct!
pawn Код:
pawn Код:
|