zp50_items.inc
Original include source with line numbers.
| 1 | #if defined _zp50_items_included |
| 2 | #endinput |
| 3 | #endif |
| 4 | #define _zp50_items_included |
| 5 | |
| 6 | #include <zp50_core> |
| 7 | #include <zp50_items_const> |
| 8 | |
| 9 | #if AMXX_VERSION_NUM >= 175 |
| 10 | #pragma reqlib zp50_items |
| 11 | #if !defined AMXMODX_NOAUTOLOAD |
| 12 | #pragma loadlib zp50_items |
| 13 | #endif |
| 14 | #else |
| 15 | #pragma library zp50_items |
| 16 | #endif |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Registers a custom item which will be added to the extra items menu of ZP. |
| 21 | * |
| 22 | * Note: The returned item ID can be later used to catch item |
| 23 | * selection events for the zp_item_select_() forwards. |
| 24 | * |
| 25 | * @param name Caption to display on the menu. |
| 26 | * @param cost Cost to display on the menu. |
| 27 | * @return An internal item ID, or ZP_INVALID_ITEM on failure. |
| 28 | */ |
| 29 | native zp_items_register(const name[], cost) |
| 30 | |
| 31 | /** |
| 32 | * Returns an item's ID. |
| 33 | * |
| 34 | * @param name Item name to look for. |
| 35 | * @return Internal item ID, or ZP_INVALID_ITEM if not found. |
| 36 | */ |
| 37 | native zp_items_get_id(const real_name[]) |
| 38 | |
| 39 | /** |
| 40 | * Returns an item's name. |
| 41 | * |
| 42 | * @param itemid A valid item ID. |
| 43 | * @param name The buffer to store the string in. |
| 44 | * @param len Character size of the output buffer. |
| 45 | * @return True on success, false otherwise. |
| 46 | */ |
| 47 | native zp_items_get_name(itemid, name[], len) |
| 48 | |
| 49 | /** |
| 50 | * Returns an item's real name (used when registering the item). |
| 51 | * |
| 52 | * @param classid A valid item ID. |
| 53 | * @param name The buffer to store the string in. |
| 54 | * @param len Character size of the output buffer. |
| 55 | * @return True on success, false otherwise. |
| 56 | */ |
| 57 | native zp_items_get_real_name(itemid, real_name[], len) |
| 58 | |
| 59 | /** |
| 60 | * Returns an item's cost. |
| 61 | * |
| 62 | * @param itemid A valid item ID. |
| 63 | * @return Item's cost. |
| 64 | */ |
| 65 | native zp_items_get_cost(itemid) |
| 66 | |
| 67 | /** |
| 68 | * Shows menu with available extra items for player. |
| 69 | * |
| 70 | * @param id Player index. |
| 71 | */ |
| 72 | native zp_items_show_menu(id) |
| 73 | |
| 74 | /** |
| 75 | * Forces a player to buy an extra item. |
| 76 | * |
| 77 | * @param id Player index. |
| 78 | * @param itemid A valid extra item ID. |
| 79 | * @param ignorecost If set, item's cost won't be deduced from player. |
| 80 | * @return True on success, false otherwise. |
| 81 | */ |
| 82 | native zp_items_force_buy(id, itemid, ignorecost = false) |
| 83 | |
| 84 | /** |
| 85 | * Appends text to an item being displayed on the extra items menu. |
| 86 | * Use this on the item select pre forward. |
| 87 | * |
| 88 | * @param text Additional text to display. |
| 89 | */ |
| 90 | native zp_items_menu_text_add(const text[]) |
| 91 | |
| 92 | /** |
| 93 | * Called when determining whether an item should be available to a player. |
| 94 | * |
| 95 | * Possible return values are: |
| 96 | * - ZP_ITEM_AVAILABLE (show in menu, allow selection) |
| 97 | * - ZP_ITEM_NOT_AVAILABLE (show in menu, don't allow selection) |
| 98 | * - ZP_ITEM_DONT_SHOW (don't show in menu, don't allow selection) |
| 99 | * |
| 100 | * @param id Player index. |
| 101 | * @param itemid Internal item ID. |
| 102 | * @param ignorecost Whether item cost should be ignored. |
| 103 | */ |
| 104 | forward zp_fw_items_select_pre(id, itemid, ignorecost) |
| 105 | |
| 106 | /** |
| 107 | * Called after a player selected an item from the extra items menu. |
| 108 | * |
| 109 | * @param id Player index. |
| 110 | * @param itemid Internal item ID. |
| 111 | * @param ignorecost Whether item cost should be ignored. |
| 112 | */ |
| 113 | forward zp_fw_items_select_post(id, itemid, ignorecost) |
| 114 | |