Buy Snack doesn't work? - 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: Buy Snack doesn't work? (
/showthread.php?tid=330217)
Buy Snack doesn't work? -
TheMightyEddy - 31.03.2012
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."?
Re: Buy Snack doesn't work? -
TheMightyEddy - 31.03.2012
Can someone please help me? Thanks,
Re: Buy Snack doesn't work? -
TheMightyEddy - 31.03.2012
+rep if anyone can help!
Re: Buy Snack doesn't work? -
introzen - 31.03.2012
show us your other uses of pcash.
Re: Buy Snack doesn't work? -
Catalyst- - 31.03.2012
Add:
pcash = GetPlayerMoney(playerid);
above, if(pcash < 500)
Re: Buy Snack doesn't work? -
MickeyB - 31.03.2012
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.