25.06.2011, 04:20
HEre is that code:
HTML Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) //the callback { if (dialogid == 1) //checking dialogid { if (response == 1) //making sure "Login" was pressed { if (udb_CheckLogin(ReturnPlayerName(playerid),inputtext)) //checking if it is the players password { PlayerInfo[playerid][Jailed] = (dUserINT(ReturnPlayerName(playerid)).("Jailed")); PlayerInfo[playerid][Frozen] = (dUserINT(ReturnPlayerName(playerid)).("Frozen")); PLAYERLIST_authed[playerid]=true; TogglePlayerControllable(playerid, true); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); return SendClientMessage(playerid,COLOR_MAIN,"{00ff00}[Server:] {dfebff} Successfully Authorized!");//SystemMsg(playerid,"Successfully authed!"); } else //incorrect password { new string[256]; format(string,sizeof(string),"[!!Warning!!] Failed Login Attempt by %s Detected. Player may be attempting to steal someone's account.",ReturnPlayerName(playerid)); for(new ra=0; ra<MAX_PLAYERS; ra++){ if(IsPlayerAdmin(ra) || IsPlayerLAdmin(ra)) { SendClientMessage(ra,COLOR_RED,string); } } ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Invalid Password", "Invalid Password, try again", "Login", "Cancel"); return SendClientMessage(playerid,red,"{ff0000}[Warning:] {dfebff} Login Failed!"); } } else //pressed "Cancel" { SendClientMessage(playerid,red,"{00ff00}[Server:] {dfebff} Please use /login [password] or reconnect and try again."); } } else if(dialogid == 2) //namechange dialog { //ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Name Change", "Incorrect Name, please retry.\nExample: John_Smith or Jane_Smith", "accept", "cancel"); if (response == 1) { //new PName[MAX_PLAYER_NAME]; //GetPlayerName(playerid,PName,sizeof(PName)); new namestring = strfind(inputtext, "_", true); if(namestring == -1) {//incorrect name ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Name Change", "Invalid Name, please retry.\nExample: John_Smith or Jane_Smith", "accept", "cancel"); return SendClientMessage(playerid,red,"{ff0000}[Error:] {dfebff} Name Change Failed!"); } else {//correct name PLAYERLIST_authed[playerid]=true; TogglePlayerControllable(playerid, true); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); SetPlayerName(playerid, inputtext); OnPlayerConnect(playerid); return SendClientMessage(playerid,COLOR_MAIN,"{00ff00}[Server:] {dfebff} Successfully Authorized! Welcome!");//SystemMsg(playerid,"Successfully authed!"); } } else //pressed "Cancel" { SendClientMessage(playerid,red,"{ff0000}[Warning:] {dfebff} Please relog to the server with an RP name. Example: John_Doe or Jane_Doe."); PlayerInfo[playerid][TimeX] = 0; Kick(playerid); } }