zm_vip.inc
Original include source with line numbers.
| 1 | /***************************************************************************** |
| 2 | * ZM VIP 2.0.0 inlcude file |
| 3 | * Author: aaarnas |
| 4 | * |
| 5 | * To make extra items, classes controlable by ZM VIP, add: |
| 6 | * #include <zm_vip> |
| 7 | * at the end of other #include's in plugin .sma file. Then compile |
| 8 | * plugin and add to server. You don't need to change anything. Just |
| 9 | * include this file to plugin and go on. Easy! |
| 10 | * |
| 11 | ***************************************************************************** |
| 12 | * Geek stuf: |
| 13 | * If you writing other plugins (not items or classes) or having problem |
| 14 | * with compability error, you can disable it (if you know what you are |
| 15 | * doing) by adding: |
| 16 | * #define ZM_VIP_DISABLE_AUTO_CONVERT |
| 17 | * at the top of plugin. |
| 18 | * For example, if you want to include <zm_vip> to extra item plugin and |
| 19 | * won't affect it to use with zombie VIP (left for main mod), add this |
| 20 | * define to the top of plugin and plugin will remains the same and you |
| 21 | * will be able to use all <zm_vip> natives and forwards. |
| 22 | ****************************************************************************/ |
| 23 | //---------------------------------------------------------------------------- |
| 24 | // Natives |
| 25 | //---------------------------------------------------------------------------- |
| 26 | /** |
| 27 | * Returns having player VIP flags. If @return > 0 - player is VIP. |
| 28 | * @id - player id |
| 29 | * @return - vip flags (return 0 if player not connected) |
| 30 | * For flags values check vips.ini file or zm_vip.sma at line: |
| 31 | * "enum _:player_attributes" |
| 32 | * Example for check if player has VIP model attribute: |
| 33 | * if (zv_get_user_flags(id)&AT_VIP_MODEL) |
| 34 | * |
| 35 | * If player is VIP: |
| 36 | * if (zv_get_user_flags(id)) |
| 37 | */ |
| 38 | native zv_get_user_flags(id) |
| 39 | |
| 40 | #define ZV_DURATION_IGNORE -1 |
| 41 | #define ZV_DURATION_PERMANENT 0 |
| 42 | #define ZV_DURATION_TILL_DISCONNECT ~'t' |
| 43 | #define ZV_DURATION_TILL_MAP ~('t'|'m') |
| 44 | /** |
| 45 | * Set VIP flags for player. |
| 46 | * @id - player id, 0 - all players |
| 47 | * @duration - time (in seconds), how long player will have VIP. |
| 48 | * Can be used ZV_DURATION_ constants. |
| 49 | * @flags - flags, what attributes VIP player will have. |
| 50 | * All AT_ constants, or use AT_ALL for all attributes. |
| 51 | * If you want to just give a VIP status without any abbilities, use AT_NONE flag. |
| 52 | * Because VIP can't exist without any flags set, having only this dummy flag, player can |
| 53 | * remain in VIP status on the system. |
| 54 | * @return - [true - VIP created/updated succesfully, |
| 55 | * false - used ZV_DURATION_IGNORE for player, that doesn't have VIP |
| 56 | * or player is not connected to server] |
| 57 | * |
| 58 | * NOTE: if id = 0, always returns true. |
| 59 | * Examples: |
| 60 | * If you want to set a new VIP: |
| 61 | * //player will get VIP privilegies for 2 days and only multijump and armor abbilities |
| 62 | * zv_set_user_flags(id, 60*60*24*2, AT_MULTIJUMP|AT_ARMOR) |
| 63 | * //player will get VIP all VIP privilegies for 30 days (1 month) |
| 64 | * zv_set_user_flags(id, 60*60*24*30, AT_ALL) |
| 65 | * Update existing: |
| 66 | * //update current user flags (adde extra gravity). Privilegie duration remains the same. |
| 67 | * //NOTE: if zv_set_user_flags(id, ZV_DURATION_IGNORE... will be called on player, that don't have privilegies |
| 68 | * //function will return false and no action will be taken. You need to set duration for first time. |
| 69 | * zv_set_user_flags(id, ZV_DURATION_IGNORE, zv_get_user_flags(id)|AT_EXTRA_GRAVITY) |
| 70 | */ |
| 71 | native zv_set_user_flags(id, duration, flags) |
| 72 | |
| 73 | /** |
| 74 | * Remove player VIP privilegie |
| 75 | * @id - player id, 0 - all players |
| 76 | * @return - [true - success, |
| 77 | * false - player not connected or doesn't have privilegies] |
| 78 | * |
| 79 | * NOTE: if id = 0, always returns true. |
| 80 | */ |
| 81 | native zv_remove_user_flags(id) |
| 82 | |
| 83 | /** |
| 84 | * Get count of currently existing registered VIPs |
| 85 | * @return - VIP'S count; |
| 86 | */ |
| 87 | native zv_get_vips_num() |
| 88 | |
| 89 | //---------------------------------------------------------------------------- |
| 90 | // Attributes (Flags) |
| 91 | //---------------------------------------------------------------------------- |
| 92 | #define AT_ALL 0 |
| 93 | #define AT_MULTIJUMP (1<<0) // a |
| 94 | #define AT_ARMOR (1<<1) // b |
| 95 | #define AT_UNLIMITED_CLIP (1<<2) // c |
| 96 | #define AT_NO_FALL_DMG (1<<3) // d |
| 97 | #define AT_DAMAGE_REWARD (1<<4) // e |
| 98 | #define AT_EXTRA_DMG (1<<5) // f |
| 99 | #define AT_EXTRA_HP (1<<6) // g |
| 100 | #define AT_EXTRA_GRAVITY (1<<7) // h |
| 101 | #define AT_EXTRA_FRAGS (1<<8) // i |
| 102 | #define AT_EXTRA_KILL_AMMO (1<<9) // j |
| 103 | #define AT_EXTRA_ARMOR (1<<10) // k |
| 104 | #define AT_EXTRA_INFECT_AMMO (1<<11) // l |
| 105 | #define AT_EXTRA_INFECT_HEALTH (1<<12) // m |
| 106 | #define AT_EXTRA_ITEMS (1<<12) // n |
| 107 | #define AT_VIP_MODEL (1<<14) // o |
| 108 | #define AT_VIP_CLASS (1<<15) // p |
| 109 | #define AT_CHATTAG (1<<16) // q |
| 110 | #define AT_VIPINSCORE (1<<17) // r |
| 111 | #define AT_CUSTOM_S (1<<18) // s |
| 112 | #define AT_CUSTOM_T (1<<19) // t |
| 113 | #define AT_CUSTOM_U (1<<20) // u |
| 114 | #define AT_CUSTOM_V (1<<21) // v |
| 115 | #define AT_CUSTOM_W (1<<22) // w |
| 116 | #define AT_CUSTOM_X (1<<23) // x |
| 117 | #define AT_CUSTOM_Y (1<<24) // y |
| 118 | #define AT_NONE (1<<25) // z |
| 119 | |
| 120 | ////////////////////////////////////////////////////////////////////////////// |
| 121 | /// Technical stuff, you don't need to do anything below /// |
| 122 | ////////////////////////////////////////////////////////////////////////////// |
| 123 | #pragma reqlib zm_vip |
| 124 | #if !defined AMXMODX_NOAUTOLOAD |
| 125 | #pragma loadlib zm_vip |
| 126 | #endif |
| 127 | //Workaround for #elseif bug. |
| 128 | #if !(defined ZM_VIP_DISABLE_AUTO_CONVERT) && defined _zombieplague_included |
| 129 | native zv_force_buy_extra_item(id, itemid, ignorecost = 0) |
| 130 | native zv_get_extra_item_id(const name[]) |
| 131 | forward zv_extra_item_selected(id, itemid) |
| 132 | native zv_register_extra_item(const name[], const description[], cost, team) |
| 133 | native zv_register_extra_item2(const name[], cost, teams) |
| 134 | native zv_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback) |
| 135 | #define zp_force_buy_extra_item zv_force_buy_extra_item |
| 136 | #define zp_get_extra_item_id zv_get_extra_item_id |
| 137 | #define zp_extra_item_selected zv_extra_item_selected |
| 138 | #define zp_register_extra_item zv_register_extra_item2 |
| 139 | #define zp_register_zombie_class zv_register_zombie_class |
| 140 | #endif |
| 141 | #if !(defined ZM_VIP_DISABLE_AUTO_CONVERT) && defined _zp50_items_included |
| 142 | native zv_items_register(const name[], cost) |
| 143 | #define zp_items_register zv_items_register |
| 144 | #endif |
| 145 | #if !(defined ZM_VIP_DISABLE_AUTO_CONVERT) && defined _zp50_class_zombie_included |
| 146 | native zv_class_zombie_register(const name[], const description[], health, Float:speed, Float:gravity) |
| 147 | #define zp_class_zombie_register zv_class_zombie_register |
| 148 | #endif |
| 149 | #if !(defined ZM_VIP_DISABLE_AUTO_CONVERT) && defined _zp50_class_human_included |
| 150 | native zv_class_human_register(const name[], const description[], health, Float:speed, Float:gravity) |
| 151 | #define zp_class_human_register zv_class_human_register |
| 152 | #endif |
| 153 | #if !(defined _zp50_items_included) && !(defined _zombieplague_included) && !(defined _zp50_class_zombie_included) && !(defined _zp50_class_human_included) && !(defined ZM_VIP_DISABLE_AUTO_CONVERT) |
| 154 | #error "Unknown plugin type. ZM VIP can't do anything with this plugin, or #include <zm_vip> is not at the end of other includes. Plugin should be zombie/human class or extra item" |
| 155 | #endif |