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

API Scripting Help [ZP 5.0] return PLUGIN_HANDLED issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-09-2015 , 07:31   [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #1

So i added a limit for the double jump plugin, if the player already bought double jump, he is not able to buy it again

It works, but for some reason it still takes the player's ammo packs.. why is this happening?
Code:
public zp_fw_items_select_post(id, itemid, igc)
{
    if(itemid == g_itemid_multijump)
    {
        if(g_multi[id])
        {
        zp_colored_print(id, "^x04[Double Jump]^x01 You Already have Double Jump!")
        
        return PLUGIN_HANDLED;
        }
        
        else
        {
        zp_colored_print(id, "^x04[Double Jump]^x01 You bought Double Jump")
        g_multi[id] = true
        }
    }
    return PLUGIN_CONTINUE  
}
Depresie is offline
New.ZM.Life
Veteran Member
Join Date: Sep 2014
Location: Iran
Old 04-09-2015 , 07:37   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #2

Quote:
Originally Posted by Depresie View Post
So i added a limit for the double jump plugin, if the player already bought double jump, he is not able to buy it again

It works, but for some reason it still takes the player's ammo packs.. why is this happening?
Code:
public zp_fw_items_select_post(id, itemid, igc)
{
    if(itemid == g_itemid_multijump)
    {
        if(g_multi[id])
        {
        zp_colored_print(id, "^x04[Double Jump]^x01 You Already have Double Jump!")
        
        return PLUGIN_HANDLED;
        }
        
        else
        {
        zp_colored_print(id, "^x04[Double Jump]^x01 You bought Double Jump")
        g_multi[id] = true
        }
    }
    return PLUGIN_CONTINUE  
}

its better to use zp_fw_items_select_pre forward to block buying items( for example adding limit, etc)

also use ZP_ITEM_AVAILABLE, ZP_ITEM_NOT_AVAILABLE, ZP_ITEM_DONT_SHOW in in forward
__________________
PLUGINS

Zombie Plague 5.0 + New Modes

Added NightCrawler Mode to ZP






Last edited by New.ZM.Life; 04-09-2015 at 07:38.
New.ZM.Life is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-09-2015 , 08:02   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #3

thx, i kind of forgot about it... >.>
Depresie is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 04-09-2015 , 09:05   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #4

post forward is usually used when player successfully buy the item
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!
happy_2012 is offline
New.ZM.Life
Veteran Member
Join Date: Sep 2014
Location: Iran
Old 04-09-2015 , 11:46   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #5

Quote:
Originally Posted by happy_2012 View Post
post forward is usually used when player successfully buy the item
Its same with zp_extra_item_selected in zp4.3, where we had some problems like this
Its why i prefer zp5.0 than zp4.3 (more natives,more forwards)
__________________
PLUGINS

Zombie Plague 5.0 + New Modes

Added NightCrawler Mode to ZP





New.ZM.Life is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 04-09-2015 , 12:43   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #6

Quote:
Originally Posted by New.ZM.Life View Post
Its same with zp_extra_item_selected in zp4.3, where we had some problems like this
Its why i prefer zp5.0 than zp4.3 (more natives,more forwards)
I never liked zp43 it's quite hard to customize
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!
happy_2012 is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-09-2015 , 19:44   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #7

Anyway this also work

PHP Code:
public zp_fw_items_select_post(iditemidigc)
{
    if(
itemid == g_itemid_multijump)
    {
        if(
g_multi[id])
        {
            
zp_colored_print(id"^x04[Double Jump]^x01 You Already have Double Jump!")
        
            return 
PLUGIN_HANDLED;
        }
       
        
zp_colored_print(id"^x04[Double Jump]^x01 You bought Double Jump")
        
g_multi[id] = true

    
}
    return 
PLUGIN_CONTINUE  

Krtola is offline
Send a message via Skype™ to Krtola
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-10-2015 , 15:50   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #8

Quote:
Originally Posted by Krtola View Post
Anyway this also work

PHP Code:
public zp_fw_items_select_post(iditemidigc)
{
    if(
itemid == g_itemid_multijump)
    {
        if(
g_multi[id])
        {
            
zp_colored_print(id"^x04[Double Jump]^x01 You Already have Double Jump!")
        
            return 
PLUGIN_HANDLED;
        }
       
        
zp_colored_print(id"^x04[Double Jump]^x01 You bought Double Jump")
        
g_multi[id] = true

    
}
    return 
PLUGIN_CONTINUE  

Apparently it doesn't, very strange issue
Depresie is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-11-2015 , 05:55   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #9

Quote:
Originally Posted by Depresie View Post
Apparently it doesn't, very strange issue
oddly...
Anyway for me work fine.
Krtola is offline
Send a message via Skype™ to Krtola
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 04-11-2015 , 06:27   Re: [ZP 5.0] return PLUGIN_HANDLED issue
Reply With Quote #10

Have you tried using zp_fw_items_select_pre(id, itemid, ignorecost) forward?
zmd94 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 23:26.


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