Editing into a Dialog please read!
#4

Try that:

pawn Код:
// When you call the dialog:
new pname[24];
new pfile[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile,sizeof(pfile),"Users/%s.ini",pname);
if(fexist(pfile))
{
  ShowPlayerDialog(playerid,1515,DIALOG_STYLE_INPUT,"Login to play","Password","Login","Exit");
}else{
  ShowPlayerDialog(playerid,1515,DIALOG_STYLE_INPUT,"Register to play","Password","Login","Exit");
}

// And the response:
public OnDialogResponse(...){
  if(dialogid == 1515){
    if(!response){
      kick(playerid);
      return true;
    }
    new pname[24];
     new pfile[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(pfile,sizeof(pfile),"Users/%s.ini",pname);
    if(fexist(pfile))
    {
      if(!strlen(inputtext)) return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"ENTER your password","Password","Login","Exit");
      if(!strcmp(udb_hash(inputtext),dini_Get(pfile, "Password"),false)){
        IsLogged[playerid] = 1;
        PlayerInfo[playerid][pAdminLevel] = dini_Int(pfile, "Admin Level");
        PlayerInfo[playerid][pVIPMember] = dini_Int(pfile, "VIP Member");
        PlayerInfo[playerid][pArmy] = dini_Int(pfile, "Army Rank");
        SetPlayerMoney(playerid, dini_Int(pfile, "Cash"));
        PlayerInfo[playerid][pBans] = dini_Int(pfile, "Bans");
        PlayerInfo[playerid][pKicks] = dini_Int(pfile, "Kicks");
        PlayerInfo[playerid][pWarns] = dini_Int(pfile, "Warns");
        PlayerInfo[playerid][pMuted] = dini_Int(pfile, "Muted");
        SendClientMessage(playerid, COLOR_WHITE, "You have successfully logged into your account.");
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        TogglePlayerControllable(playerid, 1);
      }else{
        return ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_INPUT,"Bad password","Try again","Login","Exit");
      }
    }else{
      // Create Account:
      format(pfile,sizeof(pfile),"Users/%s.ini",name);
      dini_Create(pfile);
      dini_IntSet(pfile, "Password", udb_hash(inputtext));
        dini_IntSet(pfile,"Admin Level", 0);
        dini_IntSet(pfile,"VIP Member", 0);
      dini_IntSet(pfile,"Army Rank", 0);
      dini_IntSet(pfile,"Cash", 0);
      dini_IntSet(pfile,"Bank", 0);
      dini_IntSet(pfile,"Bans", 0);
      dini_IntSet(pfile,"Kicks", 0);
      dini_IntSet(pfile,"Warns", 0);
      dini_IntSet(pfile,"Muted", 0);
      // Login player:
      IsLogged[playerid] = 1;
      PlayerInfo[playerid][pAdminLevel] = dini_Int(pfile, "Admin Level");
      PlayerInfo[playerid][pVIPMember] = dini_Int(pfile, "VIP Member");
      PlayerInfo[playerid][pArmy] = dini_Int(pfile, "Army Rank");
      SetPlayerMoney(playerid, dini_Int(pfile, "Cash"));
      PlayerInfo[playerid][pBans] = dini_Int(pfile, "Bans");
      PlayerInfo[playerid][pKicks] = dini_Int(pfile, "Kicks");
      PlayerInfo[playerid][pWarns] = dini_Int(pfile, "Warns");
      PlayerInfo[playerid][pMuted] = dini_Int(pfile, "Muted");
      TogglePlayerControllable(playerid, 1);
      SendClientMessage(playerid, COLOR_WHITE, "You have successfully registered a account. Enjoy the server!");
      PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
    }
  }
  return true;
}
Reply


Messages In This Thread
Editing into a Dialog please read! - by bauer123 - 01.04.2010, 22:49
Re: Editing into a Dialog please read! - by bartje01 - 01.04.2010, 23:04
Re: Editing into a Dialog please read! - by bauer123 - 01.04.2010, 23:32
Re: Editing into a Dialog please read! - by wafffllesss - 02.04.2010, 00:01
Re: Editing into a Dialog please read! - by bauer123 - 02.04.2010, 22:18
Re: Editing into a Dialog please read! - by bauer123 - 02.04.2010, 22:28

Forum Jump:


Users browsing this thread: 1 Guest(s)