29.07.2018, 20:59
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;
we'll edit it soon to tell the script if the buying action was successful
add this in OnPlayerConnect;
change your armor buying to this;
and add this if statement to your function;
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.
add this on top of your script somewhere;
pawn Код:
new successfulBuy[MAX_PLAYERS];
add this in OnPlayerConnect;
pawn Код:
successfulBuy[playerid] = 0;
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);
}
pawn Код:
if(successfulBuy[playerid]) {
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.