Raised This Month: $51 Target: $400
 12% 

Item shop plugin_handled not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 06-09-2023 , 02:06   Item shop plugin_handled not working
Reply With Quote #1

Hello, basically i have this item shop, where people can buy things off, every item can be made like in zombie plague extra shop, its like an API. For example i have armor, people can buy 100 armor for theirselves, but i want the armor limitation to be set, for example 1 time per round.
Problem starts when i buy it off the extra item shop, it doesnt even work, it only shows that i dont have enough money, but when i have, the item is not added to me/purchased. no logs also in console
Anyone can help?

Here is the menu handler for the API shop:

PHP Code:
public menu1_handle_human(idmenuitem)
{
    if(
item == MENU_EXIT || is_user_zombie(id))
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    static 
data[6], szName[64], accesscallback
    
static temp_integer1
    menu_item_getinfo
(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback)
    
    
temp_integer1 str_to_num(data)
    
    static 
costwp_name[64], wp_desc[64]
    
cost ArrayGetCell(Item_Costtemp_integer1)
    
ArrayGetString(Item_Nametemp_integer1wp_namesizeof(wp_name))
    
ArrayGetString(Item_Desctemp_integer1wp_descsizeof(wp_desc))
    
    static 
g_dummy

    
if(cs_get_user_money(id) <= cost) {
        
client_printc(id"!g*!n You don't have enough money for !t%s!n (price: !g%i$!n)"wp_namecost)
        return 
PLUGIN_HANDLED
    
}

    
temp_integer1++
    
ExecuteForward(g_selected_forwardg_dummyidtemp_integer1)
    if (
g_dummy >= BIO_PLUGIN_HANDLED)
    
cs_set_user_money(idcost)
       
    return 
PLUGIN_CONTINUE

Is there a missing forward at the end? So it works with my armor plugin?

Here is armor plugin example:

PHP Code:
if (itemid == g_itemid_humanarmor)
    {
        if(
is_user_zombie(player))
            return 
PLUGIN_HANDLED

        
else if(pev(playerpev_armorvalue) >= g_armor_limit)
        {
            
client_print_color(playerprint_chat"^4* ^1You already have maxed your armor!")
            return 
PLUGIN_HANDLED
        
}

        else if(
g_ItemCount[player] >= 1)
        {
            
client_print_color(playerprint_chat"^4* ^1You can buy armor only^3 1 ^1time in a round!")
            return 
PLUGIN_HANDLED
        
}
        else
        {
        
g_ItemCount[player]++
        
set_pev(playerpev_armorvaluefloat(min(pev(playerpev_armorvalue)+g_armor_amountg_armor_limit)))
        
engfunc(EngFunc_EmitSoundplayerCHAN_BODYg_sound_buyarmor1.0ATTN_NORM0PITCH_NORM)
        }
    } 

Last edited by HowToRuski; 06-09-2023 at 05:13.
HowToRuski is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-10-2023 , 00:20   Re: Item shop plugin_handled not working
Reply With Quote #2

What does this have to do with PLUGIN_HANDLED? I'm quite sure that the return value for the menu callback doesn't mean anything so using PLUGIN_HANDLED doesn't make sense, you can simply use "return". Regardless, this isn't related to your problem but makes your title not make any sense.

I also don't see anything in there about "limit once per round" so I'm not sure what you're talking about. Maybe it would make more sense to someone with more ZP experience? Not sure. I though there was a forum dedicated to this stuff.
__________________
fysiks is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 06-10-2023 , 01:54   Re: Item shop plugin_handled not working
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
What does this have to do with PLUGIN_HANDLED? I'm quite sure that the return value for the menu callback doesn't mean anything so using PLUGIN_HANDLED doesn't make sense, you can simply use "return". Regardless, this isn't related to your problem but makes your title not make any sense.

I also don't see anything in there about "limit once per round" so I'm not sure what you're talking about. Maybe it would make more sense to someone with more ZP experience? Not sure. I though there was a forum dedicated to this stuff.
This is nothing to do with ZP, this entire plugin for shop menu is an API itself, it can be done on any mod.

Im talking about that the items on the shop menu appear, so if they appear on the menu, that means the extension plugins(items) for the menu works, but as soon as i try to buy one, it doesnt respond
HowToRuski is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-10-2023 , 02:45   Re: Item shop plugin_handled not working
Reply With Quote #4

ZP is referenced everywhere in your post. If it's not related to ZP, what are you using? Where is your plugin that adds this item to the shop?
__________________
fysiks is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 06-10-2023 , 05:14   Re: Item shop plugin_handled not working
Reply With Quote #5

fixed.

Last edited by HowToRuski; 06-11-2023 at 09:36.
HowToRuski 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 08:28.


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