View Single Post
SergiCruz
Senior Member
Join Date: Mar 2012
Location: Andalucía, España
Old 04-17-2015 , 13:28   Re: [REQ] Jump-Grenade with limit per round
Reply With Quote #2

This is basically what you have to add / edit:
PHP Code:
#define LIMIT_PER_ROUND 10 // Limit per round value.
new g_bombs_bought // Global variable that indicates the number of bombs that have been bought in a round
new g_itemid // This should appear anywhere. Look for it

public plugin_init()
{
    
// If not registered...
    
register_event("HLTV""event_newround""a""1=0""2=0")
    
// This should also appear
    
g_itemid zp_register_extra_item("blablabla")
}

public 
event_newround()
{
    
g_bombs_bought // At the beginning of the round the number of bombs bought is zero
}

public 
zp_extra_item_selected(iditemid)
{
    if(
itemid == g_itemid)
    {
        if(
g_bombs_bought == LIMIT_PER_ROUND// If the limit is reached...
        
{
            
client_print(idprint_chat"Limit reached. Can't buy a jump bomb"// We send a message
            
return PLUGIN_HANDLED // and refund the user
        
}
        else 
// In other case...
        
{
            
// Blablaba...
            
g_bombs_bought++ // The number of bought bombs should increase by one.
        
}
    }
    return 
PLUGIN_CONTINUE

It can be used to add limit per round to any kind of extra item
__________________
PodBot waypointer. Feel free to ask for waypoints for zm_ maps.

Last edited by SergiCruz; 04-17-2015 at 13:30.
SergiCruz is offline
Send a message via MSN to SergiCruz