Dialog wont purchase or show errors
#4

See if this works:

Код:
#include <a_samp>

#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/ws", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, 2222, DIALOG_STYLE_LIST, "Weapon Shop", "Health - $50\nArmour - $100\n9mm - $275\nSilence Pistol - $310\nDesert Eagle - $450\nShotgun - $520\nSawn-Off Shotgun - $800\nCombat Shotgun - $845\nMicro SMG - $1000\nMP5 - $1200\nTec-9 - $3400\nAK-47 - $4000\nM4 - $4500\nCountry Rifle - $5000\nSniper Rifle - $5000", "Purchase", "Cancel");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 2222)
    {
        if(response)
        {
            if(listitem == 0)
            {
            if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, COLOR_RED, "You need $50. (/cashhelp)");
            SetPlayerHealth(playerid, 100); //Health
			GivePlayerMoney(playerid, -50);
            }
            if(listitem == 1)
            {
            if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "You need $100. (/cashhelp)");
            SetPlayerArmour(playerid, 100); //Armour
			GivePlayerMoney(playerid, -100);
            }
            if(listitem == 2)
            {
            if(GetPlayerMoney(playerid) < 275) return SendClientMessage(playerid, COLOR_RED, "You need $275. (/cashhelp)");
            GivePlayerWeapon(playerid, 22, 1500); //9mm
			GivePlayerMoney(playerid, -275);
            }
            if(listitem == 3)
            {
            if(GetPlayerMoney(playerid) < 310) return SendClientMessage(playerid, COLOR_RED, "You need $310. (/cashhelp)");
            GivePlayerWeapon(playerid, 23, 1500); //Silence Pistol
			GivePlayerMoney(playerid, -310);
            }
            if(listitem == 4)
            {
            if(GetPlayerMoney(playerid) < 450) return SendClientMessage(playerid, COLOR_RED, "You need $450. (/cashhelp)");
            GivePlayerWeapon(playerid, 24, 1500); //Desert Eagle
			GivePlayerMoney(playerid, -450);
            }
            if(listitem == 5)
            {
            if(GetPlayerMoney(playerid) < 520) return SendClientMessage(playerid, COLOR_RED, "You need $520. (/cashhelp)");
            GivePlayerWeapon(playerid, 25, 1500); //Shotgun
			GivePlayerMoney(playerid, -520);
            }
            if(listitem == 6)
            {
            if(GetPlayerMoney(playerid) < 800) return SendClientMessage(playerid, COLOR_RED, "You need $800. (/cashhelp)");
            GivePlayerWeapon(playerid, 26, 1500); //Sawn-off
			GivePlayerMoney(playerid, -800);
            }
            if(listitem == 7)
            {
            if(GetPlayerMoney(playerid) < 845) return SendClientMessage(playerid, COLOR_RED, "You need $845. (/cashhelp)");
            GivePlayerWeapon(playerid, 27, 1500); //Combat Shotgun
			GivePlayerMoney(playerid, -845);
            }
            if(listitem == 8)
            {
            if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "You need $1000. (/cashhelp)");
			GivePlayerWeapon(playerid, 28, 1500); //Micro SMG
			GivePlayerMoney(playerid, -1000);
            }
            if(listitem == 9)
            {
            if(GetPlayerMoney(playerid) < 1200) return SendClientMessage(playerid, COLOR_RED, "You need $1200. (/cashhelp)");
            GivePlayerWeapon(playerid, 29, 1500); //MP5
			GivePlayerMoney(playerid, -1200);
            }
            if(listitem == 10)
            {
            if(GetPlayerMoney(playerid) < 3400) return SendClientMessage(playerid, COLOR_RED, "You need $3400. (/cashhelp)");
            GivePlayerWeapon(playerid, 32, 1500); //Tec-9
			GivePlayerMoney(playerid, -3400);
            }
            if(listitem == 11)
            {
            if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, COLOR_RED, "You need $4000. (/cashhelp)");
    		GivePlayerWeapon(playerid, 30, 1500); //AK-47
			GivePlayerMoney(playerid, -4000);
            }
            if(listitem == 12)
            {
            if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED, "You need $4500. (/cashhelp)");
            GivePlayerWeapon(playerid, 31, 1500); //M4
			GivePlayerMoney(playerid, -4500);
            }
            if(listitem == 13)
            {
            if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)");
            GivePlayerWeapon(playerid, 33, 1500); //Country Rifle
			GivePlayerMoney(playerid, -5000);
            }
            if(listitem == 14)
            {
            if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You need $5000. (/cashhelp)");
            GivePlayerWeapon(playerid, 34, 1500); //Sniper Rifle
			GivePlayerMoney(playerid, -5000);
            }
            else // Pressed ESC or clicked cancel
            {
            SendClientMessage(playerid, COLOR_LIME, "Weapon shop closed. (/ws)");
            }
            return 1;
        }
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Dialog wont purchase or show errors - by NicholasA - 14.01.2013, 15:42
AW: Dialog wont purchase or show errors - by IPrototypeI - 14.01.2013, 15:49
Re: Dialog wont purchase or show errors - by NicholasA - 14.01.2013, 16:04
Re: Dialog wont purchase or show errors - by Goldino - 14.01.2013, 16:10
Re: Dialog wont purchase or show errors - by NicholasA - 15.01.2013, 14:00
Re: Dialog wont purchase or show errors - by ]Rafaellos[ - 15.01.2013, 14:17

Forum Jump:


Users browsing this thread: 3 Guest(s)