Skip to content

discount

shanapu edited this page Aug 29, 2019 · 1 revision

Discount misc module

The discount module makes it possible to plan sales and discounts for items or entire categories at a certain time. You can restrict the players who receive these discounts by using flags. You can also exclude items with discounts if you discount an entire category or the items have a plan/subscription. You can discount fixed amounts of credits or a percentage of the item price. In the same way the prices of articles and categories can be increased. You can choose, should two or more discounts be active, whether the discounts should be added together or only the highest discount should count. When the discount should start by schedule but there are not enough players online, it wait until enough players are online before activate discount.

Picture

How it works

The module reads the configuration file (.csgo/addons/sourcemod/configs/mystore/discount.txt) only once when starting the plugin, not when changing maps. A timer checks every minute whether one of the discounts starts/ends or should be active (on server-, mapstart with active discount). When a discount starts, it can be announced to the players chat. Even if a new player joins the server while a discount is active, it can still be announced in his chat. However, it will not be announced if the player is not affected (flag discount). When a player opens the shop menu, the core "asks" for every shown item if it's discounted for the player and receives the new prices. Once the discount ends, the prices will be normalized, even if the player still has an open menu with discount prices. The discounted price is saved after the purchase and used when selling the item.

How to configure the discounts (.csgo/addons/sourcemod/configs/mystore/discount.txt)

Please read the instructions in discount config file guide.

Console Variables (.csgo/cfg/sourcemod/mystore/discount.cfg)

// 0 - Only the highest discount is granted / 1 - add all active discounts together
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
store_discount_add "0"

Limitations

You can maximal set 32 discounts and every discount can maximal exclude 16 items or types from a discount. If you need more than these you can edit the source.
In addons/sourcemod/scripting/mystore_discount.sp search for:

#define MAX_DISCOUNTS 32
#define MAX_DISCOUNTS_EXCLUDES 16

Clone this wiki locally