#9

Well, I could give you a temporary solution until we can find a permanent one, what you can do is this;

add this on top of your script somewhere;

pawn Код:
new successfulBuy[MAX_PLAYERS];
we'll edit it soon to tell the script if the buying action was successful

add this in OnPlayerConnect;

pawn Код:
successfulBuy[playerid] = 0;
change your armor buying to this;

pawn Код:
new Float:armour;
            GetPlayerArmour(playerid, armour);
            if(armour >= MAX_ARMOUR)
            {
                PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~You cannot buy any more armor.", 5000, 3);
            }
            else {
                successfulBuy[playerid] = 1;
                OnPlayerBuyInAmmuNation(playerid, 0, 100, COST_ARMOR);
            }
and add this if statement to your function;

pawn Код:
if(successfulBuy[playerid]) {
This will basically check if your function was called through the right means and not anywhere else. If your money doesn't get deducted this time, that means you are calling your armor buying function somewhere else as well.

Edit: Also don't forget to add successfulBuy[playerid] to all your items and don't forget to set successfulBuy back to 0 once the purchase is complete.
Reply


Messages In This Thread
Help - by KinderClans - 29.07.2018, 20:32
Re: Help - by Rufio - 29.07.2018, 20:36
Re: Help - by KinderClans - 29.07.2018, 20:39
Re: Help - by Rufio - 29.07.2018, 20:41
Re: Help - by Rufio - 29.07.2018, 20:47
Re: Help - by Florin48 - 29.07.2018, 20:52
Re: Help - by Rufio - 29.07.2018, 20:53
Re: Help - by KinderClans - 29.07.2018, 20:54
Re: Help - by Rufio - 29.07.2018, 20:59
Re: Help - by KinderClans - 29.07.2018, 21:11

Forum Jump:


Users browsing this thread: 2 Guest(s)