Problem with FS which have a Dialog System
#9

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
            case DIALOG_HOUSE:
            {
            if(!response) return 1;
            new
                string[200];
                switch(listitem)
                {
                case 0: {
                new id = Player[playerid][Houseid];
                if(id == 999) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You don't have house");
                if(!IsPlayerInRangeOfPoint(playerid,3.0,House[id][EnterX],House[id][EnterY],House[id][EnterZ])) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You are not near your house");
                format(House[id][Owner], 32, "Department");
                if(House[id][hCar] > 0) format(HouseOwner[House[id][hCar]],64,"Department");
                House[id][On_Sell] = 1;
                Player[playerid][Houseid] = 999;
                GivePlayerMoney(playerid,House[id][Price]/2);
                DestroyDynamicPickup(House[id][PickupU]);
                House[id][PickupU] = CreateDynamicPickup(1273, 23,  House[id][EnterX],House[id][EnterY],House[id][EnterZ],-1,-1,-1,100.0);
                DestroyDynamicMapIcon(House[id][Icon]);
                House[id][Icon] = CreateDynamicMapIcon(House[id][EnterX],House[id][EnterY],House[id][EnterZ], 31, 0, -1, -1, -1, 100.0);
                CheckHouse(id);
                UpdatePlayerInformation(playerid);
                format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"Department\n{29CC3F}House Name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"%d\n{29CC3F}Level: "COL_WHITE"%d\n{29CC3F}Address: "COL_WHITE"%s\n (/buyhouse)",House[id][HouseName],House[id][Price],House[id][Level],House[id][Address]);
                UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
                }
                case 1: {
                ShowPlayerDialog(playerid,DIALOG_HOUSE+1,DIALOG_STYLE_INPUT,""COL_YELLOW"Rent house",""COL_BLUE"Type rent price","Put","Close"); }
                case 2:
                {
                new id = Player[playerid][Houseid];
                foreach (Player, i)
                {
                    if(i != playerid)
                    {
                    if(strcmp(House[id][Player_Rent],GetName(playerid), false ) == 0) {SCM(i,COLOR_RED,"You have been evicted from house");}
                    format(House[id][Player_Rent],48,"Nobody");
                    }
                    }
                    }
                case 3: {
                        ShowPlayerDialog(playerid,DIALOG_HOUSE+2,DIALOG_STYLE_INPUT,""COL_YELLOW"House name",""COL_WHITE"Type new name of house","Name","Close");
                        }
                case 4: {
                        ShowPlayerDialog(playerid,DIALOG_HOUSE+3,DIALOG_STYLE_INPUT,""COL_YELLOW"Lock Password (numbers only)",""COL_WHITE"Type new password","Insert","Close");
                        }
                    }
                }
           case DIALOG_HOUSE+1:
           {
            if(!response) return 1;
            new string[210];
            new id = Player[playerid][Houseid];
            if(strval(inputtext) <= 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Price can't be less 1");
            House[id][RentPrice] = strval(inputtext);
            format(string,sizeof(string),"New rent price is $%d",strval(inputtext)); SCM(playerid,-1,string);
            format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[id][Owner],House[id][HouseName],House[id][Price],House[id][Level],House[id][RentPrice],House[id][Address]);
            UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
            CheckHouse(id);
           }
           case DIALOG_HOUSE+2:
           {
            if(!response) return 1;
            new string[210];
            new id = Player[playerid][Houseid];
            format(House[id][HouseName], 32, "%s", inputtext);
            format(string,sizeof(string),"{E0BC1B}Owner: "COL_WHITE"%s\n{E0BC1B}House name: "COL_WHITE"%s\n{E0BC1B}Price: "COL_WHITE"%d\n{E0BC1B}Level: "COL_WHITE"%d\n{E0BC1B}Rent price: "COL_WHITE"%d\n{E0BC1B}Address: "COL_WHITE"%s\n (/renthouse)",House[id][Owner],House[id][HouseName],House[id][Price],House[id][Level],House[id][RentPrice],House[id][Address]);
            UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
            CheckHouse(id);
           }
           case DIALOG_HOUSE+3:
           {
            if(!response) return 1;
            new string[128];
            new id = Player[playerid][Houseid];
            if(strlen(inputtext) >= 5 || strlen(inputtext) < 4) return ShowPlayerDialog(playerid,DIALOG_HOUSE+3,DIALOG_STYLE_INPUT,""COL_WHITE"Lock Password",""COL_BLUE"Type new password","Insert","Close"),SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"Just four numbers");
            format(House[id][LockPass],5,"%d",strval(inputtext));
            format(string,sizeof(string),"New password is %d",strval(inputtext)); SCM(playerid,-1,string);
            CheckHouse(id);
           }
           }
    return 0;
}
Like This
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)