Fixed ZMarket bug that took money even if it was restricted or purchase count had been reached. (On rebuy)

This commit is contained in:
Greyscale 2009-07-02 01:12:41 -07:00
parent 879a31e8d6
commit 258d442f71

View File

@ -785,22 +785,6 @@ stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
return false; return false;
} }
// Get client's current money.
new cash = AccountGetClientCash(client);
// If client doesn't have enough money, tell them, resend menu, and then stop.
if (cash < itemprice)
{
// Update cookie with new weapon.
ZMarketSetRebuyCookie(client, slot, weapon);
TranslationPrintToChat(client, "Weapons zmarket updated loadout");
return false;
}
// Set client's new cash after purchase.
AccountSetClientCash(client, cash - itemprice);
// Check to make sure the weapon isn't restricted. // Check to make sure the weapon isn't restricted.
new bool:restricted = RestrictIsWeaponRestricted(weaponindex); new bool:restricted = RestrictIsWeaponRestricted(weaponindex);
if (restricted) if (restricted)
@ -819,6 +803,22 @@ stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
return false; return false;
} }
// Get client's current money.
new cash = AccountGetClientCash(client);
// If client doesn't have enough money, tell them, resend menu, and then stop.
if (cash < itemprice)
{
// Update cookie with new weapon.
ZMarketSetRebuyCookie(client, slot, weapon);
TranslationPrintToChat(client, "Weapons zmarket updated loadout");
return false;
}
// Set client's new cash after purchase.
AccountSetClientCash(client, cash - itemprice);
// Get a list of the client's current weapons. // Get a list of the client's current weapons.
new weapons[WeaponsSlot]; new weapons[WeaponsSlot];
WeaponsGetClientWeapons(client, weapons); WeaponsGetClientWeapons(client, weapons);