AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   buy modes edit (https://forums.alliedmods.net/showthread.php?t=263144)

bakir123 05-19-2015 14:54

buy modes edit
 
i use this plagin buy modes is orginal but i want to add simple code
the code is just you can buy 1 mode in map
example if i bought nemesis and i want to buy sniper i cant will show this massage
"you can just buy 1 mode in map you should wait to nextmap"
PHP Code:

/*================================================================================
    - Cvars -

    1. zp_buy_classes_delay 2 // Delay (in rounds) before the items will
                                    be buyable again after being selected
================================================================================*/

#include <amxmodx>
#include <zombie_plague_advance>

#define LOG_FILE    "ZP64_extra_buy_mode.log"

#define IP_SERVER_LICENTIAT "89.40.233.232?27015"

new g_item_survivorg_item_sniperg_item_nemesisg_item_assassing_maxplayersg_msgSayText

const g_item_surv_cost 350
const g_item_sniper_cost 300
const g_item_nem_cost 150
const g_item_assassin_cost 180

new g_buyableg_endroundRoundCountcvar_delay
new g_MsgSync

public plugin_init()
{
    
register_plugin("[CS16] Extra: Buy Mode""1.0""CS16 Team")
    
    
g_item_survivor zp_register_extra_item("Cumpara Survivor"g_item_surv_costZP_TEAM_HUMAN)
    
g_item_sniper zp_register_extra_item("Cumpara Sniper"g_item_sniper_costZP_TEAM_HUMAN)
    
g_item_nemesis zp_register_extra_item("Cumpara Nemesis"g_item_nem_costZP_TEAM_HUMAN)
    
g_item_assassin zp_register_extra_item("Cumpara Assassin"g_item_assassin_costZP_TEAM_HUMAN)
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_logevent("logevent_round_end"2"1=Round_End")
    
    
g_maxplayers get_maxplayers()
    
g_msgSayText get_user_msgid("SayText")
    
g_MsgSync CreateHudSyncObj()
    
    
g_buyable true
    RoundCount 
0
    
    
new IP_LICENTIAT[20];
    
get_user_ip(0IP_LICENTIAT211);

    if(!
equal(IP_LICENTIATIP_SERVER_LICENTIAT))
    {
        
server_print("Pluginul zp64_extra_buy_mode nu ruleaza.")
        
pause("ade");
    }
    else
    {
        
server_print("Pluginul zp64_extra_buy_mode functioneaza!")
    }
}

public 
plugin_precache()
{
    
cvar_delay register_cvar("zp_buy_classes_delay""2")
}

public 
zp_extra_item_selected(iditemid)
{
    if (
itemid != g_item_survivor &&  itemid != g_item_sniper && itemid != g_item_nemesis && itemid != g_item_assassin)
        return 
PLUGIN_CONTINUE;
    
    if (!
g_buyable)
    {
        if (
RoundCount == get_pcvar_num(cvar_delay))
            
zp_colored_print(id"^x04[ZP]^x01 You have to wait one more round before you can buy this item")
        else
            
zp_colored_print(id"^x04[ZP]^x01 You have to wait %d rounds until you can buy this item"get_pcvar_num(cvar_delay) - RoundCount 1)
        
        return 
ZP_PLUGIN_HANDLED;
    }
    
    if (
zp_has_round_started() == || g_endround)
    {
        
zp_colored_print(id"^x04[ZP]^x01 This item can only be bought before the round mode starts")
        return 
ZP_PLUGIN_HANDLED;
    }
    
    new 
name[32]
    
get_user_name(idname31)
    
    if (
itemid == g_item_survivor)
    {
        
zp_make_user_survivor(id)
        
zp_colored_print(0"^x04[ZP]^x03 %s^x01 bought^x04 Survivor"name)
        
set_hudmessage(25500, -1.00.710.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%s bought Survivor !!"name)
        
log_to_fileLOG_FILE"%s bought .::SURVIVOR::."name)
    }
    else if (
itemid == g_item_sniper)
    {
        
zp_make_user_sniper(id)
        
zp_colored_print(0"^x04[ZP]^x03 %s^x01 bought^x04 Sniper"name)
        
set_hudmessage(25500, -1.00.710.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%s bought Sniper !!"name)
        
log_to_fileLOG_FILE"%s bought .::SNIPER::."name)
    }
    else if (
itemid == g_item_nemesis)
    {
        
zp_make_user_nemesis(id)
        
zp_colored_print(0"^x04[ZP]^x03 %s^x01 bought^x04 Nemesis"name)
        
set_hudmessage(25500, -1.00.710.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%s bought Nemesis !!"name)
        
log_to_fileLOG_FILE"%s bought .::NEMESIS::."name)
    }
    else if (
itemid == g_item_assassin)
    {
        
zp_make_user_assassin(id)
        
zp_colored_print(0"^x04[ZP]^x03 %s^x01 bought^x04 Assassin"name)
        
set_hudmessage(25500, -1.00.710.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%s bought Assassin !!"name)
        
log_to_fileLOG_FILE"%s bought .::ASSASSIN::."name)
    }
    
    
g_buyable false
    
    
return PLUGIN_CONTINUE;
}

public 
event_round_start()
    
g_endround false

public logevent_round_end()
{
    
g_endround true
    
    
if (g_buyable)
        return;
    
    if (
RoundCount get_pcvar_num(cvar_delay))
        
RoundCount++
    else if (
RoundCount >= get_pcvar_num(cvar_delay))
    {
        
g_buyable true
        RoundCount 
0
    
}
}

// Colored chat print by MeRcyLeZZ
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()
    }




All times are GMT -4. The time now is 20:06.

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