Raised This Month: $32 Target: $400
 8% 

zp extra buy nemesis assa snip surv limit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 05-25-2014 , 18:20   zp extra buy nemesis assa snip surv limit
Reply With Quote #1

ANY BODY CAN HELP ME HOW I CAN LIMIT those extra items to buy only one time in 5 rounds : Buy Nemesis Buy Assasin Sniper Survivor ..thx code is here

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


#define PLUGIN "[ZP] Pack Assasin,Survivor,Nemesis,Sniper"
#define VERSION "0.1"
#define AUTHOR "Gabriel"

#define ZP_TEAM_HUMAN (1<<1)

native zp_register_extra_item(const name[], costteams)
native zp_make_user_nemesis(id)
native zp_make_user_survivor(id)
native zp_make_user_sniper(id)
native zp_make_user_assassin(id)
native zp_get_user_ammo_packs(id)
native zp_set_user_ammo_packs(idamount)


new 
g_maxplayersg_msgSayText
new g_enabled
new g_nemesisg_survivorg_assassing_sniper
new const g_costnemesis 350
new const g_costsurvivor 350
new const g_costassassin 350
new const g_costsniper 400

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_enabled register_cvar("zp_extra_pack_mods""1")
    
    
g_nemesis zp_register_extra_item("Buy Nemesis"g_costnemesisZP_TEAM_HUMAN)
    
g_survivor zp_register_extra_item("Buy Survivor"g_costsurvivorZP_TEAM_HUMAN)
    
g_assassin zp_register_extra_item("Buy Assasin"g_costassassinZP_TEAM_HUMAN)
        
g_sniper zp_register_extra_item("Buy Sniper"g_costsniperZP_TEAM_HUMAN)

    
g_maxplayers get_maxplayers()
    
g_msgSayText get_user_msgid("SayText")
}

public 
zp_extra_item_selected(playeritemid)
{
    new 
name[32]
    
get_user_name(playername31)

    if (
itemid == g_nemesis)
    {
        if (
get_pcvar_num(g_enabled)) {
            
zp_make_user_nemesis(player)
            
zp_colored_print(0"^x04[ZOMBIE]^x03 %s^x01 has bought ^x04 Nemesis"name)
            
        }
        else
        {
            static 
ammopacksnemesis
            ammopacksnemesis 
zp_get_user_ammo_packs(player)
            
zp_set_user_ammo_packs(playerammopacksnemesis g_costnemesis)
        }
    }
    else  if (
itemid == g_survivor)
      {
    if (
get_pcvar_num(g_enabled)) {
        
zp_make_user_survivor(player)
        
zp_colored_print(0"^x04[ZOMBIE]^x03 %s^x01 has bought ^x04 Survivor"name)
        
    }
    else
    {
        static 
ammopackssurvivor
        ammopackssurvivor 
zp_get_user_ammo_packs(player)
        
zp_set_user_ammo_packs(playerammopackssurvivor g_costsurvivor)
            }
        }
        else  if (
itemid == g_assassin)
        {
        if (
get_pcvar_num(g_enabled)) {
        
zp_make_user_assassin(player)
        
zp_colored_print(0"^x04[ZOMBIE]^x03 %s^x01 has bought ^x04 Assasin"name)
    
        }
        else
        {
        static 
ammopacksassassin
        ammopacksassassin 
zp_get_user_ammo_packs(player)
        
zp_set_user_ammo_packs(playerammopacksassassin g_costassassin)
                }
        }
        else  if (
itemid == g_sniper)
        {
        if (
get_pcvar_num(g_enabled)) {
        
zp_make_user_sniper(player)
        
zp_colored_print(0"^x04[ZOMBIE]^x03 %s^x01 has bought ^x04 Sniper"name)
    
        }
        else
        {
        static 
ammopackssniper
        ammopackssniper 
zp_get_user_ammo_packs(player)
        
zp_set_user_ammo_packs(playerammopackssniper g_costsniper)
                }
        }

}
zp_colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscount
    argscount 
numargs()
    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }

ghost95v is offline
Send a message via Skype™ to ghost95v
Torge
Veteran Member
Join Date: Oct 2011
Old 05-25-2014 , 19:59   Re: zp extra buy nemesis assa snip surv limit
Reply With Quote #2

For each specific player or for the whole thing like you can only buy 1 item each 5 seconds for everyone?
Torge is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 05-25-2014 , 21:21   Re: zp extra buy nemesis assa snip surv limit
Reply With Quote #3

Quote:
Originally Posted by Torge View Post
For each specific player or for the whole thing like you can only buy 1 item each 5 seconds for everyone?
NO TRY TO UNDERSTAND ,,OR SEE THIS CODE DOWN HERE ,THIS ITEM IS LIMITED AFTER IS BOUGHT 1 ROUND BEFORE ,IN THE NEXT ROUND THIS ITEN CANNOT BOUGHT ,THEN NEXT ROUND IS AVAIBLE ,HOW CAN I ADD 4 MORE ROUND LIMITS TO THIS .THNX ..CODE HERE
PHP Code:
#include <amxmodx>   
#include <zombieplague>   
#include <fakemeta_util>   

new const g_item_name[] = { "Nemesis" }   
const 
g_item_cost 50   
new count[33]   

// Item IDs   
new g_nemesis   

public plugin_init()   
{   
    
register_plugin("[ZP] New Buy Nemesis""2.0""GPOWER")   
    
register_logevent("round_start"2"1=Round_Start")   
    
g_nemesis zp_register_extra_item(g_item_nameg_item_costZP_TEAM_HUMAN)       
    
count[0] = 0;   

}   
public 
zp_extra_item_selected(playeritemid)   
{   
    if (
itemid == g_nemesis)   
    {   
        if(
zp_has_round_started())  
        {  
            
client_print(playerprint_chat"[ZP] You Can't Buy Nemesis Now !")   
            return 
ZP_PLUGIN_HANDLED  
        
}  
        else  
        {  
            if(
count[0] == 0)   
            {       
                
zp_make_user_nemesis(player)   
                
count[0] = 1;   
            }   
            else   
            {   
                
client_print(playerprint_chat"[ZP] The nemesis cant be bought 2 rounds in a row, try next round !")    
                return 
ZP_PLUGIN_HANDLED   
            
}   
        }  
    }   
    return 
PLUGIN_CONTINUE   
}   
public 
round_start()   
{   
        if(
count[0] == 1)   
        {   
            
count[0] = 2;   
        }   
        else if(
count[0] == 2)   
        {   
            
count[0] = 0;   
        } 
ghost95v is offline
Send a message via Skype™ to ghost95v
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 05-27-2014 , 11:47   Re: zp extra buy nemesis assa snip surv limit
Reply With Quote #4

This portion of the code is your counter that is set up on round_start. Right now when the counter reaches 2, it resets to 0 and allows buying. You would just need to edit it so it doesn't reset until 5 or whatever you want.

PHP Code:
public round_start()   
{   
        if(
count[0] == 1)   
        {   
            
count[0] = 2;   
        }   
        else if(
count[0] == 2)   
        {   
            
count[0] = 0;   
        } 
__________________

Last edited by joshknifer; 05-27-2014 at 11:47.
joshknifer is offline
Send a message via Skype™ to joshknifer
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 23:05.


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