Money problem...
#1

When i don't have enough money to buy an item, i dont get a message, "Not enough money" or anything and when i have money then the message appears lawl, this is code I used:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,22, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,23, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 2)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,32, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 3)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,25, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 4)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,28, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 5)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,29, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 6)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,30, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 7)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,31, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 8)
            {
                if(GetPlayerMoney(playerid) <= 0) return 0;
                SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
                if(GetPlayerMoney(playerid) <= 2000) return 0;
                GivePlayerWeapon(playerid,34, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);


            }
        }
    }
}
Reply
#2

pawn Код:
if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) <= 2000)
{
                GivePlayerWeapon(playerid,22, 500);
                TogglePlayerControllable(playerid,1);
                GivePlayerMoney(playerid,-2000);
}
else
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "Not enough money to buy this weapon");
}
            }
try this
(thats just for 1 item make for others youself )
Reply
#3

Its working now, thanks alot
Reply
#4

Above post fixed it.
Reply
#5

yes.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)