Combine this and work?
#1

Is there anyway to combine the two different Dialog responses and make it work..correctly?
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
    {
    switch(dialogid)
        {
        case 1:
            {
               switch(listitem)
            {
                case 0:
                {
                    if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -500);
                    GivePlayerWeapon(playerid, 24, 250);
                }
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 1300) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -1300);
                    GivePlayerWeapon(playerid, 29, 1500);
                }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -2500);
                    GivePlayerWeapon(playerid, 27, 400);
                }
            }
            }
    }
    }
    return 1;
    
}
and...this

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Registration", "Please input your password below.", "Register", "Leave");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel] = 0);
        dini_IntSet(file, "Faction",PlayerInfo[playerid][pFaction] = 0);
        dini_IntSet(file, "Job",PlayerInfo[playerid][pJob] = 0);
        dini_IntSet(file, "Bank",PlayerInfo[playerid][pBank] = 25000);
        format(string, 128, "[SYSTEM]: You succesfully registered the name %s with password %s, you have been logged in.", name, inputtext);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        gPlayerLogged[playerid] = 1;
        return 1;
     }
     
     if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Welcome back", "Please input your password below.", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp)
        {
            SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: You have entered the wrong password.");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Welcome back", "Please input your password below.", "Login", "Leave");
        }
            else
            {
                gPlayerLogged[playerid] = 1;
                PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
                PlayerInfo[playerid][pLevel] = dini_Int(file, "Level");
                PlayerInfo[playerid][pFaction] = dini_Int(file, "Faction");
                PlayerInfo[playerid][pJob] = dini_Int(file, "Job");
                SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
                GivePlayerMoney(playerid, dini_Int(file, "Cash")-GetPlayerMoney(playerid));
                SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
                return 1;
              }
      
    }
    return 0;
}
Reply
#2

Just put this in the second one and change the dialog ID in the first script:
OnDialogResponse(playerid, firstscriptdialog, response, listitem, inputtext);
Reply
#3

Sorry, I don't understand.
Reply
#4

Read it a couple of times, I can't explain it in any other way
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)