SA-MP Forums Archive
Dialog Problem - 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)
+--- Thread: Dialog Problem (/showthread.php?tid=469042)



Dialog Problem - yaron0600 - 11.10.2013

NVM Ty


Re: Dialog Problem - xVIP3Rx - 11.10.2013

Give this a try
pawn Код:
if(dialogid == EXCHANGECRATES)
    {
        if(!response) return 1;
        if(PlayerInfo[playerid][pGunCrates] == 0)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You do not have any Gun Crates!.");
            return 1;
        }
        switch( listitem )
        {
            case 0:
            {
                if(PlayerInfo[playerid][pGunCrates] < 1)
                {
                    SendClientMessageEx(playerid, COLOR_YELLOW, "You do not have enough GunCrates for this.");
                    return 1;
                }
                else
                {
                    PlayerInfo[playerid][pGunCrates] -= 1;
                    format(string, sizeof(string), "You have traded 1 GunCrates for a Desert Eagle, you now have %d GunCrates(s).", PlayerInfo[playerid][pGunCrates]);
                    SendClientMessageEx(playerid, COLOR_YELLOW, string);
                }
                GivePlayerValidWeapon(playerid, 24, 60000);
            }
            case 1:
            {
                if(PlayerInfo[playerid][pGunCrates] >= 2)
                {
                    PlayerInfo[playerid][pGunCrates] -= 2;
                    format(string, sizeof(string), "You have traded 2 GunCrates for a SPAS-12, you now have %d GunCrates(s).", PlayerInfo[playerid][pGunCrates]);
                    SendClientMessageEx(playerid, COLOR_YELLOW, string);
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_YELLOW, "You do not have enough GunCrates for this.");
                    return 1;
                }
                GivePlayerValidWeapon(playerid, 27, 60000);
            }
            case 2:
            {
                if(PlayerInfo[playerid][pGunCrates] < 2)
                {
                    SendClientMessageEx(playerid, COLOR_YELLOW, "You do not have enough GunCrates for this.");
                    return 1;
                }
                else
                {
                    PlayerInfo[playerid][pGunCrates] -= 2;
                    format(string, sizeof(string), "You have traded 2 GunCrates for an M4, you now have %d GunCrates(s).", PlayerInfo[playerid][pGunCrates]);
                    SendClientMessageEx(playerid, COLOR_YELLOW, string);
                }
                GivePlayerValidWeapon(playerid, 31, 60000);
            }
            case 3:
            {
                if(PlayerInfo[playerid][pGunCrates] < 2)
                {
                    SendClientMessageEx(playerid, COLOR_YELLOW, "You do not have enough GunCrates for this.");
                    return 1;
                }
                else
                {
                    PlayerInfo[playerid][pGunCrates] -= 2;
                    format(string, sizeof(string), "You have traded 2 GunCrates for an AK-47, you now have %d GunCrates(s).", PlayerInfo[playerid][pGunCrates]);
                    SendClientMessageEx(playerid, COLOR_YELLOW, string);
                }
                GivePlayerValidWeapon(playerid, 30, 60000);
            }
            case 4:
            {
                if(PlayerInfo[playerid][pGunCrates] > 3)
                {
                    PlayerInfo[playerid][pGunCrates] -= 3;
                    format(string, sizeof(string), "You have traded 3 GunCrates for a sniper rifle, you now have %d GunCrates(s).", PlayerInfo[playerid][pGunCrates]);
                    SendClientMessageEx(playerid, COLOR_YELLOW, string);
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_YELLOW, "VIP: You do not have enough GunCrates for this.");
                    return 1;
                }
                GivePlayerValidWeapon(playerid, 34, 60000);
            }
        }
    }