/
ttt_shop.inc
111 lines (97 loc) · 3.44 KB
/
ttt_shop.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#if defined _ttt_shop_included
#endinput
#endif
#define _ttt_shop_included
#define SHOP_ITEM_4ALL 1
/*
* Called when an item is purchased in the menu. Return Plugin_Stop
* to prevent us subtracting credits and informing the player that
* the item was purchased.
*
* @param client The client who purchased the item.
* @param itemshort The short-tag for the item's name.
* @param count TODO
*/
forward Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count);
forward Action TTT_OnItemPurchase(int client, int &price, bool &count, const char[] item);
forward void TTT_OnItemsReset();
/*
* Registers a custom item in the menu/shop.
*
* @param itemshort The short-tag identifier of the item (must be unique).
* @param itemlong The long fancy name for the item.
* @param price The price of the item.
* @param role The optional role to restrict the item to. (Default: 0 - for all)
* @param sort The priority in Sorting. Buy menu is sorted from high to low. (Default: 0)
* @param discount Item discountable for special players? (Default: false - Required: ttt_shop_discount)
*/
native bool TTT_RegisterCustomItem(const char[] itemshort, const char[] itemlong, int price, int role = 0, int sort = 0, bool discount = false);
/*
* Update shop item.
*
* @param itemshort The short-tag identifier to find the item.
* @param price The price of the item.
* @param sort The priority in Sorting. Buy menu is sorted from high to low.
* @param discount Item discountable for special players? (Required: ttt_shop_discount)
*/
native bool TTT_UpdateCustomItem(const char[] itemshort, int price, int sort = 0, bool discount = false);
/*
* Remove shop item.
*
* @param itemshort The short-tag identifier to find the item.
* @return True it was removed, otherwise shop item not found
*/
native bool TTT_RemoveCustomItem(const char[] itemshort);
/*
* Retrieve a custom item's price.
*
* @param item The short-tag identifier of the item.
*/
native int TTT_GetCustomItemPrice(const char[] item);
/*
* Retrieve a custom item's role restriction.
*
* @param item The short-tag identifier of the item.
*/
native int TTT_GetCustomItemRole(const char[] item);
/*
* Called after a players credits are modified.
*
* @param client Client index.
* @param credits The new amount of credits.
*/
forward void TTT_OnCreditsChanged(int client, int &credits);
/*
* Called before a players credits are modified.
*
* @param client Client index.
* @param oldcredits The old amount of credits.
* @param newcredits The new amount of credits.
*/
forward Action TTT_OnCreditsChanged_Pre(int client, int oldcredits, int &newcredits);
/*
* Retrieve a client's credits.
*
* @param client Client index.
*/
native int TTT_GetClientCredits(int client);
/*
* Set a client's credits.
*
* @param client Client index.
*/
native int TTT_SetClientCredits(int client, int credits);
/*
* Add a client's credits (currentCredits+credits).
*
* @param client Client index.
*/
native int TTT_AddClientCredits(int client, int credits);
/*
* Add item to client (without any costs)
*
* @param client Client Index
* @param item Short Item name
* @return True item found/valid, false item not found
*/
native bool TTT_GiveClientItem(int client, const char[] item);