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

Add round limit for item


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Apb hq
Senior Member
Join Date: Apr 2014
Old 08-10-2017 , 06:42   Add round limit for item
Reply With Quote #1

How to add a limit for this item for example i want that only 2 survivors can be bought per round i have seen a tutorial for zp 5.0 there isn't for 4.3 thanks in advance
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <zombieplague>

#define PLUGIN "[ZP] Survivor"
#define VERSION "1.0"
#define AUTHOR "Maakera"

new g_survivor
new const g_cost 18 // Cost of pack

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_survivor zp_register_extra_item("Survivor"g_costZP_TEAM_HUMAN)
}

public 
zp_extra_item_selected(playeritemid)
{
    if (
itemid == g_survivor)
    {
        if (
zp_has_round_started()) {
            
zp_make_user_survivor(player)
            new 
idname[33]
            
get_user_name(playeridnamecharsmax(idname))
            
set_hudmessage(02552550.060.3916.05.0)
            
show_hudmessage(0"%s has bought Survivor !!!"idname)
            
        }
        else return 
ZP_PLUGIN_HANDLED;  
        
    }
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
Apb hq is offline
WaLkMaN
Senior Member
Join Date: Oct 2010
Location: Varna, Bulgaria
Old 08-10-2017 , 15:37   Re: Add round limit for item
Reply With Quote #2

ZP Shade has two added params in zp_register_extra_item

https://forums.alliedmods.net/showthread.php?t=243147

PHP Code:
g_survivor zp_register_extra_item("Survivor"g_costZP_TEAM_HUMAN


PHP Code:
g_survivor zp_register_extra_item("Survivor"g_costZP_TEAM_HUMANREST_ROUND2
__________________

Last edited by WaLkMaN; 08-10-2017 at 15:43.
WaLkMaN is offline
Apb hq
Senior Member
Join Date: Apr 2014
Old 08-11-2017 , 14:04   Re: Add round limit for item
Reply With Quote #3

Quote:
Originally Posted by WaLkMaN View Post
ZP Shade has two added params in zp_register_extra_item

https://forums.alliedmods.net/showthread.php?t=243147

PHP Code:
g_survivor zp_register_extra_item("Survivor"g_costZP_TEAM_HUMAN


PHP Code:
g_survivor zp_register_extra_item("Survivor"g_costZP_TEAM_HUMANREST_ROUND2
The problem is that i'm not using the default zp 4.3 so this wont work
Apb hq is offline
WaLkMaN
Senior Member
Join Date: Oct 2010
Location: Varna, Bulgaria
Old 08-11-2017 , 14:31   Re: Add round limit for item
Reply With Quote #4

So this is the only way in default zp 4.3

PHP Code:
#include <amxmodx> 
#include <fakemeta> 
#include <cstrike> 
#include <zombieplague> 

#define PLUGIN "[ZP] Survivor" 
#define VERSION "1.0" 
#define AUTHOR "Maakera" 

new g_survivor 
new const g_cost 18 // Cost of pack 
new g_buy_counter

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
g_survivor zp_register_extra_item("Survivor"g_costZP_TEAM_HUMAN
    
register_logevent("event_RoundStart"2"1=Round_Start"
}

public 
event_RoundStart()
{
    
g_buy_counter 0
}

public 
zp_extra_item_selected(playeritemid

    if (
itemid == g_survivor
    { 
        if (!
zp_has_round_started()) 
        {
            return 
ZP_PLUGIN_HANDLED
        
}
        
        if (
g_buy_counter == 2)
        {
            
client_print(playerprint_chat"Limit reached!")
            return 
ZP_PLUGIN_HANDLED
        
}
        
        
zp_make_user_survivor(player
        new 
idname[32
        
get_user_name(playeridnamecharsmax(idname)) 
        
set_hudmessage(02552550.060.3916.05.0
        
show_hudmessage(0"%s has bought Survivor !!!"idname)
        
g_buy_counter++
    }
    
    return 
PLUGIN_CONTINUE

__________________
WaLkMaN is offline
Apb hq
Senior Member
Join Date: Apr 2014
Old 08-13-2017 , 18:47   Re: Add round limit for item
Reply With Quote #5

Quote:
Originally Posted by WaLkMaN View Post
So this is the only way in default zp 4.3

PHP Code:
#include <amxmodx> 
#include <fakemeta> 
#include <cstrike> 
#include <zombieplague> 

#define PLUGIN "[ZP] Survivor" 
#define VERSION "1.0" 
#define AUTHOR "Maakera" 

new g_survivor 
new const g_cost 18 // Cost of pack 
new g_buy_counter

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
g_survivor zp_register_extra_item("Survivor"g_costZP_TEAM_HUMAN
    
register_logevent("event_RoundStart"2"1=Round_Start"
}

public 
event_RoundStart()
{
    
g_buy_counter 0
}

public 
zp_extra_item_selected(playeritemid

    if (
itemid == g_survivor
    { 
        if (!
zp_has_round_started()) 
        {
            return 
ZP_PLUGIN_HANDLED
        
}
        
        if (
g_buy_counter == 2)
        {
            
client_print(playerprint_chat"Limit reached!")
            return 
ZP_PLUGIN_HANDLED
        
}
        
        
zp_make_user_survivor(player
        new 
idname[32
        
get_user_name(playeridnamecharsmax(idname)) 
        
set_hudmessage(02552550.060.3916.05.0
        
show_hudmessage(0"%s has bought Survivor !!!"idname)
        
g_buy_counter++
    }
    
    return 
PLUGIN_CONTINUE

Works great thanks
Apb hq 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 19:24.


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