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

Suggestion / Subplugin Request [REQ] Item Limiter Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 05-18-2013 , 00:59   Re: [REQ] Item Limiter Plugin
Reply With Quote #11

Ty,

yeah ,"can u make a main plugin that can add limit to extra items ?" it is possible, but, it's a long thing to code , because every extra item has it's own id , and to recognise it and make a code that limits all of them, is difficult , still i'll try.

If u have a server PM me the ip, i'd like to chck it out,

EDIT: Sorry i cudn't find a solution to make a seperate plugin for limitting extra item.

Last edited by Catastrophe; 05-18-2013 at 01:05.
Catastrophe is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 05-18-2013 , 15:07   Re: [REQ] Item Limiter Plugin
Reply With Quote #12

Np
i runned zombie on my pc :d

Thanks For Your Helps
__________________

Last edited by M@RSH@L; 05-18-2013 at 15:09.
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 05-19-2013 , 04:13   Re: [REQ] Item Limiter Plugin
Reply With Quote #13

Welcome
Catastrophe is offline
hosimosi
Senior Member
Join Date: Apr 2013
Old 12-31-2013 , 04:26   Re: [REQ] Item Limiter Plugin
Reply With Quote #14

@catastrophe

can u add limit for this plugin
PHP Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>

new const item_name[] = "Buy HP!"
new g_itemid_buyhp
new hpamount

public plugin_init() 
{
    
register_plugin("[ZP] Buy Health Points""1.0""T[h]E Dis[as]teR")
    
hpamount register_cvar("zp_buyhp_amount""1000")
    
g_itemid_buyhp zp_register_extra_item(item_name5ZP_TEAM_HUMAN ZP_TEAM_ZOMBIE)
}
public 
zp_extra_item_selected(id,itemid)
{
    if(!
is_user_alive(id))
    
    return 
PLUGIN_HANDLED;
    
    if(
itemid==g_itemid_buyhp)
    {
        if(
zp_get_user_ammo_packs(id) < 5)
        {
            
client_print(idprint_chat,"[ZP] Not enough Ammopacks!");
            return 
PLUGIN_HANDLED;
        }
        else
        {
            
set_user_health(id,get_user_health(id)+get_pcvar_num(hpamount));
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) - 5);
            
client_print(idprint_chat,"[ZP] You Bought HP!");
        }
    }
    return 
PLUGIN_CONTINUE;

hosimosi is offline
K4rim
Senior Member
Join Date: Oct 2013
Location: Malaysia
Old 12-31-2013 , 07:12   Re: [REQ] Item Limiter Plugin
Reply With Quote #15

@hosimosi check this post https://forums.alliedmods.net/showthread.php?t=232079
K4rim is offline
hosimosi
Senior Member
Join Date: Apr 2013
Old 12-31-2013 , 14:21   Re: [REQ] Item Limiter Plugin
Reply With Quote #16

Quote:
Originally Posted by K4rim View Post
Thank for reply man
but this plugin has alot of bug
can you edit my plugin please
hosimosi is offline
XStreamer
Member
Join Date: Mar 2013
Location: Localhost
Old 01-04-2014 , 08:13   Re: [REQ] Item Limiter Plugin
Reply With Quote #17

Try this one

PHP Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>
#include <fakemeta> 
#include <ColorChat>

new const item_name[] = "Buy HP!"
new g_itemid_buyhp
new hpamount
new g_limited[33], cvar_limit_hp

public plugin_init() 
{
    
register_plugin("[ZP] Buy Health Points""1.0""T[h]E Dis[as]teR")
    
hpamount register_cvar("zp_buyhp_amount""1000")
    
g_itemid_buyhp zp_register_extra_item(item_name10ZP_TEAM_HUMAN// More eficient if only human use it
    
register_event("HLTV""event_round_start""a""1=0""2=0"
    
cvar_limit_hp register_cvar("zp_limit_hp","2")
}

public 
event_round_start()
{
    for (new 
idid <= 32id++)
        {
        
g_limited[id] = 
        
}
}

public 
zp_extra_item_selected(player,itemid)
{
    if(!
is_user_alive(player))
    
    return 
PLUGIN_HANDLED;
    
    if(
itemid==g_itemid_buyhp)
    {
        if (
g_limited[player] <= get_pcvar_num(cvar_limit_hp))
        {
            
ColorChat(playerGREEN"[ZP]^x01 Max buy limit Reached.")
            return 
ZP_PLUGIN_HANDLED;
        } 
    
        if(
zp_get_user_ammo_packs(player) < 10)
        {
            
client_print(playerprint_chat,"[ZP] Not enough Ammopacks!");
            return 
PLUGIN_HANDLED;
        }
        else
        {
            
set_user_health(player,get_user_health(player)+get_pcvar_num(hpamount));
            
zp_set_user_ammo_packs(playerzp_get_user_ammo_packs(player) - 10);
            
client_print(playerprint_chat,"[ZP] You Bought HP!");
        }
    }
    return 
PLUGIN_CONTINUE;

OR this One

PHP Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>
#include <fakemeta> 
#include <ColorChat>

new const item_name[] = "Buy HP!"
new g_itemid_buyhp
new hpamountiBuyCount
const iMaxBuy // You can edit this part

public plugin_init() 
{
    
register_plugin("[ZP] Buy Health Points""1.0""T[h]E Dis[as]teR")
    
hpamount register_cvar("zp_buyhp_amount""1000")
    
g_itemid_buyhp zp_register_extra_item(item_name10ZP_TEAM_HUMAN// More eficient if only human use it
    
register_event("HLTV""event_round_start""a""1=0""2=0"
}

public 
event_round_start()
{
    
iBuyCount 0


public 
zp_extra_item_selected(id,itemid)
{
    if(!
is_user_alive(id))
    
    return 
PLUGIN_HANDLED;
    
    if(
itemid==g_itemid_buyhp)
    {
        if(
iBuyCount >= iMaxBuy)
        {
            
ColorChat(idGREEN"[ZP]^x01 Max buy limit Reached."//  All CT Team can Buy limited Hp!!If iMaxBuy = 2 all CT team cand buy 2  Times per round HP
            
return ZP_PLUGIN_HANDLED;
        } 
    
        if(
zp_get_user_ammo_packs(id) < 10)
        {
            
client_print(idprint_chat,"[ZP] Not enough Ammopacks!");
            return 
PLUGIN_HANDLED;
        }
        else
        {
            
set_user_health(id,get_user_health(id)+get_pcvar_num(hpamount));
            
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) - 10);
            
client_print(idprint_chat,"[ZP] You Bought HP!");
        }
    }
    return 
PLUGIN_CONTINUE;


Last edited by XStreamer; 01-04-2014 at 08:29.
XStreamer is offline
hosimosi
Senior Member
Join Date: Apr 2013
Old 01-05-2014 , 06:35   Re: [REQ] Item Limiter Plugin
Reply With Quote #18

Frist plugin don't let me buy it and said Max buy limit Reached , but should let me 2 time buy it
second plugin don't work , i bought it 7 time but never said Max buy limit Reached.

can you fix it please
and thanks for reply

and i have zp 5.0.8

Last edited by hosimosi; 01-05-2014 at 06:42.
hosimosi is offline
XStreamer
Member
Join Date: Mar 2013
Location: Localhost
Old 01-05-2014 , 11:38   Re: [REQ] Item Limiter Plugin
Reply With Quote #19

Try it now!!!I'm not sure if will work 100% because i didn't test it!!!Post here if not works!!!

PHP Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>
#include <fakemeta> 
#include <ColorChat>

new const item_name[] = "Buy HP!"
new g_itemid_buyhp
new hpamount
new g_limited[33], cvar_limit_hp

public plugin_init() 
{
    
register_plugin("[ZP] Buy Health Points""1.0""T[h]E Dis[as]teR")
    
hpamount register_cvar("zp_buyhp_amount""1000")
    
g_itemid_buyhp zp_register_extra_item(item_name10ZP_TEAM_HUMAN// More eficient if only human use it
    
register_event("HLTV""event_round_start""a""1=0""2=0"
    
cvar_limit_hp register_cvar("zp_limit_hp","2")
}

public 
event_round_start()
{
    for (new 
idid <= 32id++)
        {
        
g_limited[id] = 
        
}
}

public 
zp_extra_item_selected(player,itemid)
{
    if(!
is_user_alive(player))
    
    return 
PLUGIN_HANDLED;
    
    if(
itemid==g_itemid_buyhp)
    {
        if(
zp_get_user_ammo_packs(player) < 10 || g_limited[player] <= get_pcvar_num(cvar_limit_hp))
        {
            
ColorChat(playerGREEN,"[ZP] Not enough Ammopacks or Max buy limit reached!");
            return 
PLUGIN_HANDLED;
        }
        else
        {
            
set_user_health(player,get_user_health(player)+get_pcvar_num(hpamount));
            
zp_set_user_ammo_packs(playerzp_get_user_ammo_packs(player) - 10);
            
client_print(playerprint_chat,"[ZP] You Bought HP!");
        }
    }
    return 
PLUGIN_CONTINUE;

XStreamer is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 01-05-2014 , 14:05   Re: [REQ] Item Limiter Plugin
Reply With Quote #20

Try this:

have limit of 3 u can change the cvar with your number..

PHP Code:
#include <amxmodx>
#include <fun>
#include <zp50_core> 
#include <zp50_items> 
#include <zp50_class_nemesis> 
#include <zp50_class_survivor> 

new const item_name[] = "Buy HP!"
new g_itemid_buyhp
new hpamount
new g_Limit[33]
new 
cvar_Fastattack_limit
new g_MaxPlayers

public plugin_init() 
{
    
register_plugin("[ZP] Buy Health Points""1.0""T[h]E Dis[as]teR")
    
    
hpamount register_cvar("zp_buyhp_amount""1000"
    
cvar_Fastattack_limit register_cvar("zp_fastattack_limit""3")
    
    
g_itemid_buyhp zp_items_register(item_name5)
    
    
register_event("HLTV""NewRound""a""1=0""2=0")
    
    
g_MaxPlayers get_maxplayers()
}

public 
zp_fw_items_select_pre(iditemidignorecost)
{
              
        if (
itemid == g_itemid_buyhp)
        {
                        
              if (
zp_class_nemesis_get(id) || zp_class_survivor_get(id))
                  return 
ZP_ITEM_DONT_SHOW;         
          
              if (
g_Limit[id] >= get_pcvar_num(cvar_Fastattack_limit))
                  return 
ZP_ITEM_NOT_AVAILABLE;
        }
                
         return 
ZP_ITEM_AVAILABLE;


public 
zp_fw_items_select_post(iditemidignorecost)
{

    if(
itemid == g_itemid_buyhp)
    {
      
       if(
is_user_alive(id))
       {
           
     
set_user_health(id,get_user_health(id)+get_pcvar_num(hpamount));    
          
client_print(idprint_chat,"[ZP] You Bought HP!");
     
g_Limit[id]++       
       }
    }
}  

public 
NewRound() 
{   
    for (new 
idid <= g_MaxPlayersid++) 
    {                     
        
g_Limit[id] = 0
    
}


Last edited by wicho; 01-05-2014 at 14:05.
wicho 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 04:50.


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