23.08.2012, 06:19
Hello, im using luxadmin system , and i want to remove Question request but i fail here is the code :-
Wish you can help
Wish you can help
Код:
#if USE_DIALOGS == true //============================================================================== //--------------- // Dialog - SAFETY QUESTION //--------------- //============================================================================== if (dialogid == DIALOG_TYPE_QUESTION) { if(response == 0) { AccInfo[playerid][NoQuestion] = dUserSetINT(PlayerName2(playerid)).("NoQuestion",1); } if(response) { if (strlen(inputtext) < 1 || strlen(inputtext) > 60) return ShowPlayerDialog(playerid,DIALOG_TYPE_QUESTION,DIALOG_STYLE_INPUT,"LuxAdmin - Account Safety Question","{F3FF02}Type a security question, for when you forget\n {6EF83C}your password, you just answer this Question.","Next","End"); new file[256],name[MAX_PLAYER_NAME]; AccInfo[playerid][NoQuestion] = dUserSetINT(PlayerName2(playerid)).("NoQuestion",0); GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(name)); dini_Set(file,"Question",inputtext); new rstring[256]; format(rstring,256,"Type a RESPONSE for your Safety Question: \"%s\"",inputtext); ShowPlayerDialog(playerid,DIALOG_TYPE_QUESTION+1,DIALOG_STYLE_INPUT,"LuxAdmin - Account Safety Question - RESPONSE",rstring,"Confirm","End"); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } return 1; } //============================================================================== //--------------- // Dialog - SAFETY QUESTION (RESPONSE) //--------------- //============================================================================== if (dialogid == DIALOG_TYPE_QUESTION+1) { if(response == 0) { AccInfo[playerid][NoQuestion] = dUserSetINT(PlayerName2(playerid)).("NoQuestion",1); } if(response) { if(strlen(inputtext) < 1 || strlen(inputtext) > 40) { new rstring[256]; new file[256],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); new tmp[256]; dini_Get(file,"Question"); AccInfo[playerid][NoQuestion] = dUserSetINT(PlayerName2(playerid)).("NoQuestion",0); format(rstring,256,"Type a RESPONSE for your Safety Question: \"%s\"",tmp); return ShowPlayerDialog(playerid,DIALOG_TYPE_QUESTION+1,DIALOG_STYLE_INPUT,"LuxAdmin - Account Safety Question - RESPONSE",rstring,"Confirm","End"); } new file[256],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(name)); new hashq[145]; WP_Hash(hashq, sizeof(hashq), inputtext); dini_Set(file,"QuestionR",hashq); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } return 1; } //============================================================================== //--------------- // Dialog - REGISTER //--------------- //============================================================================== if (dialogid == DIALOGID+66) { if(response == 0 && ServerInfo[MustRegister] == 1) { Kick(playerid); } if(response) { if (strlen(inputtext) < 4 || strlen(inputtext) > 20) { new rstring[256]; format(rstring,256,"{F81414}Sorry %s\n\nThe length of your password should contain more \nthan 3 characters and less than 20 characters! \n\n Please, re-enter the Password:",pName(playerid)); return ShowPlayerDialog(playerid,DIALOGID+68,DIALOG_STYLE_INPUT,"Register Error!",rstring,"Register","Quit"); } if (udb_Create(PlayerName2(playerid))) { ShowPlayerDialog(playerid,DIALOG_TYPE_QUESTION,DIALOG_STYLE_INPUT,"LuxAdmin - Account Safety Question","{F3FF02}Type a security question, for when you forget\n your password, you just answer this Question.","Next","End"); new file[256],name[MAX_PLAYER_NAME], buf[145],tmp3[100]; new strdate[20], year,month,day; getdate(year, month, day); WP_Hash(buf, sizeof(buf), inputtext); GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(name)); GetPlayerIp(playerid,tmp3,100); dini_Set(file,"Password",buf); dini_Set(file,"Ip",tmp3); dUserSetINT(PlayerName2(playerid)).("Registered",1); format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year); dini_Set(file,"RegisteredDate",strdate); dUserSetINT(PlayerName2(playerid)).("Loggedin",1); dUserSetINT(PlayerName2(playerid)).("Banned",0); dUserSetINT(PlayerName2(playerid)).("Level",0); dUserSetINT(PlayerName2(playerid)).("AccountType",0); dUserSetINT(PlayerName2(playerid)).("LastOn",0); dUserSetINT(PlayerName2(playerid)).("Money",0); dUserSetINT(PlayerName2(playerid)).("Kills",0); dUserSetINT(PlayerName2(playerid)).("Deaths",0); dUserSetINT(PlayerName2(playerid)).("WantedLevel",0); dUserSetINT(PlayerName2(playerid)).("Score",0); dUserSetINT(PlayerName2(playerid)).("Hours",0); dUserSetINT(PlayerName2(playerid)).("Minutes",0); dUserSetINT(PlayerName2(playerid)).("Seconds",0); AccInfo[playerid][LoggedIn] = 1; AccInfo[playerid][Registered] = 1; SendClientMessage(playerid, yellow, "Account: {FFFFFF}You are now {6EF83C}Registered, {F3FF02}and have been automaticaly {C77D87}Logged in, Read the {F81414}/Rules"); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); return 1; } } return 1; } //============================================================================== //--------------- // Dialog - LOGIN //--------------- //============================================================================== if (dialogid == DIALOGID+67) { if(response == 0 && ServerInfo[MustLogin] == 1) { Kick(playerid); } if(response) { new lstring[256]; new file[128], Pass[256]; format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid))); Pass = dini_Get(file, "Password"); new buf[145]; WP_Hash(buf, sizeof(buf), inputtext); AccInfo[playerid][NoQuestion] = dUserINT(PlayerName2(playerid)).("NoQuestion"); if(strcmp(Pass, buf, false) == 0) { new tmp3[100], string[128]; format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid))); GetPlayerIp(playerid,tmp3,100); dini_Set(file,"Ip",tmp3); LoginPlayer(playerid); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); if(AccInfo[playerid][Level] > 0) { switch(AccInfo[playerid][Level]) { case 1: AdmRank = "Trail Mod"; case 2: AdmRank = "Mod"; case 3: AdmRank = "Admin"; case 4: AdmRank = "Leader"; case 5: AdmRank = "CO-Manager"; } if(AccInfo[playerid][Level] > 5) { AdmRank = "Manager"; } if(AccInfo[playerid][pVip] > 0) { switch(AccInfo[playerid][pVip]) { case 1: AccType = "FREE"; case 2: AccType = "Casher"; case 3: AccType = "Gold"; } format(string,sizeof(string),"*** You have Successfully Logged! {00AAAA}Account: %s | Level %d - %s", AccType, AccInfo[playerid][Level], AdmRank); return SendClientMessage(playerid,0x00C378AA,string); } else { format(string,sizeof(string),"*** You have Successfully Logged! {00AAAA}Level %d - %s", AccInfo[playerid][Level], AdmRank); return SendClientMessage(playerid,green,string); } } else { if(AccInfo[playerid][pVip] > 0) { switch(AccInfo[playerid][pVip]) { case 1: AccType = "FREE"; case 2: AccType = "Casher"; case 3: AccType = "Gold"; } format(string,sizeof(string),"Account: You have Successfully logged! {00AAAA}Account: %s", AccType); return SendClientMessage(playerid,0x00C896AA,string); } else return SendClientMessage(playerid,green,"Account: You have Successfully logged!"); } } else { AccInfo[playerid][FailLogin]++; printf("LOGIN: {F81414}Failed Login: {F3FF02}%s. {F81414}Wrong password (%s) (%d)", PlayerName2(playerid), inputtext, AccInfo[playerid][FailLogin] ); if(AccInfo[playerid][FailLogin] == MAX_FAIL_LOGINS) { new string[128]; format(string, sizeof(string), "%s has been automatically kicked {00AAAA}(Failed Login).", PlayerName2(playerid) ); SendClientMessageToAll(red, string); print(string); Kick(playerid); } if(AccInfo[playerid][NoQuestion] == 1) { format(lstring,256,"Sorry '%s'\n\n{00AAAA}Your entered password is Incorrect!\nPlease, re-enter the Correct Password:",pName(playerid)); return ShowPlayerDialog(playerid,DIALOGID+69,DIALOG_STYLE_INPUT,"Login Error",lstring,"Login","Quit"); } if(AccInfo[playerid][NoQuestion] == 0) { format(lstring,256,"Sorry '%s'\n\n{00AAAA}Your entered password is Incorrect!\nPlease, re-enter the Correct Password:\n\nForget you'r password? visit www.PardiseNetWork.Smffy.com\nOr type the response of your security question:\n\n \"%s\"",pName(playerid),dini_Get(file, "Question")); return ShowPlayerDialog(playerid,DIALOGID+69,DIALOG_STYLE_INPUT,"Login Error",lstring,"Login","Quit"); } } } } //============================================================================== //--------------- // Dialog - ERROR PASSWORD //--------------- //============================================================================== if (dialogid == DIALOGID+68) { if(response == 0 && ServerInfo[MustRegister] == 1) { Kick(playerid); } if(response) { if (strlen(inputtext) < 4 || strlen(inputtext) > 20) { new rstring[400]; format(rstring,400,"{F81414}Sorry %s\n{F3FF02}But The length of your password should contain more \n{F3FF02}than 3 characters and less than 20 characters! \n{6EF83C}Please, re-enter the Password:",pName(playerid)); return ShowPlayerDialog(playerid,DIALOGID+68,DIALOG_STYLE_INPUT,"Register Error!",rstring,"Register","Quit"); } if (udb_Create(PlayerName2(playerid))) { ShowPlayerDialog(playerid,DIALOG_TYPE_QUESTION,DIALOG_STYLE_INPUT,"LuxAdmin - Account Safety Question","{F81414}Type a security question, for when you forget\n your password, you just answer this Question.","Next","End"); new file[256],name[MAX_PLAYER_NAME], buf[145],tmp3[100]; new strdate[20], year,month,day; getdate(year, month, day); WP_Hash(buf, sizeof(buf), inputtext); GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(name)); GetPlayerIp(playerid,tmp3,100); dini_Set(file,"Password",buf); dini_Set(file,"Ip",tmp3); dUserSetINT(PlayerName2(playerid)).("Registered",1); format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year); dini_Set(file,"RegisteredDate",strdate); dUserSetINT(PlayerName2(playerid)).("Loggedin",1); dUserSetINT(PlayerName2(playerid)).("Banned",0); dUserSetINT(PlayerName2(playerid)).("Level",0); dUserSetINT(PlayerName2(playerid)).("AccountType",0); dUserSetINT(PlayerName2(playerid)).("LastOn",0); dUserSetINT(PlayerName2(playerid)).("Money",0); dUserSetINT(PlayerName2(playerid)).("Kills",0); dUserSetINT(PlayerName2(playerid)).("Deaths",0); dUserSetINT(PlayerName2(playerid)).("WantedLevel",0); dUserSetINT(PlayerName2(playerid)).("Score",0); dUserSetINT(PlayerName2(playerid)).("Hours",0); dUserSetINT(PlayerName2(playerid)).("Minutes",0); dUserSetINT(PlayerName2(playerid)).("Seconds",0); AccInfo[playerid][LoggedIn] = 1; AccInfo[playerid][Registered] = 1; SendClientMessage(playerid, green, "Account: You are now Registered, {00FFEE}and have been automaticaly {C3C3C3}Logged in!"); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); return 1; } } return 1; } //============================================================================== //--------------- // Dialog - INCORRECT PASSWORD //--------------- //============================================================================== if (dialogid == DIALOGID+69) { if(response == 0 && ServerInfo[MustLogin] == 1) { Kick(playerid); } if(response) { new file[128], Pass[256], Question[256]; new lstring[256]; format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid))); Pass = dini_Get(file, "Password"); new buf[145]; WP_Hash(buf, sizeof(buf), inputtext); Question = dini_Get(file, "QuestionR"); new buf2[145]; WP_Hash(buf2, sizeof(buf2), inputtext); AccInfo[playerid][NoQuestion] = dUserINT(PlayerName2(playerid)).("NoQuestion"); if(AccInfo[playerid][NoQuestion] == 1) { if(strcmp(Pass, buf, false) == 0) { new tmp3[100], string[128]; format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid))); GetPlayerIp(playerid,tmp3,100); dini_Set(file,"Ip",tmp3); LoginPlayer(playerid); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); if(AccInfo[playerid][Level] > 0) { switch(AccInfo[playerid][Level]) { case 1: AdmRank = "Trail Mod"; case 2: AdmRank = "Mod"; case 3: AdmRank = "Admin"; case 4: AdmRank = "Leader"; case 5: AdmRank = "CO-Manager"; } if(AccInfo[playerid][Level] > 5) { AdmRank = "Manager"; } if(AccInfo[playerid][pVip] > 0) { switch(AccInfo[playerid][pVip]) { case 1: AccType = "FREE"; case 2: AccType = "Casher"; case 3: AccType = "Gold"; } format(string,sizeof(string),"Account: You have Successfully Logged! {00FFEE}Account: %s | Level %d - %s", AccType, AccInfo[playerid][Level], AdmRank); return SendClientMessage(playerid,0x00C378AA,string); } else { format(string,sizeof(string),"Account: You have Successfully Logged! {00FFEE}Level %d - %s", AccInfo[playerid][Level], AdmRank); return SendClientMessage(playerid,green,string); } } else { if(AccInfo[playerid][pVip] > 0) { switch(AccInfo[playerid][pVip]) { case 1: AccType = "Free"; case 2: AccType = "Casher"; case 3: AccType = "Gold"; } format(string,sizeof(string),"|- You have Successfully logged! {00AAAA}Account: %s", AccType); return SendClientMessage(playerid,0x00C896AA,string); } else return SendClientMessage(playerid,green,"|- You have Successfully logged! -|"); } } else { AccInfo[playerid][FailLogin]++; printf("LOGIN: Failed Login: %s. Wrong password (%s) (%d)", PlayerName2(playerid), inputtext, AccInfo[playerid][FailLogin] ); if(AccInfo[playerid][FailLogin] == MAX_FAIL_LOGINS) { new string[128]; format(string, sizeof(string), "*** %s has been automatically kicked {F81414}(Failed Login.)", PlayerName2(playerid) ); SendClientMessageToAll(yellow, string); print(string); Kick(playerid); } if(AccInfo[playerid][NoQuestion] == 1) { format(lstring,300,"{F81414}Sorry '%s'\n\n{FFAF00}Your entered password is Incorrect!\n{F3FF02}Please, re-enter the Correct Password:",pName(playerid)); return ShowPlayerDialog(playerid,DIALOGID+69,DIALOG_STYLE_INPUT,"Login Error",lstring,"Login","Quit"); } else if(AccInfo[playerid][NoQuestion] == 0) { format(lstring,350,"{F81414}Sorry '%s'\n\n{FFAF00}Your entered password is Incorrect!\n{F3FF02}Please, re-enter the Correct Password:\n\n{C9FFAB}Or type the response of your security question:\n\n \"%s\"",pName(playerid),dini_Get(file, "Question")); return ShowPlayerDialog(playerid,DIALOGID+69,DIALOG_STYLE_INPUT,"Login Error",lstring,"Login","Quit"); } } } else { if(strcmp(Pass, buf, false) == 0 || strcmp(Question, buf2, false) == 0) { new tmp3[100], string[128]; format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid))); GetPlayerIp(playerid,tmp3,100); dini_Set(file,"Ip",tmp3); LoginPlayer(playerid); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); if(AccInfo[playerid][Level] > 0) { switch(AccInfo[playerid][Level]) { case 1: AdmRank = "Trail Mod"; case 2: AdmRank = "Mod"; case 3: AdmRank = "Admin"; case 4: AdmRank = "Leader"; case 5: AdmRank = "CO-Manager"; } if(AccInfo[playerid][Level] > 5) { AdmRank = "Manager"; } if(AccInfo[playerid][pVip] > 0) { switch(AccInfo[playerid][pVip]) { case 1: AccType = "FREE"; case 2: AccType = "Casher"; case 3: AccType = "Gold"; } format(string,sizeof(string),"Account: You have Successfully Logged! {00AAAA}Account: %s | Level %d - %s", AccType, AccInfo[playerid][Level], AdmRank); return SendClientMessage(playerid,0x00C378AA,string); } else { format(string,sizeof(string),"Account: You have Successfully Logged! {00AAAA}Level %d - %s", AccInfo[playerid][Level], AdmRank); return SendClientMessage(playerid,green,string); } } else { if(AccInfo[playerid][pVip] > 0) { switch(AccInfo[playerid][pVip]) { case 1: AccType = "Silver"; case 2: AccType = "Gold"; case 3: AccType = "Premium"; } format(string,sizeof(string),"Account: You have Successfully logged! {00AAAA}Account: %s", AccType); return SendClientMessage(playerid,0x00C896AA,string); } else return SendClientMessage(playerid,green,"Account: You have Successfully {C77D87}logged!"); } } else { AccInfo[playerid][FailLogin]++; printf("LOGIN: Failed Login: %s. Wrong password (%s) (%d)", PlayerName2(playerid), inputtext, AccInfo[playerid][FailLogin] ); if(AccInfo[playerid][FailLogin] == MAX_FAIL_LOGINS) { new string[128]; format(string, sizeof(string), "*** %s has been automatically kicked {F81414}(Failed Login)", PlayerName2(playerid) ); SendClientMessageToAll(yellow, string); print(string); Kick(playerid); } if(AccInfo[playerid][NoQuestion] == 1) { format(lstring,256,"Sorry '%s'\n\n{FFAF00}Your entered password is Incorrect!\n{00AAAA}Please, re-enter the Correct Password:",pName(playerid)); return ShowPlayerDialog(playerid,DIALOGID+69,DIALOG_STYLE_INPUT,"Login Error",lstring,"Login","Quit"); } else if(AccInfo[playerid][NoQuestion] == 0) { format(lstring,256,"Sorry '%s'\n\n{FFAF00}Your entered password is Incorrect!\n{00AAAA}Please, re-enter the Correct Password:\n\n{00AAAA}Or type the response of your security question:\n\n \"%s\"",pName(playerid),dini_Get(file, "Question")); return ShowPlayerDialog(playerid,DIALOGID+69,DIALOG_STYLE_INPUT,"Login Error",lstring,"Login","Quit"); } } } } } #endif