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

[REQ] Jump-Grenade with limit per round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghostz0r
Senior Member
Join Date: Dec 2012
Old 04-17-2015 , 11:21   [REQ] Jump-Grenade with limit per round
Reply With Quote #1

hello 2 all , i need jump grenade with limit per round , please help to me , i need add limit to this code
Spoiler
ghostz0r is offline
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
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-18-2015 , 04:42   Re: [REQ] Jump-Grenade with limit per round
Reply With Quote #3

you want limit per player?
Depresie is offline
SergiCruz
Senior Member
Join Date: Mar 2012
Location: Andalucía, España
Old 04-18-2015 , 05:00   Re: [REQ] Jump-Grenade with limit per round
Reply With Quote #4

Per round & player
PHP Code:
#define LIMIT_PER_ROUND_PLAYER 10 // Limit per round and player value.
new g_bombs_bought[33// Global variable that indicates the number of bombs that have been bought in a round by a given player
new g_itemid // This should appear anywhere. Look for it
new g_maxplayers // Most of codes already has this variable

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")
    
g_maxplayers get_maxplayers() // If there was already a g_maxplayers variable, this should     appear here
}

public 
event_newround()
{
    new 
id
    
for(new id=1id<=g_maxplayersid++)
        
g_bombs_bought[id] = // 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_PLAYER// 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[id]++ // The number of bought bombs by this user should increase by one.
        
}
    }
    return 
PLUGIN_CONTINUE

__________________
PodBot waypointer. Feel free to ask for waypoints for zm_ maps.
SergiCruz is offline
Send a message via MSN to SergiCruz
Reply


Thread Tools
Display Modes

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 16:59.


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