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

Limited extra item


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BaltaZar_Serbia
Senior Member
Join Date: Dec 2011
Location: Serbia
Old 07-27-2014 , 14:07   Limited extra item
Reply With Quote #1

Can someone edit this .sma... i want this plugin to be limited to 10 uses per round

this plugin https://forums.alliedmods.net/showpo...postcount=1118

zp 4.3 fix5a

Last edited by BaltaZar_Serbia; 07-27-2014 at 14:08.
BaltaZar_Serbia is offline
Send a message via Yahoo to BaltaZar_Serbia
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-27-2014 , 18:18   Re: Limited extra item
Reply With Quote #2

Try this.

Spoiler
__________________
H.RED.ZONE is offline
BaltaZar_Serbia
Senior Member
Join Date: Dec 2011
Location: Serbia
Old 07-27-2014 , 18:47   Re: Limited extra item
Reply With Quote #3

it works, hvala
BaltaZar_Serbia is offline
Send a message via Yahoo to BaltaZar_Serbia
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-28-2014 , 13:08   Re: Limited extra item
Reply With Quote #4

@ BaltaZar_Serbia, if you want to know, what have been fix to solve your problem. Lets learn, so that someday maybe you can help other.

1. Add this:
PHP Code:
new g_Limit 
2. Then change this:
PHP Code:
public zp_extra_item_selected(playeritemid)
{
    if (
itemid == g_itemid_blink){
        
        
g_iBlinks[player] += 1;
        
client_print(playerprint_chat"[ZP] You have now %d Knife Blinks"g_iBlinks[player]);
    }

--->
PHP Code:
public zp_extra_item_selected(playeritemid) {
    if (
itemid == g_itemid_blink){
        if(
g_Limit <= 10) {
        
            
g_Limit++
            
g_iBlinks[player] += 1;
            
client_print(playerprint_chat"[ZP] You have now %d Knife Blinks"g_iBlinks[player]);
        } else {
            
            
zp_set_user_ammo_packs(playerzp_get_user_ammo_packs(player) + g_item_cost)
            
client_print(playerprint_chat"[ZP] This item can be used only 10 times on 1 map."g_iBlinks[player]);
        }
    }

zmd94 is offline
XDragoon
New Member
Join Date: Dec 2012
Location: Chile
Old 07-28-2014 , 19:36   Re: Limited extra item
Reply With Quote #5

Quote:
Originally Posted by zmd94 View Post
@ BaltaZar_Serbia
PHP Code:
public zp_extra_item_selected(playeritemid) {
    if (
itemid == g_itemid_blink){
        if(
g_Limit <= 10) {
        
            
g_Limit++
            
g_iBlinks[player] += 1;
            
client_print(playerprint_chat"[ZP] You have now %d Knife Blinks"g_iBlinks[player]);
        } else {
            
            
zp_set_user_ammo_packs(playerzp_get_user_ammo_packs(player) + g_item_cost)
            
client_print(playerprint_chat"[ZP] This item can be used only 10 times on 1 map."g_iBlinks[player]);
        }
    }

Is Better Use ZP_PLUGIN_HANDLED;
PHP Code:
zp_set_user_ammo_packs(playerzp_get_user_ammo_packs(player) + g_item_cost)
client_print(playerprint_chat"[ZP] This item can be used only 10 times on 1 map."
--->
PHP Code:
client_print(playerprint_chat"[ZP] This Item can be used only 10 times on 1 map")
return 
ZP_PLUGIN_HANDLED
XDragoon is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-28-2014 , 19:46   Re: Limited extra item
Reply With Quote #6

Quote:
Originally Posted by XDragoon View Post
Is Better Use ZP_PLUGIN_HANDLED;
PHP Code:
zp_set_user_ammo_packs(playerzp_get_user_ammo_packs(player) + g_item_cost)
client_print(playerprint_chat"[ZP] This item can be used only 10 times on 1 map."
--->
PHP Code:
client_print(playerprint_chat"[ZP] This Item can be used only 10 times on 1 map")
return 
ZP_PLUGIN_HANDLED
Code:
/**
 * Called when a player buys an extra item from the ZP menu.
 *
 * Note: You can now return ZP_PLUGIN_HANDLED in your plugin to block
 * the purchase and the player will be automatically refunded.
 *
 * @param id        Player index of purchaser.
 * @param itemid    Internal extra item ID.
 */
forward zp_extra_item_selected(id, itemid)
You are right about that didn't know if you handled it it would refund but inside forward its called back the same way. So it's the same.
__________________

Last edited by H.RED.ZONE; 07-28-2014 at 19:46.
H.RED.ZONE is offline
JuniorRosales
Junior Member
Join Date: Jan 2014
Old 09-03-2014 , 12:00   Re: Limited extra item
Reply With Quote #7

is for round? or map?
JuniorRosales 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 03:24.


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