SA-MP Forums Archive
Help with dialog - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with dialog (/showthread.php?tid=188517)



Help with dialog - zack3021 - 07.11.2010

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);
    }
    }
    }
    }



Re: Help with dialog - The_Moddler - 07.11.2010

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]);

                    }
                }
            }
        }
    }
}



Re: Help with dialog - zack3021 - 07.11.2010

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?