Buy Snack doesn't work?
#1

When I go into the gas station in Los Santos next to Well Stacked Pizza and LS Airport, I want to get a snack. But each time I want to buy, it says I don't have enough money when I have more than enough.

Here's my code:

Код:
		if(listitem == 1)
		{
		    if(pcash < 500)
		    {
		        SendClientMessage(playerid, COLOR_ERROR, "You do not have enough money to buy a snack.");
		        return 1;
			}
			SetPVarInt(playerid, "HasSnacks", GetPVarInt(playerid, "HasSnacks") +1);
			GivePlayerMoney(playerid, -500);
			SendClientMessage(playerid, COLOR_BLUE, "[ITEM BOUGHT] Snack: $500.");
			SendClientMessage(playerid, COLOR_BLUE, "This item will restore your health by 10 by using /snack");
			return 1;
		}
Ignore the "HasSnacks" as that doesn't come up. It says it's $500 but I have $15000. How come it still says "You do not have enough money to buy a snack."?
Reply
#2

Can someone please help me? Thanks,
Reply
#3

+rep if anyone can help!
Reply
#4

show us your other uses of pcash.
Reply
#5

Add:
pcash = GetPlayerMoney(playerid);
above, if(pcash < 500)
Reply
#6

Change if(pcash < 500) to if(pcash > 500).

Switch the inequities around, at the moment you're checking if the player has less than $500 rather than more than $500.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)