Raised This Month: $ Target: $400
 0% 

Help - zp_buymenu small code fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
plazma
Senior Member
Join Date: Oct 2013
Old 07-28-2018 , 05:54   Help - zp_buymenu small code fix
Reply With Quote #1

Error:
Code:
 07/28/2018 - 10:41:12: Start of error session.
L 07/28/2018 - 10:41:12: Info (map "zm_fdust2x2") (file "addons/amxmodx/logs/error_20180728.log")
L 07/28/2018 - 10:41:12: [ZE] Invalid extra item id (-1)
L 07/28/2018 - 10:41:12: [AMXX] Run time error 10 (plugin "zp_buymenu.amxx") (native "zp_force_buy_extra_item") - debug not enabled!
L 07/28/2018 - 10:41:12: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 07/28/2018 - 10:41:59: [ZE] Invalid extra item id (-1)
L 07/28/2018 - 10:41:59: [AMXX] Run time error 10 (plugin "zp_buymenu.amxx") (native "zp_force_buy_extra_item") - debug not enabled!
Source:
PHP Code:
stock ItemGive_Post(const id, const category, const item) {
    if(
category == KNIFE && HasKnife[id][item]) {
        
zp_force_buy_extra_item(idzp_get_extra_item_id(ItemTodo[category][item]), true)
        return 
PLUGIN_CONTINUE;
    }
    if(
get_currency(id) < ItemCost[category][item] || get_souls(id) < ItemSouls[category][item]) return PLUGIN_CONTINUE;
    if(
equal(ItemTodo[category][item], "weapon_"7)) UTIL_GiveWeapon(idItemTodo[category][item])
    else 
zp_force_buy_extra_item(idzp_get_extra_item_id(ItemTodo[category][item]), true)
    if(
ItemCost[category][item] > 0set_currency(idget_currency(id) - ItemCost[category][item])
    if(
ItemSouls[category][item] > 0set_souls(idget_souls(id) - ItemSouls[category][item])
    if(
ItemFlags[category][item] & FLAG_MItemUsed[id][category][item]++
    else 
ItemUsed[id][category][item] = ItemLimit[ROUNDS][category][item]
    if(
category == KNIFEHasKnife[id][item] = true
    ItemPlayerUsed
[category][item]++
    return 
PLUGIN_CONTINUE;

File.ini
PHP Code:
# Флаги:
# "a" - предмет не доступен до начала инфекции
# "b" - предмет не доступен после начала инфекции
# "c" - предмет не доступен первому зомби
# "d" - предмет не доступен последнему зомби
# "e" - предмет не доступен последнему человеку
# "f" - предмет не доступен в раунде "Infection" / "Инфекция"
# "g" - предмет не доступен в раунде "Multi" / "Мульти-Инфекция"
# "l" - мульти-ланг названия ("Название в меню" -> Ключевое слово для ланг-файла)
# "m" - RoundLimit = сколько раз за раунд доступен предмет

// a b c d e f g h i j k l m n o p q r s t u v w x y z

# Ключевые слова
# Name = Название в меюн
# ExtraName = Название в Extra / Оригинальное "weapon_*" название
# Cost = Цена
# Souls = Цена в душах
# Flags = Флаги
# RoundLimit = Сколько раз доступен предмет за раунд (для каждого игрока свой лимит)
# Players = Сколько должно быть игроков на сервере чтобы предмет был доступен
# MaxUsed = Сколько максиум раз можно купить предмет за раунд (общий лимит)

# Формат строки
"Name" "ExtraName" "Cost" "Souls" "Flags" "RoundLimit" "Players" "MaxUsed"

# Пример добавления предмета
"Desert Deagle" "weapon_deagle" "10" "" "ac" "5" "10" "50"

# Пример добавления блокирование поднятия оружия по левелу
"Веапонкей" "Требуемый левел"

# Не редактируйте текст в "[]"
# Соблюдайте формат добавления

[PISTOLS]
{
}

[
SHOTGUNS]
{
"SPAS-12" "spas12m" "45" "" "" "" "" ""
}

[
AUTOMATES]
{
"K1A(SE)" "k1ase" "35" "" "" "" "" ""
"MP7 Unicorn" "mp7h" "45" "" "" "" "" ""
}

[
RIFLES]
{
"AK74-U" "ak74u" "60" "" "" "" "" ""
"M14 Ebr." "m14" "60" "1" "" "" "" ""
"Bendita" "bendita" "100" "1" "" "" "" ""
}

[
MACHINEGUNS]
{
"QBB95-EX" "qbb95ex" "150" "1" "" "" "" ""
"M60E4" "m60e4" "175" "2" "" "" "" ""
}

[
ITEMS]
{
"Freezing Grenade" "weapon_flashbang" "100" "" "m" "2" "" ""
"Light Grenade" "weapon_smokegrenade" "30" "" "m" "4" "" ""
"NVG" "Nightvision" "100" "" "m" "1" "" ""
"First Aid Kit +30" "Medkit" "35" "" "m" "2" "" ""
"Deadly bullet" "Deadly bullet" "" "5" "m" "2" "8" ""
}

[
ZITEMS]
{
"Bomb infection" "Infection Bomb" "360" "3" "m" "1" "" "1"
"Chain infection" "Chainy infection" "150" "1" "m" "1" "" ""
"Madness (4 sek.)" "Zombie Madness" "200" "2" "m" "1" "" "3"
"Instant infection" "Instant infect" "150" "1" "m" "1" "" ""
}

[
KNIFE]
{
"Standart Knife" "standartknife" "" "" "" "" "" ""
"Strong Knife" "strongknife" "80" "" "" "" "" ""
}

[
VIP]
{
"Fire grenade" "weapon_hegrenade" "100" "" "m" "2" "" ""
}

[
WEAPONKEYS]
{

__________________
Free Palestine ♥
plazma is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-28-2018 , 07:47   Re: Help - zp_buymenu small code fix
Reply With Quote #2

First of all enable debug mode then get to fixing it, this is not the requests section.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
plazma
Senior Member
Join Date: Oct 2013
Old 07-28-2018 , 09:07   Re: Help - zp_buymenu small code fix
Reply With Quote #3

Error:
Code:
[ZE] Invalid extra item id (-1)
L 07/28/2018 - 15:08:17: [AMXX] Displaying debug trace (plugin "zp_buymenu.amxx")
L 07/28/2018 - 15:08:17: [AMXX] Run time error 10: native error (native "zp_force_buy_extra_item")
L 07/28/2018 - 15:08:17: [AMXX]    [0] r3473q06.sma.p::ItemGive_Post (line 463)
L 07/28/2018 - 15:08:17: [AMXX]    [1] r3473q06.sma.p::items_handler (line 313
PHP Code:
public items_handler(idmenuitem) {
    if (
item == MENU_EXIT)    return PLUGIN_HANDLED;
    
ItemGive_Post(idUserCategory[id], item)
    
UserCategory[id] = CATEGORY_OFF
    
return PLUGIN_HANDLED;

__________________
Free Palestine ♥
plazma is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-28-2018 , 12:18   Re: Help - zp_buymenu small code fix
Reply With Quote #4

Code:
[ZE] Invalid extra item id (-1)
Show the code of ItemGive_Post.
__________________








CrazY. is offline
plazma
Senior Member
Join Date: Oct 2013
Old 07-28-2018 , 18:02   Re: Help - zp_buymenu small code fix
Reply With Quote #5

Quote:
Originally Posted by CrazY. View Post
Code:
[ZE] Invalid extra item id (-1)
Show the code of ItemGive_Post.
Source:
PHP Code:
stock ItemGive_Post(const id, const category, const item) {
    if(
category == KNIFE && HasKnife[id][item]) {
        
zp_force_buy_extra_item(idzp_get_extra_item_id(ItemTodo[category][item]), true)
        return 
PLUGIN_CONTINUE;
    }
    if(
get_currency(id) < ItemCost[category][item] || get_souls(id) < ItemSouls[category][item]) return PLUGIN_CONTINUE;
    if(
equal(ItemTodo[category][item], "weapon_"7)) UTIL_GiveWeapon(idItemTodo[category][item])
    else 
zp_force_buy_extra_item(idzp_get_extra_item_id(ItemTodo[category][item]), true)
    if(
ItemCost[category][item] > 0set_currency(idget_currency(id) - ItemCost[category][item])
    if(
ItemSouls[category][item] > 0set_souls(idget_souls(id) - ItemSouls[category][item])
    if(
ItemFlags[category][item] & FLAG_MItemUsed[id][category][item]++
    else 
ItemUsed[id][category][item] = ItemLimit[ROUNDS][category][item]
    if(
category == KNIFEHasKnife[id][item] = true
    ItemPlayerUsed
[category][item]++
    return 
PLUGIN_CONTINUE;

__________________
Free Palestine ♥
plazma is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-28-2018 , 18:23   Re: Help - zp_buymenu small code fix
Reply With Quote #6

Code:
stock ItemGive_Post(const id, const category, const item) {     new iItemId = zp_get_extra_item_id(ItemTodo[category][item]);     if (iItemId == -1)         return PLUGIN_CONTINUE;     if(category == KNIFE && HasKnife[id][item]) {         zp_force_buy_extra_item(id, iItemId, true)         return PLUGIN_CONTINUE;     }     if(get_currency(id) < ItemCost[category][item] || get_souls(id) < ItemSouls[category][item]) return PLUGIN_CONTINUE;     if(equal(ItemTodo[category][item], "weapon_", 7)) UTIL_GiveWeapon(id, ItemTodo[category][item])     else zp_force_buy_extra_item(id, iItemId, true)     if(ItemCost[category][item] > 0) set_currency(id, get_currency(id) - ItemCost[category][item])     if(ItemSouls[category][item] > 0) set_souls(id, get_souls(id) - ItemSouls[category][item])     if(ItemFlags[category][item] & FLAG_M) ItemUsed[id][category][item]++     else ItemUsed[id][category][item] = ItemLimit[ROUNDS][category][item]     if(category == KNIFE) HasKnife[id][item] = true     ItemPlayerUsed[category][item]++     return PLUGIN_CONTINUE; }
__________________








CrazY. is offline
plazma
Senior Member
Join Date: Oct 2013
Old 07-29-2018 , 04:18   Re: Help - zp_buymenu small code fix
Reply With Quote #7

Quote:
Originally Posted by CrazY. View Post
Code:
stock ItemGive_Post(const id, const category, const item) {     new iItemId = zp_get_extra_item_id(ItemTodo[category][item]);     if (iItemId == -1)         return PLUGIN_CONTINUE;     if(category == KNIFE && HasKnife[id][item]) {         zp_force_buy_extra_item(id, iItemId, true)         return PLUGIN_CONTINUE;     }     if(get_currency(id) < ItemCost[category][item] || get_souls(id) < ItemSouls[category][item]) return PLUGIN_CONTINUE;     if(equal(ItemTodo[category][item], "weapon_", 7)) UTIL_GiveWeapon(id, ItemTodo[category][item])     else zp_force_buy_extra_item(id, iItemId, true)     if(ItemCost[category][item] > 0) set_currency(id, get_currency(id) - ItemCost[category][item])     if(ItemSouls[category][item] > 0) set_souls(id, get_souls(id) - ItemSouls[category][item])     if(ItemFlags[category][item] & FLAG_M) ItemUsed[id][category][item]++     else ItemUsed[id][category][item] = ItemLimit[ROUNDS][category][item]     if(category == KNIFE) HasKnife[id][item] = true     ItemPlayerUsed[category][item]++     return PLUGIN_CONTINUE; }
I can't compile something wrong.
Code:
zp_buymenu.sma(457) : error 029: invalid expression, assumed zero
zp_buymenu.sma(457) : fatal error 107: too many error messages on one line
__________________
Free Palestine ♥

Last edited by plazma; 07-29-2018 at 04:23.
plazma is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-29-2018 , 09:37   Re: Help - zp_buymenu small code fix
Reply With Quote #8

Code:
stock ItemGive_Post(const id, const category, const item) {     new iItemId = zp_get_extra_item_id(ItemTodo[category][item]);     if (iItemId == -1)         return PLUGIN_CONTINUE;     if(category == KNIFE && HasKnife[id][item])     {         zp_force_buy_extra_item(id, iItemId, true)         return PLUGIN_CONTINUE;     }     if(get_currency(id) < ItemCost[category][item] || get_souls(id) < ItemSouls[category][item])         return PLUGIN_CONTINUE;     if(equal(ItemTodo[category][item], "weapon_", 7))         UTIL_GiveWeapon(id, ItemTodo[category][item])     else         zp_force_buy_extra_item(id, iItemId, true)     if(ItemCost[category][item] > 0)         set_currency(id, get_currency(id) - ItemCost[category][item])     if(ItemSouls[category][item] > 0)         set_souls(id, get_souls(id) - ItemSouls[category][item])     if(ItemFlags[category][item] & FLAG_M)         ItemUsed[id][category][item]++     else         ItemUsed[id][category][item] = ItemLimit[ROUNDS][category][item]     if(category == KNIFE)         HasKnife[id][item] = true     ItemPlayerUsed[category][item]++     return PLUGIN_CONTINUE; }
__________________








CrazY. is offline
plazma
Senior Member
Join Date: Oct 2013
Old 07-29-2018 , 10:13   Re: Help - zp_buymenu small code fix
Reply With Quote #9

No the same error. Why ?
__________________
Free Palestine ♥
plazma is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-29-2018 , 14:02   Re: Help - zp_buymenu small code fix
Reply With Quote #10

Post full code.
__________________








CrazY. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode