How would i turn these into dialogs
#8

A few seconds late but hope it helps. Again change the dialog numbers to whatever you need.

pawn Код:
if(strcmp(cmd, "/register", true) == 0)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register","", "Register", "Cancel");
}
if(strcmp(cmd, "/login", true) == 0)
{
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Enter Password","", "Login", "Cancel");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
    if(response == 1)
    {
      new name[MAX_PLAYER_NAME];
      tmp = strval(inputtext)
      GetPlayerName(playerid, name, sizeof(name));
      if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Password cannot be blank");
      format(file,sizeof(file),"%s.ini",name);
      if(!fexist(file))
      {
            dini_Create(file);
            dini_IntSet(file, "Password", udb_hash(tmp));
            dini_IntSet(file,"AdminLevel", 0);
            dini_IntSet(file,"Cash", 0);
            SendClientMessage(playerid, 0xFFFFFFFF, "[System]: Account Created!");
            PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            GetPlayerName(playerid, name, sizeof(name));
            printf("%s has registered a account!", name);
        }
        else
        {
          SendClientMessage(playerid, 0xFFFFFFFF, " Account Already Found In Database");
      PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        }
    }
    return 1;
    }
    if(dialogid == 2)
    {
    if(response == 1)
    {
      new PlayerName[24];
      tmp = strtok(cmdtext, idx);
      if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Password cannot be blank");
        new name[MAX_PLAYER_NAME];
        if(IsLogged[playerid] == 1)
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You already are logged in!");
            return 1;
        }
        else
        {
            GetPlayerName(playerid, name, sizeof(name));
            format(file,sizeof(file),"%s.ini",name);
            if(fexist(file))
            {
            tmp2 = dini_Get(file, "Password");
                if(udb_hash(tmp) != strval(tmp2))
                {
                  SendClientMessage(playerid, 0xFFFFFFFF, "Login Failed!");
                  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                  printf("%s has failed to login", name);
                }
                else
                {
                    IsLogged[playerid] = 1;
                    SetPlayerMoney(playerid, dini_Int(file, "Cash"));
                    PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
                    SendClientMessage(playerid, 0xFFFFFFFF, "[System]: Account Logged into!");
                }
            }
        }
    }
    return 1;
    }
}
Reply


Messages In This Thread
How would i turn these into dialogs - by Torran - 23.01.2010, 22:52
Re: How would i turn these into dialogs - by MaykoX - 24.01.2010, 06:36
Re: How would i turn these into dialogs - by Torran - 24.01.2010, 11:41
Re: How would i turn these into dialogs - by MadeMan - 24.01.2010, 12:42
Re: How would i turn these into dialogs - by Torran - 24.01.2010, 12:45
Re: How would i turn these into dialogs - by MadeMan - 24.01.2010, 12:53
Re: How would i turn these into dialogs - by Torran - 24.01.2010, 12:56
Re: How would i turn these into dialogs - by mansonh - 24.01.2010, 12:57
Re: How would i turn these into dialogs - by Torran - 24.01.2010, 13:15
Re: How would i turn these into dialogs - by mansonh - 24.01.2010, 13:20

Forum Jump:


Users browsing this thread: 1 Guest(s)