Resolved Purchase of weapons from a certain LVL

Installation Problems Support
Post Reply
Papo4ka
Member
Member
Posts: 12
Joined: 3 Months Ago
Has thanked: 1 time
Been thanked: 0
Contact:

Purchase of weapons from a certain LVL

#1

Post by Papo4ka » 3 Months Ago

Installed Levels-XP Systems, in the file ze_extraitems.ini :D I installed LEVEL = 3, but in the end, people can buy this weapon even from 1 LVL
[Fire Nade]
NAME = Fire Nade
COST = 3
LIMIT = 1
LEVEL = 3
The LVL system works, there are no errors in the logs.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#2

Post by Raheem » 3 Months Ago

Post your plugins-zombie_escape.ini
You don't know? Learn and you will know.

Papo4ka
Member
Member
Posts: 12
Joined: 3 Months Ago
Has thanked: 1 time
Been thanked: 0
Contact:

#3

Post by Papo4ka » 3 Months Ago

;Core
ze_core.amxx

;Setting API / Models
amx_settings_api.amxx
cs_weap_models_api.amxx

;Mod Addons
ze_block_events_messages.amxx
ze_effects_messages.amxx
ze_nightvision_lighting.amxx
ze_effects_frags.amxx
ze_effects_weather.amxx
ze_coins_system.amxx
ze_hud_info.amxx
ze_weapon_menu.amxx
ze_main_menu.amxx
ze_items_manager.amxx
ze_items_escape_coins.amxx
ze_items_limit.amxx
ze_madness.amxx
ze_fire.amxx
ze_frost.amxx
ze_extra_fire_nade.amxx
ze_extra_frost_nade.amxx
ze_resources.amxx
ze_countdown.amxx
ze_zombie_sounds.amxx
ze_level_system.amxx
ze_health_bar.amxx
ze_win_message.amxx
ze_extra_watergun.amxx
;Enable if needed
ze_items_level.amxx ;Level System needed.
;ze_items_vip.amxx ;VIP System needed.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#4

Post by Raheem » 3 Months Ago

OK, ze_items_level.amxx is enabled but it's probably you did not use the native ze_set_item_level(iItemid, iLevel) in the plugin you try to set level to, example you trying to make level for Fire Nade, you must open ze_extra_fire_nade.sma and find this line:
g_iItemID = ze_register_item("Fire Nade", 30, 1) and add under it this line: ze_set_item_level(g_iItemID, 3), so final code:
    1. #include <zombie_escape>
    2.  
    3. // Default Sound
    4. new const g_szBuyAmmoSound[] = "items/9mmclip1.wav"
    5.  
    6. // Variables
    7. new g_iItemID
    8.  
    9. public plugin_init()
    10. {
    11.     register_plugin("[ZE] Items: Fire Nade", ZE_VERSION, AUTHORS)
    12.    
    13.     // Register our item
    14.     g_iItemID = ze_register_item("Fire Nade", 30, 1)
    15.     ze_set_item_level(g_iItemID, 3)
    16. }
    17.  
    18. public ze_select_item_pre(id, itemid)
    19. {
    20.     // Return Available and we will block it in Post, So it dosen't affect other plugins
    21.     if (itemid != g_iItemID)
    22.         return ZE_ITEM_AVAILABLE
    23.    
    24.     // Available for Humans only, So don't show it for zombies
    25.     if (ze_is_user_zombie(id))
    26.         return ZE_ITEM_DONT_SHOW
    27.    
    28.     return ZE_ITEM_AVAILABLE
    29. }
    30.  
    31. public ze_select_item_post(id, itemid)
    32. {
    33.     // This is not our item, Block it here
    34.     if (itemid != g_iItemID)
    35.         return
    36.    
    37.     // Get Weapon ID
    38.     new iWpnID = get_weaponid("weapon_hegrenade")
    39.    
    40.     // Player Don't have Frost Grenade then give him
    41.     if (rg_get_user_bpammo(id, WeaponIdType:iWpnID) == 0)
    42.     {
    43.         rg_give_item(id, "weapon_hegrenade", GT_APPEND)
    44.     }
    45.     else
    46.     {
    47.         // Player have, Increase his Back Pack Ammo, And play buy BP sound + Hud Flash
    48.         rg_set_user_bpammo(id, WeaponIdType:iWpnID, rg_get_user_bpammo(id, WeaponIdType:iWpnID) + 1)
    49.         emit_sound(id, CHAN_ITEM, g_szBuyAmmoSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
    50.         Show_Given_BPAmmo(id, 12, 1) // HE Grenade AmmoType Const = 12
    51.     }
    52. }
Just compile and try.
You don't know? Learn and you will know.

Papo4ka
Member
Member
Posts: 12
Joined: 3 Months Ago
Has thanked: 1 time
Been thanked: 0
Contact:

#5

Post by Papo4ka » 3 Months Ago

Thank you, it works.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#6

Post by Raheem » 3 Months Ago

You are welcome.
These users thanked the author Raheem for the post:
Papo4ka (3 Months Ago)
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests