17.02.2016, 14:52
i have this code for login but when i entering password i saw again login dialog.
PHP код:
enum pInfo{
pIp[16],
pRegistrationdate[11],
pHashPW,
pPassword[128],
pAdminlevel,
pViplevel,
pScore,
pMoney,
pDeaths,
pDeathspree,
pKills,
pKillspree,
pZones,
pZonespree,
Float:pRatio,
pRegistered,
pBan,
pAban[128],
pRban[128],
pWarn,
pFight,
pLicense,
pClanid,
pClan,
pClanname[128],
pMember[128],
pClanlevel,
pTutorial,
bool:pMute,
bool:pFreeze,
bool:pJail,
bool:pLogged};
new PlayerData[MAX_PLAYERS][pInfo];
PHP код:
public LoadUser_data(playerid,name[],value[]){
INI_String("ip",PlayerData[playerid][pIp],16);
INI_String("Registrationdate",PlayerData[playerid][pRegistrationdate],11);
INI_Int("HashPW",PlayerData[playerid][pHashPW]);
INI_String("Password",PlayerData[playerid][pPassword],128);
INI_Int("Adminlevel",PlayerData[playerid][pAdminlevel]);
INI_Int("Viplevel",PlayerData[playerid][pViplevel]);
INI_Int("Score",PlayerData[playerid][pScore]);
INI_Int("Money",PlayerData[playerid][pMoney]);
INI_Int("Deaths",PlayerData[playerid][pDeaths]);
INI_Int("Deathspree",PlayerData[playerid][pDeathspree]);
INI_Int("Kills",PlayerData[playerid][pKills]);
INI_Int("Killspree",PlayerData[playerid][pKillspree]);
INI_Int("Zones",PlayerData[playerid][pZones]);
INI_Int("Zonespree",PlayerData[playerid][pZonespree]);
INI_Float("Ratio",PlayerData[playerid][pRatio]);
INI_Int("Registered",PlayerData[playerid][pRegistered]);
INI_Int("Ban",PlayerData[playerid][pBan]);
INI_String("Adminban",PlayerData[playerid][pAban],128);
INI_String("Reasonban",PlayerData[playerid][pRban],128);
INI_Int("Fight",PlayerData[playerid][pFight]);
INI_Int("License",PlayerData[playerid][pLicense]);
INI_Int("Clanid",PlayerData[playerid][pClanid]);
INI_Int("Clan",PlayerData[playerid][pClan]);
INI_String("Clanname",PlayerData[playerid][pClanname],128);
INI_String("Member",PlayerData[playerid][pMember],128);
INI_Int("Clanlevel",PlayerData[playerid][pClanlevel]);
INI_Int("Tutorial",PlayerData[playerid][pTutorial]);
INI_Bool("Mute",PlayerData[playerid][pMute]);
INI_Bool("Freeze",PlayerData[playerid][pFreeze]);
INI_Bool("Jail",PlayerData[playerid][pJail]);
INI_Bool("Logged",PlayerData[playerid][pLogged]);
return 1;}
PHP код:
if(dialogid==DIALOG_LOGIN){
if(response==0)return Kick(playerid);
if(response==1){
INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra=true,.extra=playerid);
if(udb_hash(inputtext)==PlayerData[playerid][pHashPW]){
GivePlayerMoney(playerid,PlayerData[playerid][pMoney]);
SetPlayerScore(playerid,PlayerData[playerid][pScore]);
return 1;}
if(udb_hash(inputtext)!=PlayerData[playerid][pHashPW]){
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,""COL_RED"Login(incorrect password)",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to "COL_LIGHT_GREEN"login.","Login","Quit");
return 1;}
return 1;}}