Help with dialog
#1

I made a dialog that works but it just doesn't take the players money from them when they buy it.

pawn Код:
if(dialogid == 6 && response)//if your using only one dialog this isn't needed but you never know.
     {
    switch(listitem)//wich listitem is chosen
    {
    case 0:
     {
    Snack[playerid] = 1;
     if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, red, "You need $100 to buy a snack.");
     if(GetPlayerMoney(playerid) > 100) return SendClientMessage(playerid, green, "You have bought a snack. Use /eatsnack to use it at any time.");
    if(Snack[playerid] == 1) return SendClientMessage(playerid, red, "You already have a snack.");
     GivePlayerMoney(playerid, -100);
    GetPlayerName(playerid, pname, 24);
    format(file,sizeof(file),USER_FILES, pname);
    if(!dini_Exists(file))
    {
    dini_Create(file);
    dini_IntSet(file, "Snack",Snack[playerid] = 1);
    }
    }
    }
    }
Reply
#2

pawn Код:
if(dialogid == 6)
{
    if(response)
    {
        if(listitem == 0)
        {
            if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, red, "You need $100 to buy a snack.");
            {
                if(Snack[playerid] == 1) return SendClientMessage(playerid, red, "You already have a snack.");
                {
                    SendClientMessage(playerid, green, "You have bought a snack. Use /eatsnack to use it at any time.");
                    Snack[playerid] = 1;
                    GivePlayerMoney(playerid, -100);
                    GetPlayerName(playerid, pname, 24);
                    format(file, sizeof(file), USER_FILES, pname);
                    if(!dini_Exists(file))
                    {
                        dini_Create(file);
                        dini_IntSet(file, "Snack", Snack[playerid]);

                    }
                }
            }
        }
    }
}
Reply
#3

Thanks but i have other dialogs on my script that look just like mine but they work.

And how to know what listitem id to put?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)