Dialog not working...
#1

Well yeah, I just cant figure out why this isn't working...it seems fine to my eyes, but maybe some more experienced scripter will detect the problem (When I select anything in the dialog it doesn't work.)

pawn Код:
if(dialogid == 60)
        {
            if(response)
            {
                if (listitem == 0)
                {
                    if(GetPlayerMoney(playerid) < 500)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                        new randphone = 1000 + random(8999);//minimum 1000  max 9999
                        AccountInfo[playerid][pPnumber] = randphone;
                        GivePlayerMoney(playerid,-500);
                        format(string, sizeof(string), "Mobile Phone purchased your new number is %d", randphone);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        OnPlayerUpdateAccount(playerid);
                    }
                }
                else if (listitem == 1)
                {
                    if(GetPlayerMoney(playerid) < 100)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        AccountInfo[playerid][pSeeds] = 5;
                        GivePlayerMoney(playerid,-100);
                        SCM(playerid,COLOR_GREEN,"You bought 5 seeds!");
                        OnPlayerUpdateAccount(playerid);
                    }
                }
                else if (listitem == 2)
                {
                    if(GetPlayerMoney(playerid) < 25)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        GivePlayerMoney(playerid,-25);
                        SCM(playerid,COLOR_GREEN,"You bought a cigarette!");
                        SetPlayerSpecialAction(playerid,21);
                    }
                }
                else if (listitem == 3)
                {
                    if(GetPlayerMoney(playerid) < 15)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        GivePlayerMoney(playerid,-15);
                        SCM(playerid,COLOR_GREEN,"You bought a bottle of beer!");
                        SetPlayerSpecialAction(playerid,20);
                    }
                }
                else if (listitem == 4)
                {
                    if(GetPlayerMoney(playerid) < 1000)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        AccountInfo[playerid][pCB] = 1;
                        GivePlayerMoney(playerid,-1000);
                        SCM(playerid,COLOR_GREEN,"You bought a CB Radio! (/joinchannel , /cb )");
                        OnPlayerUpdateAccount(playerid);
                    }
                }
                else if (listitem == 5)
                {
                    SCM(playerid,COLOR_RED,"Sorry we are out of stock with phone books, come back later!");
                }
                else if (listitem == 6)
                {
                    if(GetPlayerMoney(playerid) < 100)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        SetPlayerHealth(playerid,100);
                        SCM(playerid,COLOR_GREEN,"You ate some tacos!");
                    }
                }
                else if (listitem == 7)
                {
                    if(GetPlayerMoney(playerid) < 100)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        GivePlayerWeapon(playerid,46,1);
                        SCM(playerid,COLOR_GREEN,"You bought a parachute!");
                    }
                }
            }
        }
Reply
#2

maybe try something like this
pawn Код:
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, Blabla);//your more Code ..
Reply
#3

Thats how I originally made it so I thought that was the problem and changed the code into that but obviosly it wasn't.
Reply
#4

Return your dialog..

pawn Код:
if(dialogid == 60)
        {
            if(response)
            {
                if (listitem == 0)
                {
                    if(GetPlayerMoney(playerid) < 500)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                        new randphone = 1000 + random(8999);//minimum 1000  max 9999
                        AccountInfo[playerid][pPnumber] = randphone;
                        GivePlayerMoney(playerid,-500);
                        format(string, sizeof(string), "Mobile Phone purchased your new number is %d", randphone);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        OnPlayerUpdateAccount(playerid);
                    }
                }
                else if (listitem == 1)
                {
                    if(GetPlayerMoney(playerid) < 100)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        AccountInfo[playerid][pSeeds] = 5;
                        GivePlayerMoney(playerid,-100);
                        SCM(playerid,COLOR_GREEN,"You bought 5 seeds!");
                        OnPlayerUpdateAccount(playerid);
                    }
                }
                else if (listitem == 2)
                {
                    if(GetPlayerMoney(playerid) < 25)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        GivePlayerMoney(playerid,-25);
                        SCM(playerid,COLOR_GREEN,"You bought a cigarette!");
                        SetPlayerSpecialAction(playerid,21);
                    }
                }
                else if (listitem == 3)
                {
                    if(GetPlayerMoney(playerid) < 15)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        GivePlayerMoney(playerid,-15);
                        SCM(playerid,COLOR_GREEN,"You bought a bottle of beer!");
                        SetPlayerSpecialAction(playerid,20);
                    }
                }
                else if (listitem == 4)
                {
                    if(GetPlayerMoney(playerid) < 1000)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        AccountInfo[playerid][pCB] = 1;
                        GivePlayerMoney(playerid,-1000);
                        SCM(playerid,COLOR_GREEN,"You bought a CB Radio! (/joinchannel , /cb )");
                        OnPlayerUpdateAccount(playerid);
                    }
                }
                else if (listitem == 5)
                {
                    SCM(playerid,COLOR_RED,"Sorry we are out of stock with phone books, come back later!");
                }
                else if (listitem == 6)
                {
                    if(GetPlayerMoney(playerid) < 100)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        SetPlayerHealth(playerid,100);
                        SCM(playerid,COLOR_GREEN,"You ate some tacos!");
                    }
                }
                else if (listitem == 7)
                {
                    if(GetPlayerMoney(playerid) < 100)
                    {
                        SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
                    }
                    else
                    {
                        GivePlayerWeapon(playerid,46,1);
                        SCM(playerid,COLOR_GREEN,"You bought a parachute!");
                    }
                }
            }
            return 1;
        }
Reply
#5

Tried that aswell already, no effect
Reply
#6

Look, idk but i think you should put
Код:
if (response)
before
Код:
if (dialogid == 60)
Reply
#7

That doesnt make sense or does it?
Reply
#8

change
pawn Код:
else if(listitem...)
to
pawn Код:
if(listitem...)
Reply
#9

pawn Код:
if(dialogid == 60)
{
    if(response) {
        if (listitem == 0) {
            if(GetPlayerMoney(playerid) < 500) {
                SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
            }
            else {
                PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); //minimum 1000  max 9999
                new randphone = 1000 + random(8999);
                AccountInfo[playerid][pPnumber] = randphone;
                GivePlayerMoney(playerid,-500);
                format(string, sizeof(string), "Mobile Phone purchased your new number is %d", randphone);
                SendClientMessage(playerid, COLOR_GREEN, string);
                OnPlayerUpdateAccount(playerid);
            }
        }
        if (listitem == 1) {
            if(GetPlayerMoney(playerid) < 100) {
                SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
            }
            else {
                AccountInfo[playerid][pSeeds] = 5;
                GivePlayerMoney(playerid,-100);
                SCM(playerid,COLOR_GREEN,"You bought 5 seeds!");
                OnPlayerUpdateAccount(playerid);
            }
        }
        if (listitem == 2) {
            if(GetPlayerMoney(playerid) < 25) {
                SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
            }
            else {
                GivePlayerMoney(playerid,-25);
                SCM(playerid,COLOR_GREEN,"You bought a cigarette!");
                SetPlayerSpecialAction(playerid,21);
            }
        }
        if (listitem == 3) {
            if(GetPlayerMoney(playerid) < 15) {
                SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
            }
            else {
                GivePlayerMoney(playerid,-15);
                SCM(playerid,COLOR_GREEN,"You bought a bottle of beer!");
                SetPlayerSpecialAction(playerid,20);
            }
        }
        if (listitem == 4) {
            if(GetPlayerMoney(playerid) < 1000) {
                SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
            }
            else {
                AccountInfo[playerid][pCB] = 1;
                GivePlayerMoney(playerid,-1000);
                SCM(playerid,COLOR_GREEN,"You bought a CB Radio! (/joinchannel , /cb )");
                OnPlayerUpdateAccount(playerid);
            }
        }
        if (listitem == 5) {
            SCM(playerid,COLOR_RED,"Sorry we are out of stock with phone books, come back later!");
        }
        if (listitem == 6) {
            if(GetPlayerMoney(playerid) < 100) {
                SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
            }
            else {
                SetPlayerHealth(playerid,100);
                SCM(playerid,COLOR_GREEN,"You ate some tacos!");
            }
        }
        if (listitem == 7) {
            if(GetPlayerMoney(playerid) < 100) {
                SCM(playerid,COLOR_RED,"You dont have enough money to buy this!");
            }
            else {
                GivePlayerWeapon(playerid,46,1);
                SCM(playerid,COLOR_GREEN,"You bought a parachute!");
            }
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)