Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

> Правила форума

Этот раздел, как вы могли заметить по названию, предназначен для решения вопросов по поводу уже существующих модов и плагинов.
Пожалуйста, если у вас проблема с написанием плагина, не путайте этот раздел с разделом по скриптингу.
Для поиска плагинов и модов существует соответствующий раздел.

Название темы должно соответствовать содержанию. Темы с названием типа "Помогите", "Вопрос", "парни подскажите..." - будут удалены.
Все темы, не относящиеся к "Вопросам по модам и плагинам", будут удалены или перемещены в соответствующий раздел.

Правила оформления темы:
1. Помимо заголовка не забудьте верно сформулировать свой вопрос.
2. Выложите исходник (в тег кода + ) или ссылку на плагин который вызывает у вас вопросы.
3. Выложите лог с ошибками (если имеется) под спойлер

Компилирование плагина

, Не Компилировается
Статус пользователя GREMLIN-71
сообщение 8.3.2011, 22:25
Сообщение #1
Стаж: 16 лет

Сообщений: 37
Благодарностей: 1
Полезность: < 0

Нашёл плагин прикольный на Zombie plague -- Special Ammo Packs + AMX Bank

Не Компилировается плагин...


Код
#define SQLON 0 // 1 = Use SQL | 0 = Use file

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <xs>
#include <zombieplague>


#define MAX_MONEY 500

#define MAX_LIMITS 8
new Limit[MAX_LIMITS] =    { 250, 500, 750, 1000, 1250, 1500, 1750, 2000 }
new CostLimit[MAX_LIMITS-1] = { 100, 250, 500, 750, 1000, 1250, 1500 };

#define MAX_INTTIME 6
new IntTime[MAX_INTTIME] =    { 180, 150, 120, 90, 60, 30 }
new CostIntTime[MAX_INTTIME-1] = { 100, 200, 500, 1000, 1500 };

#define MAX_INTERESTS 5
new Float:Interest[MAX_INTERESTS] = { 0.01, 0.03, 0.05, 0.07, 0.1 }
new CostInterest[MAX_INTERESTS-1] =     { 100, 500, 1000, 1750 };

#define AUTO_DEP 100    //players will deposit this if they go over MAX_MONEY

#define MAX_SAPS 200

#define ENABLE_SAP 1
#define ENABLE_SAPITEMS 1

//converting AP to SAP
#define CONVERT_AP 75
#define CONVERT_SAP 1

//converting SAP to AP
#define CONVERT2_AP 65
#define CONVERT2_SAP 1

//donating SAP to someone
#define DONATE_SAP 5

//blackout
#define BLACK_SAP 3
#define BLACK_TIME 20

//stealth
#define STEALTH_SAP 1
#define STEALTH_TIME 60.0

//geographic repositioner
#define SWAP_SAP 5
#define SWAP_TIME 5

//subzero frost
#define FROST_SAP 3
#define FROST_TIME 10.0
#define FROST_RINGMULT 7.5

//Scorpion's Flame
#define FLAME_SAP 1
#define FLAME_FIRE 12
#define FLAME_RINGMULT 7.5

//armor leech
#define LEECH_SAP 2
#define LEECH_TIME 30
#define LEECH_DISTANCE 500.0
#define LEECH_ARMOR_MAX 10
#define LEECH_MULT 25

//black hole
#define HOLE_SAP 3
#define HOLE_TIME 20
#define HOLE_SPEED 200
#define HOLE_DISTANCE 500.0

//nemesis
#define NEMESIS_SAP 2
#define NEMESIS_NUMBER 1

//self infect
#define INFECT_SAP 1

//dynamic deagle
#define DEAGLE_SAP 7
#define DEAGLE_FROST 1.0
#define DEAGLE_FIRE 3
#define DEAGLE_POWER 300.0
#define DEAGLE_SHOCK 500.0
#define DEAGLE_HEALTH 200
#define DEAGLE_AP_MIN 5
#define DEAGLE_AP_MAX 25
#define DEAGLE_NUMBER 3

//gauntlets
#define GAUNTLET_SAP 4
#define GAUNTLET_INCREASE 10.0
#define GAUNTLET_MIN 1.0
#define GAUNTLET_MAX 5.0
#define GAUNTLET_KNIFE 10.0
#define GAUNTLET_NUMBER 2

//Doomsday's shotgun
#define DDAY_SAP 6
#define DDAY_NUMBER 1
#define DDAY_LOW 25.0
#define DDAY_HIGH 50.0
#define DDAY_FROST 1.0
#define DDAY_FIRE 3
#define DDAY_POWER 300.0
#define DDAY_SHOCK 800.0
#define DDAY_HEALTH 200
#define DDAY_AP_MIN 10
#define DDAY_AP_MAX 20

//Doomsday's USP
#define DDAY2_SAP 4
#define DDAY2_NUMBER 1
#define DDAY2_FROST 1.0
#define DDAY2_FIRE 3
#define DDAY2_ARMOR_MIN 5
#define DDAY2_ARMOR_MAX 10
#define DDAY2_AP_MIN 2
#define DDAY2_AP_MAX 8

//Wild West gun
#define WW_SAP 6
#define WW_NUMBER 1
#define WW_LOW 25.0
#define WW_HIGH 50.0
#define WW_FIRE 3
#define WW_POWER 300.0
#define WW_SHOCK 800.0
#define WW_AP_MIN 5
#define WW_AP_MAX 10


//survivor
#define SURVIVOR_SAP 2
#define SURVIVOR_NUMBER 2

//imperial armor
#define IMPERIAL_SAP 2
#define IMPERIAL_ARMOR 1000

//Lottery
#define LOTTERY_SAP 1
#define MAX_LOTTERY 3

//Extra Ammo For Infection (EAFI)
#define EAFI_SAP 1

//respawn
#define REVIVE_SAP 1

enum ( <<= 1 )
{
    TRIE_IMPERIAL = 1,
}

#if SQLON
    #include <dbi>
#else
    #include <nfvault>
#endif

#if SQLON
    new Sql:dbc
    new Result:result
#else
    new allowfilepath[251]
#endif

enum BANK_DATA {
    BANK_BALANCE,                //money someone has in their bank
    BANK_LIMIT,            //max money someone can have in their bank
    BANK_INTTIME,                //rounds until interest
    BANK_INTEREST,                //interest ammount
    BANK_ROUNDS,                //how many rounds theyve waited
    BANK_SAP,            //sap someone has in their bank
}
new const BANK_SAVES[BANK_DATA][] = {
    "Balance",
    "Limit",
    "IntTime",
    "IntRate",
    "Rounds",
    "SAP"
}
new const BANK_MIN[BANK_DATA] = {
    0,
    0,
    0,
    0,
    0,
    0
}
new const BANK_MAX[BANK_DATA] = {
    99999,
    MAX_LIMITS-1,
    MAX_INTTIME-1,
    MAX_INTERESTS-1,
    99999,
    99999
}

new play_bank[33][BANK_DATA];

//new HELPPAGE[] = "http://home.netcom.com/~everco_ice/bankhelp17.html"
new gHELPPAGE[125]

new bool:canuse[33] = false
new bankfees = 0
new rounds = 0
new sayspecial[33] = 0
new withdrawals[33]
new zombs

new loaded[33]

//new sap[33]
#define sap[%1] play_bank[%1][BANK_SAP]
//set_balance(id,balance)
#define set_balance(%1,%2) player_set_num(%1,"ZMbank",BANK_SAVES[BANK_BALANCE],(play_bank[%1][BANK_BALANCE]=%2))

new dynamic_deagle[33]
new deagle_count
new gauntlet[33]
new gauntlet_count
new dday[33]
new dday_count
new ww[33]
new ww_count
new day[33]
new day_count
new eafi[33]
new nemesis_count
new survivor_count
new lottery_count
new Trie:playeritem_trie;

new RICHER[] = "models/richer.mdl"

const UNIT_SECOND = (1<<12)
const FFADE_IN = 0x0000
const FFADE_STAYOUT = 0x0004
new g_msgScreenFade;
new g_exploSpr;
new syncObj;
new lightning;

new g_CachedStringInfoTarget




#define TASK_STEALTH 3000


new bank_default_opening, bank_state, bank_min_players, bank_restrict, bank_fees_base, bank_fees_increase
new bank_offrounds, bank_msg_interval, bank_msg, bank_use_ip

new g_LogFile[128]
new const gSoundActivate[] = "weapons/mine_activate.wav"

public plugin_init()
{
    new DataDir[128]
    get_localinfo("amxx_datadir",DataDir,127);
    format(g_LogFile,127,"%s/bank.log",DataDir)

    register_plugin("AMX Bank","2.5","twistedeuphoria/Emp`/Doomsday")
    register_concmd("bank_create","bank_create",ADMIN_ALL,"Create a new bank account.")
    register_concmd("bank_close","bank_close",ADMIN_CVAR,"Close the AMX Bank.")
    register_concmd("bank_open","bank_open",ADMIN_CVAR,"Open the AMX Bank for business.")
    register_concmd("bank_amount","bank_amount",ADMIN_ALL,"Display the amount of money you have in the bank.")
    register_concmd("bank_deposit","bank_deposit",ADMIN_ALL,"<amount> :Deposit money into your bank account.")
    register_concmd("bank_withdraw","bank_withdrawl",ADMIN_ALL,"<amount> :Withdraw money from your bank account.")
    register_concmd("bank_help","bank_help",ADMIN_ALL,"Open up the help for the bank.")
    register_concmd("bank_transfer","bank_transfer",ADMIN_ALL,"<user> <amount> : Transfer money to another player.")
    register_concmd("bank_givemoney","bank_givemoney",ADMIN_CVAR,"<user> <amount> : Give a user money.")
    register_concmd("bank_givesap","bank_givesap",ADMIN_RCON,"<user> <amount> : Give a user money.")
    register_concmd("bank_status","bank_status",ADMIN_CVAR,"<user> : Shows user bank stats in console.")
    register_concmd("bank_menu","bank_menu",ADMIN_ALL,"Open the bank menu.")
    register_concmd("sap_menu","sap_menu",ADMIN_ALL,"Open the special ammo pack menu.")
    register_concmd("bank_upgrade","bank_upgrade",ADMIN_ALL,"Upgrades for your bank.")
    register_concmd("maxdep","deposit_maximum",ADMIN_ALL,"Deposit all your money.")
    register_concmd("maxwit","withdrawl_maximum",ADMIN_ALL,"Withdraw until you have 50 ammo packs or your bank account is empty.")
        register_clcmd("say /help", "SAP_help")
    register_clcmd("say","say_cheese")
    register_clcmd("say_team","say_cheese")

    bank_default_opening = register_cvar("bank_default_opening","1000")
    bank_state = register_cvar("bank_state","1")
    bank_min_players = register_cvar("bank_min_players","1")
    bank_restrict = register_cvar("bank_restrict","0") // 0 = All user can use the bank 1 = Only users defined in file or SQL
    bank_fees_base = register_cvar("bank_fees_base","0")  //Base bank fee in $
    bank_fees_increase = register_cvar("bank_fees_increase","0") //Added to the base fee for each transaction in a round
    bank_offrounds = register_cvar("bank_offrounds","0") //How many rounds from the start of the map will bank be off for
    bank_msg_interval = register_cvar("bank_msg_interval","2560")
    bank_msg = register_cvar("bank_msg","^x04[ZP]^x01 Type ^x04bank_help in console^x01 to find out how to use the ammo packs bank.")
    bank_use_ip = register_cvar("bank_use_ip","1")

        register_event("StatusValue","show_status","be","1=2","2!0")
        register_event("StatusValue","hide_status","be","1=1","2=0")

    register_menucmd(register_menuid("Bank Menu:"),1023,"bank_menu_cmd")
    register_menucmd(register_menuid("Bank Upgrades:"),1023,"bank_upgrade_cmd")

    //register_logevent("giveinterest",2,"0=World triggered","1=Round_Start")
    set_task(60.0,"giveinterest",_,_,_,"b");

    #if SQLON
        set_task(5.0,"sqlinit")
    #else
        new directory[201]
        get_configsdir(directory,200)
        if(get_pcvar_num(bank_restrict) == 2)
        {
            formatex(allowfilepath,250,"%s/bankusers.ini",directory)
            if(!file_exists(allowfilepath))
            {
                new writestr[101]
                formatex(writestr,100,";Put all users who can use the bank in here.")
                write_file(allowfilepath,writestr)
            }            
        }
    #endif
    set_task(get_pcvar_float(bank_msg_interval),"bank_spam")

    get_configsdir(gHELPPAGE, 124)
    format(gHELPPAGE, 123, "%s/bank_help.html", gHELPPAGE)

    g_msgScreenFade = get_user_msgid("ScreenFade");
    syncObj = CreateHudSyncObj();
    RegisterHam(Ham_TakeDamage, "player", "HamPreDamage");
    RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1);
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled_Post", 1);
    RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);

    g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );

    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")

    playeritem_trie = TrieCreate();
}
public plugin_precache()
{
    g_exploSpr = engfunc(EngFunc_PrecacheModel, "sprites/shockwave.spr")
    lightning = engfunc(EngFunc_PrecacheModel,  "sprites/lgtning.spr")
    precache_sound(gSoundActivate);

        precache_model(RICHER)
}
public check_use(id,pos)
{
    if(id)
    {
        if( canuse[id] == false)
        {
                print(id, "^x04[ZP]^x03 You are not allowed to use the bank^x01.")
        }
    }
    new cvarrounds = get_pcvar_num(bank_offrounds)
    if(rounds <= cvarrounds)
    {
            print(id,"^x04[ZP]^x01 Sorry, the bank is disabled for the first ^x04%d^x01 rounds of the map.",cvarrounds)
    }
    if(!get_pcvar_num(bank_state))
    {
            print(id, "^x04[ZP]^x03 Sorry, the bank is closed and no transactions are being processed^x01.")
    }
    new players = get_playersnum()
    new minplayers = get_pcvar_num(bank_min_players)
    if(players < minplayers)
    {
            print(id, "^x04[ZP]^x01 There must be at least ^x04%d^x01 players connected to use the bank.",minplayers)
    }
    return 1
}

stock SaveAll(id)
{
    for( new BANK_DATA:i=BANK_BALANCE; i<BANK_DATA; i++ )
        player_set_num( id, "ZMbank", BANK_SAVES[i], play_bank[id][i] );
}

public bank_menu(id)
{
    new client = 0
    if(read_argc() > 1)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED
    load(id);
    new menubody[276], keys = 0,len
    new bool:hasacc = true
    len = format(menubody,275,"\rBank Menu:\w^n")
    new balance = play_bank[id][BANK_BALANCE];
    if(balance == -1)
    {
        hasacc = false
        len += format(menubody[len],275-len,"1. Open a Bank Account^n\d")
        keys |= (1<<0|1<<9)        
    }
    else
    {
        len += format(menubody[len],275-len,"^nCurrent Balance: %d/%d^nTime Until Interest: %d Minutes\w^n^n", balance, Limit[play_bank[id][BANK_LIMIT]], IntTime[play_bank[id][BANK_INTTIME]] - play_bank[id][BANK_ROUNDS])
    }
    len += format(menubody[len],275-len,"2. Deposit Money^n3. Deposit All^n4. Withdraw Money^n5. Withdraw Maximum^n6. Bank Help^n7. Transfer Money^n8. \yBank Upgrades^n^n")
    if(hasacc)
    {
        len += format(menubody[len],275-len,"0. Exit")
        keys |= (1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
    }
    else
        len += format(menubody[len],275-len,"\w0. Exit")
    show_menu(id,keys,menubody,-1,"Bank Menu:")
    return PLUGIN_HANDLED
}

public bank_menu_cmd(id,key)
{
    switch(key)
    {
        case 0:
                {
                        client_cmd(id,"bank_create 1")
                        print(id, "^x04[ZP]^x01 Your Bank account will be opened ^x04next map^x01!")
                }
//        case 1: client_cmd(id,"bank_amount 1")
        case 1:
        {
            sayspecial[id] = 1
            print(id, "^x04[ZP]^x01 Please enter the amount you want to deposit in chat:")
        }            
        case 2: client_cmd(id,"maxdep")
        case 3:
        {    
            sayspecial[id] = 2
            print(id, "^x04[ZP]^x01 Please enter the amount you want to withdraw in chat:")
        }
        case 4: client_cmd(id,"maxwit")
        case 5:    client_cmd(id,"bank_help")
        case 6:
        {
            sayspecial[id] = 3
            print(id, "^x04[ZP]^x01 Please enter the person you want to transfer to and the amount you want to transfer in chat:")
        }
        case 7:    client_cmd(id,"bank_upgrade")
    }
    return PLUGIN_HANDLED
}

public bank_upgrade(id)
{
    new client = 0
    if(read_argc() > 1)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED

    if( play_bank[id][BANK_BALANCE] <= 0 ){
        print(id, "^x04[ZP]^x01 You have no money in the bank.");
        return PLUGIN_HANDLED;
    }

    new menubody[512], keys = 0,len

    len = format(menubody,511,"\rBank Upgrades:^n^n")
    new currentstat;

    currentstat = play_bank[id][BANK_LIMIT]
    if( currentstat < MAX_LIMITS-1 ){
        len += format(menubody[len],511-len,"\w1. Bank Limit from %d to \r%d (\y$%d)^n", Limit[currentstat], Limit[currentstat+1], CostLimit[currentstat])
        keys |= (1<<0)
    }
    else
        len += format(menubody[len],511-len,"\d1. Bank Limit is %d^n", Limit[currentstat])

    currentstat = play_bank[id][BANK_INTTIME]
    if( currentstat < MAX_INTTIME-1 ){
        len += format(menubody[len],511-len,"\w2. Interest Time from %d to \r%d Minutes (\y$%d)^n", IntTime[currentstat], IntTime[currentstat+1], CostIntTime[currentstat])
        keys |= (1<<1)
    }
    else
        len += format(menubody[len],511-len,"\d2. Interest Time is %d Minutes^n", IntTime[currentstat])

    currentstat = play_bank[id][BANK_INTEREST]
    if( currentstat < MAX_INTERESTS-1 ){
        len += format(menubody[len],511-len,"\w3. Interest Rate from %0.1f%% to \r%0.1f%% (\y$%d)^n", 100.0*Interest[currentstat], 100.0*Interest[currentstat+1], CostInterest[currentstat])
        keys |= (1<<2)
    }
    else
        len += format(menubody[len],511-len,"\d3. Interest Rate is %0.1f%%^n", 100.0*Interest[currentstat])

    len += format(menubody[len],511-len,"\w0. Exit")
    keys |= (1<<9)

    show_menu(id,keys,menubody,-1,"Bank Upgrades:")
    return PLUGIN_HANDLED
}

public bank_upgrade_cmd(id,key)
{
    new balance = play_bank[id][BANK_BALANCE];
    switch(key)
    {
        case 0:{
            new currentstat = play_bank[id][BANK_LIMIT]
            new cost = CostLimit[currentstat]
            if( balance < cost ){
                print(id, "^x04[ZP]^x01 You need ^x04%d^x01 ammo packs more to upgrade this.", balance-cost );
            }
            else{
                play_bank[id][BANK_LIMIT]++;
                set_balance(id, balance-cost);    //save the new upgrade
                player_set_num(id,"ZMbank", BANK_SAVES[BANK_LIMIT], play_bank[id][BANK_LIMIT] );
                print(id, "^x04[ZP]^x01 You have upgraded your ^x04Bank Limit^x01." );
            }
            bank_upgrade(id);
        }
        case 1:{
            new currentstat = play_bank[id][BANK_INTTIME]
            new cost = CostIntTime[currentstat]
            if( balance < cost ){
                print(id, "^x04[ZP]^x01 You need ^x04%d^x01 ammo packs more to upgrade this.", balance-cost );
            }
            else{
                play_bank[id][BANK_INTTIME]++;
                set_balance(id, balance-cost);    //save the new upgrade
                player_set_num(id,"ZMbank", BANK_SAVES[BANK_INTTIME], play_bank[id][BANK_INTTIME] );
                print(id, "^x04[ZP]^x01 You have upgraded your ^x04Interest Time^x01." );
            }
            bank_upgrade(id);
        }
        case 2:{
            new currentstat = play_bank[id][BANK_INTEREST]
            new cost = CostInterest[currentstat]
            if( balance < cost ){
                print(id, "^x04[ZP]^x01 You need ^x04%d^x01 ammo packs more to upgrade this.", balance-cost );
            }
            else{
                play_bank[id][BANK_INTEREST]++;
                set_balance(id, balance-cost);    //save the new upgrade
                player_set_num(id,"ZMbank", BANK_SAVES[BANK_INTEREST], play_bank[id][BANK_INTEREST] );
                print(id, "^x04[ZP]^x01 You have upgraded your ^x04Interest Rate^x01." );
            }
            bank_upgrade(id);
        }
        case 9:    bank_menu(id);
    }
    return PLUGIN_HANDLED
}

public sap_menu(id)
{
    #if ENABLE_SAP == 0
        print(id, "^x04[ZP]^x01 Special Ammo Pack Menu is ^x04Disabled^x01.");
        return PLUGIN_HANDLED;
    #else
    new client = 0
    if(read_argc() > 1)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED

    load(id);
    
    new title[64];
    formatex(title, 63, "\y Special Ammo Pack Menu (\r%d SAP\y)", sap[id]);
    new menu = menu_create(title, "sap_menu_handler")

    sapmenu_additem(menu, "\rItem \yDescriptions\r/\yHelp", 0, "help", false);

    formatex(title, 63, "Convert \y%d AP \wto \r%d SAP", CONVERT_AP, CONVERT_SAP);
    sapmenu_additem(menu, title, 0, "aptosap", false);

    formatex(title, 63, "Convert \r%d SAP \wto \y%d AP", CONVERT2_SAP, CONVERT2_AP);
    sapmenu_additem(menu, title, 0, "saptoap");

    formatex(title, 63, "Donate \r%d SAP \wto \ySomeone", DONATE_SAP);
    sapmenu_additem(menu, title, 0, "donate");

    #if ENABLE_SAPITEMS == 1
    if( is_user_alive(id) )
    {
        sapmenu_additem(menu, "Stealth Mode", STEALTH_SAP, "stealth");
        sapmenu_additem(menu, "Subzero Frost", FROST_SAP, "frost");
                sapmenu_additem(menu, "Scorpion's Flame", FLAME_SAP, "flame");
        sapmenu_additem(menu, "Extra Ammo for infections", EAFI_SAP, "eafi");
        if( zp_get_user_zombie(id) )
        {
            sapmenu_additem(menu, "Black Out", BLACK_SAP, "black");
            sapmenu_additem(menu, "Armor Leecher", LEECH_SAP, "leech");
            sapmenu_additem(menu, "Black Hole", HOLE_SAP, "hole");
        }
        else
        {
                        sapmenu_additem(menu, "Geographic Repositioner", SWAP_SAP, "swap");
            sapmenu_additem(menu, "Dynamic Deagle", DEAGLE_SAP, "deagle");
            sapmenu_additem(menu, "Imperial Armor", IMPERIAL_SAP, "imperial");
            sapmenu_additem(menu, "Emp`s Gauntlets", GAUNTLET_SAP, "gauntlet");
                        sapmenu_additem(menu, "Doomsday's Shotgun", DDAY_SAP, "dday");
                        sapmenu_additem(menu, "Doomsday's USP", DDAY2_SAP, "usp");
                        sapmenu_additem(menu, "Wild West gun", WW_SAP, "wwgun");
            sapmenu_additem(menu, "Survivor", SURVIVOR_SAP, "survivor");
            sapmenu_additem(menu, "Self Infection", INFECT_SAP, "infect");
                sapmenu_additem(menu, "Lottery", LOTTERY_SAP, "lottery");

        }
        sapmenu_additem(menu, "Nemesis", NEMESIS_SAP, "nemesis");
    }
    else
    {
        sapmenu_additem(menu, "Respawn", REVIVE_SAP, "revive");
    }
    #else
        menu_addtext(menu, "^nSAP Items are Disabled", 0);
    #endif

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);

    return PLUGIN_HANDLED
    #endif
}
#if ENABLE_SAP != 0
sapmenu_additem(menu, name[], cost, data[], bool:sap=true)
{
    new name2[64];
    if( cost )
        formatex(name2, 63, sap ? "\w%s\R\r%d SAP" : "\w%s\R\r%d AP", name, cost);
    else
        formatex(name2, 63, "\w%s", name);
    menu_additem(menu, name2, data, 0);
}
#endif

public sap_menu_handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new data[21], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,20, iName, 63, callback);
    menu_destroy(menu);
    sap_action( id, data );
    return PLUGIN_HANDLED;
}
sap_action( id, data[21] )
{
    new iName[64];
    if( equal( data, "help" ) )
    {
        SAPHelp(id);
    }
    else if( equal( data, "aptosap" ) )
    {
        if( CheckAP(id, CONVERT_AP) )
        {
            sap[id] += CONVERT_SAP;
            player_set_num(id,"ZMbank", BANK_SAVES[BANK_SAP], play_bank[id][BANK_SAP] );
            print(id, "^x04[ZP]^x01 You converted ^x04%d^x01 APs to ^x04%d^x01 SAP. You now have ^x04%d^x01 SAPs.", CONVERT_AP, CONVERT_SAP, sap[id]);
            formatex(iName, 63, "converted %d APs to %d SAP", CONVERT_AP, CONVERT_SAP);
            SAPMessage(id, iName, _, false);
        }
    }
    else if( equal( data, "saptoap" ) )
    {
        new balance = play_bank[id][BANK_BALANCE];
        if( balance < Limit[play_bank[id][BANK_LIMIT]] )
        {
            if( CheckSAP(id, CONVERT2_SAP) )
            {
                balance += CONVERT2_AP;
                set_balance(id, balance);    //save the new ap
                print(id, "^x04[ZP]^x01 You converted ^x04%d^x01 SAP to ^x04%d^x01 APs. You now have ^x04%d^x01 APs.", CONVERT2_SAP, CONVERT_AP, balance);
                formatex(iName, 63, "converted %d SAP to %d APs", CONVERT2_SAP, CONVERT2_AP);
                SAPMessage(id, iName, _, false);
            }
        }
        else
        {
            print(id, "^x04[ZP]^x01 The max amount to have in bank is ^x04%d^x01.",Limit[play_bank[id][BANK_LIMIT]])
        }
    }
    else if( equal( data, "donate" ) )
    {
        if( sap[id] >= DONATE_SAP )
        {
            new menu = menu_create("Donate To Who?", "donate_menu_handler")

            for( new i=1; i<32; i++ )
            {
                if( loaded[i] )
                {
                    get_user_name( i, iName, 63 );
                    formatex( data, 20, "%d", i );
                    menu_additem(menu, iName, data);
                }
            }
            menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
            menu_display(id, menu, 0);
            return PLUGIN_HANDLED;
        }
        else
        {
            print(id, "^x04[ZP]^x01 You need ^x04%d^x01 SAP to donate to someone.", DONATE_SAP)
        }
    }
    else if( is_user_alive(id) )
    {
        if( equal( data, "stealth" ) )
        {
            if( CheckSAP(id, STEALTH_SAP) )
            {
                print(id, "^x04[ZP]^x01 You bought ^x03Stealth Mode^x01.");
                set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0 );
                remove_task(id+TASK_STEALTH);
                set_task(STEALTH_TIME, "reset_render", id+TASK_STEALTH);
                new mess[128];
                formatex(mess, 127, "entered Stealth Mode for %0.1f seconds", STEALTH_TIME);
                SAPMessage(id, mess);
            }
        }
        else if( equal( data, "swap" ) )
        {
            if( CheckSAP(id, SWAP_SAP) )
            {
                print(id, "^x04[ZP]^x01 You bought ^x03Geographic Repositioner^x01.");
                new parm[2];
                parm[0] =id;
                parm[1] = SWAP_TIME;
                geo_reposition(parm);
            }
        }
        else if( equal( data, "frost" ) )
        {
            if( CheckSAP(id, FROST_SAP) )
            {
                print(id, "^x04[ZP]^x01 You bought ^x03Subzero Frost^x01.");

                new Float:originF[3];
                pev(id, pev_origin, originF);
    
                // Make the explosion
                create_blast3(originF);

                new team = _:cs_get_user_team(id);
                for( new i; i<33; i++ )
                {
                    if( is_user_alive(i) && _:cs_get_user_team(i) != team )
                        zp_set_user_frozen(i, 1, FROST_TIME );
                }
                if( zp_get_user_zombie(id) )
                    SAPMessage(id, "Unleashed Subzero Frost^nAll Humans Have Frozen");
                else
                    SAPMessage(id, "Unleashed Subzero Frost^nAll Zombies Have Frozen");
            }
        }
        else if( equal( data, "flame" ) )
        {
            if( CheckSAP(id, FLAME_SAP) )
            {
                print(id, "^x04[ZP]^x01 You bought ^x03Scorpion's Flame^x01.");

                new Float:originF[3];
                pev(id, pev_origin, originF);
    
                // Make the explosion
                create_blast4(originF);

                new team = _:cs_get_user_team(id);
                for( new i; i<33; i++ )
                {
                    if( is_user_alive(i) && _:cs_get_user_team(i) != team )
                        zp_set_user_burn(i, FLAME_FIRE);

                }
                if( zp_get_user_zombie(id) )
                    SAPMessage(id, "Unleashed Scorpion's Flame^nAll Humans Have Burn");
                else
                    SAPMessage(id, "Unleashed Scorpion's Flame^nAll Zombies Have Burn");
            }
        }
        else if( equal( data, "lottery" ) )
        {
                        if( lottery_count < MAX_LOTTERY )
                        {
                    if( CheckSAP(id, LOTTERY_SAP) )
                    {
                                print(id, "^x04[ZP]^x01 You Bought ^x03Lottery^x01.")
                SAPMessage(id, "Bought Lottery");
                                lottery_count++;

                                switch( random(8) )
                    {
                case 1:{
                    zp_set_user_frozen(id, 1, 5.0);
                                        print(id, "^x04[ZP]^x01 You are not lucky! ^x03You Have just been frozen^x01.")
                    }
                case 2:{
                                       zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 25 );
                                       print(id, "^x04[ZP]^x01 You are not very lucky! ^x03You Have just got ^x04%d^x01 ammo packs^x01.", 25)
                }
                case 3:{
                                       zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 50 );
                                       print(id, "^x04[ZP]^x01 You are not very lucky! ^x03You Have just got ^x04%d^x01 ammo packs^x01.", 50)
                }
                case 4:{
                                       zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 75 );
                                       print(id, "^x04[ZP]^x01 You are Lucky! ^x03You Have just got ^x04%d^x01 ammo packs^x01.", 75)
                }
                case 5:{
                                       set_user_health(id, get_user_health(id) + 2500 );                                                                                        
                                       set_user_armor(id, get_user_armor(id) +250)
                                       print(id, "^x04[ZP]^x01 You are Lucky! ^x03You Have just got 2500HP + 250 AP^x01.")
                                      
                }
                case 6:{
                                             print(id, "^x04[ZP]^x01 You are not Lucky! ^x03You got NOTHING^x01.")
                }
                case 7:{
                                       give_item(id, "weapon_hegrenade");      
                                       give_item(id, "weapon_flashbang");
                                       give_item(id, "weapon_smokegrenade");                                                                                                        
                                       print(id, "^x04[ZP]^x01 You are not very Lucky! ^x03You just got extra Grenades pack^x01.")                                      
                }
                default:{
                                        set_user_gravity(id, 0.5);
                                        print(id, "^x04[ZP]^x01 You are not very Lucky! ^x03You just got 400 gravity^x01.")
                                      
                        }
                    }

                                }
                
            }
                        else
                                client_print(id, print_center, "Too many Lotteries bought");
        }
                else if( equal( data, "eafi" ) )
        {
            if( CheckSAP(id, EAFI_SAP) )
            {
                print(id, "^x04[ZP]^x01 Now you will get ^x03more ammo for infecting humans^x01.");
                                eafi[id] = 1;
                    SAPMessage(id, "Bought Extra ammo for infections");
            }
        }
        else if( equal( data, "nemesis" ) )
        {
            if( nemesis_count < NEMESIS_NUMBER )
            {
                if( !zp_get_user_last_human(id) && !zp_get_user_nemesis(id) && !zp_is_nemesis_round() && !zp_is_survivor_round() )
                {
                    if( CheckSAP(id, NEMESIS_SAP) )
                    {
                        print(id, "^x04[ZP]^x01 You bought ^x03Nemesis^x01.");
                        zp_make_user_nemesis(id);
                        if( zp_is_nemesis_round() )
                        nemesis_count++;
                        SAPMessage(id, "Bought The Powers Of A Nemesis");
                    }
                }
                else
                    client_print(id, print_center, "Could Not Buy Item");
            }
            else
                client_print(id, print_center, "Too Many Nemesis Rounds");
        }
        else
        {
            if( zp_get_user_zombie(id) )
            {
                if( equal( data, "black" ) )
                {
                    if( CheckSAP(id, BLACK_SAP) )
                    {
                        print(id, "^x04[ZP]^x01 You bought ^x03Black Out^x01.");
                        new parm[3];
                        parm[0] = id;
                        parm[1] = BLACK_TIME;
                        parm[2] = _:cs_get_user_team(id);
                        blackout(parm);
                    }
                }
                else if( equal( data, "leech" ) )
                {
                    if( CheckSAP(id, LEECH_SAP) )
                    {
                        print(id, "^x04[ZP]^x01 You bought ^x03Armor Leecher^x01.");
                        SAPMessage(id, "Is Leeching All Human Armor");
                        new parm[2];
                        parm[0] = id;
                        parm[1] = LEECH_TIME;
                        leech_armor(parm);
                    }
                }
                else if( equal( data, "hole" ) )
                {
                    if( CheckSAP(id, HOLE_SAP) )
                    {
                        print(id, "^x04[ZP]^x01 You bought ^x03Black Hole^x01.");
                        SAPMessage(id, "Has Become A Black Hole!^nSucking All Humans!");
                        new parm[2];
                        parm[0] = id;
                        parm[1] = HOLE_TIME*10;
                        blackhole(parm);
                    }
                }
            }
            else
            {
                if( equal( data, "deagle" ) )
                {
                    if( deagle_count < DEAGLE_NUMBER )
                    {
                        if( !gauntlet[id] )
                        {
                            if( CheckSAP(id, DEAGLE_SAP) )
                            {
                                print(id, "^x04[ZP]^x01 You bought ^x03Dynamic Deagle^x01.");
                                SAPMessage(id, "Bought A Dynamic Deagle");
                                dynamic_deagle[id] = 1;
                                deagle_count++;
                                give_item(id, "weapon_deagle");
                                                                cs_set_user_bpammo(id, CSW_DEAGLE, 254);
                            }
                        }
                        else
                            client_print(id, print_center, "Cannot Buy With Emp`s Gauntlets");
                    }
                    else
                        client_print(id, print_center, "Too Many Dynamic Deagles Bought");
                }
                else if( equal( data, "gauntlet" ) )
                {
                    if( gauntlet_count < GAUNTLET_NUMBER )
                    {
                        if( !dynamic_deagle[id] )
                        {
                            if( CheckSAP(id, GAUNTLET_SAP) )
                            {
                                print(id, "^x04[ZP]^x01 You bought ^x03Emp's Gauntlets^x01.")
                                SAPMessage(id, "Bought Emp`s Gauntlets");
                                gauntlet[id] = 1;
                                gauntlet_count++;
                            }
                        }
                        else
                            client_print(id, print_center, "Cannot Buy With Dynamic Deagle");                    }
                    else
                        client_print(id, print_center, "Too Many Gauntlets Bought");
                }
                                else if( equal( data, "dday" ) )
                {
                    if( dday_count < DDAY_NUMBER )
                    {
                        
                          if( CheckSAP(id, DDAY_SAP) )
                          {
                            print(id, "^x04[ZP]^x01 You bought ^x03Doomsday's Shotgun^x01.")
                            SAPMessage(id, "Bought Doomsday's Shotgun");
                            dday[id] = 1;
                            dday_count++;
                                    give_item(id, "weapon_m3");
                                                        cs_set_user_bpammo(id, CSW_M3, 254);
                          }
                         }
                    else
                        client_print(id, print_center, "Too Many Doomsday's Shotgun bought");
                }
                                else if( equal( data, "wwgun" ) )
                {
                    if( ww_count < WW_NUMBER )
                    {
                        
                          if( CheckSAP(id, WW_SAP) )
                          {
                            print(id, "^x04[ZP]^x01 You bought ^x03Wild West gun^x01.");
                            SAPMessage(id, "Bought Wild West gun");
                            ww[id] = 1;
                            ww_count++;
                                    give_item(id, "weapon_fiveseven");
                                                        cs_set_user_bpammo(id, CSW_FIVESEVEN, 254);
                          }
                         }
                    else
                        client_print(id, print_center, "Too Many Wild West guns bought");
                }

                                else if( equal( data, "usp" ) )
                {
                    if( day_count < DDAY2_NUMBER )
                    {
                        
                          if( CheckSAP(id, DDAY2_SAP) )
                          {
                            print(id, "^x04[ZP]^x01 You bought ^x03Doomsday's USP^x01.");
                            SAPMessage(id, "Bought Doomsday's USP");
                            day[id] = 1;
                            day_count++;
                                    give_item(id, "weapon_usp");
                                                        cs_set_user_bpammo(id, CSW_USP, 254);
                          }
                         }
                    else
                        client_print(id, print_center, "Too Many Doomsday's USP bought");
                }

                else if( equal( data, "survivor" ) )
                {
                    if( survivor_count < SURVIVOR_NUMBER )
                    {
                        if( !zp_get_user_last_zombie(id) && !zp_get_user_survivor(id) && !zp_is_nemesis_round() && !zp_is_survivor_round() )
                        {
                            if( CheckSAP(id, SURVIVOR_SAP) )
                            {
                                print(id, "^x04[ZP]^x01 You bought ^x03Survivor^x01.");
                                zp_make_user_survivor(id);
                                if( !zp_is_survivor_round() )
                                    set_user_armor(id, 200);
                                survivor_count++;
                                SAPMessage(id, "Bought The Powers Of A Survivor");
                            }
                        }
                        else
                            client_print(id, print_center, "Could Not Buy Item");
                    }
                    else
                        client_print(id, print_center, "Too Many Survivor Rounds Already");
                }
                else if( equal( data, "imperial" ) )
                {
                    new armor = get_user_armor(id);
                    if( armor <= 200 )
                    {
                        new authid[32];
                        get_user_authid(id, authid, 31);
                        new key_exists = TrieKeyExists(playeritem_trie, authid);
                        new playeritems;
                        if( key_exists )
                            TrieGetCell(playeritem_trie, authid, playeritems);
                        if( !(playeritems & TRIE_IMPERIAL) )
                        {
                            if( CheckSAP(id, IMPERIAL_SAP) )
                            {
                                print(id, "^x04[ZP]^x01 You bought ^x03Imperial Armor^x01.");
                                SAPMessage(id, "Bought Imperial Armor");
                                set_user_armor(id, armor+IMPERIAL_ARMOR);
                                TrieSetCell(playeritem_trie, authid, playeritems|TRIE_IMPERIAL);
                            }
                        }
                        else
                            client_print(id, print_center, "You Already Bought Imperial Armor");
                    }
                    else
                        client_print(id, print_center, "You Have Too Much Armor");
                }
                else if( equal( data, "infect" ) )
                {
                    if( !zp_get_user_last_human(id) && !zp_is_nemesis_round() && !zp_is_survivor_round() )
                    {
                        if( CheckSAP(id, INFECT_SAP) )
                        {
                            print(id, "^x04[ZP]^x01 You have ^x03infected yourself^x01 with the plague.");
                            SAPMessage(id, "Self-Infected");
                            zp_infect_user(id);
                        }
                    }
                    else
                        client_print(id, print_center, "Could Not Buy Item");
                }
            }
        }
    }
    else
    {
        if( equal( data, "revive" ) )
        {
            if( CheckSAP(id, REVIVE_SAP) )
            {
                print(id, "^x04[ZP]^x01 You bought ^x03Respawn^x01.");
                zp_respawn_user(id, ZP_TEAM_HUMAN);
                //ExecuteHamB(Ham_CS_RoundRespawn, id);
                SAPMessage(id, "Bought A Respawn");
            }
        }
    }

    sap_menu(id);

    return PLUGIN_HANDLED;
}
public donate_menu_handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new data[32], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,31, iName, 63, callback);
    menu_destroy(menu);

    new reciever = str_to_num( data );
    if( is_user_connected(reciever) && CheckSAP(id, DONATE_SAP) )
    {
        sap[reciever] += DONATE_SAP;
        player_set_num( reciever, "ZMbank", BANK_SAVES[BANK_SAP], sap[reciever] );
        get_user_name(id, iName, 63);
        get_user_name(reciever, data, 31);
        print(id, "^x04[ZP]^x01 ^x04%s^x01 just donated ^x03%d^x01 SAP to ^x04%s^x01.", iName, DONATE_SAP, data);
    }

    return PLUGIN_HANDLED;
}
CheckSAP(id, num)
{
    if( sap[id] < num )
    {
        print(id, "^x04[ZP]^x01 You do not have enough SAPs.");
        client_print(id, print_center, "You do not have enough SAPs.");
        return false;
    }
    sap[id] -= num;
    player_set_num( id, "ZMbank", BANK_SAVES[BANK_SAP], sap[id] );
    return true;
}
CheckAP(id, num)
{
    new onhand = zp_get_user_ammo_packs(id);
    if( onhand >= num )
    {
        zp_set_user_ammo_packs(id, onhand-num);
        return true;
    }

    new balance = play_bank[id][BANK_BALANCE];
    if( balance < num )
    {
        print(id, "^x04[ZP]^x01 You do not have enough APs.");
        client_print(id, print_center, "You do not have enough APs.");
        return false;
    }
    set_balance(id, balance-num);    //save the new ap
    return true;
}
SAPMessage(id, message[], Float:time=5.0, bool:show_all=true)
{
    if( !is_user_connected(id) )
        return;

    new name[32];
    get_user_name(id, name, 31);
    set_hudmessage(random(51),255,random(51),-1.0,0.3,0,2.0,time,0.0,0.0,-1);
    ShowSyncHudMsg(show_all ? 0 : id, syncObj, "%s %s", name, message);
}

public bank_givemoney(id,level,cid)
{
    if(!cmd_access(id,level,cid,3))
        return PLUGIN_HANDLED
    new target[32], tid
    read_argv(1,target,31)
    tid = cmd_target(id,target,2)

    if( id && tid == id )
    {
        console_print(id,"[ZP] You cannot give ammo packs to yourself.");
        return PLUGIN_HANDLED;
    }

    new amountstr[10], amount
    read_argv(2,amountstr,9)
    amount = str_to_num(amountstr)

    //check for valid targets
    if(!tid)
    {
        console_print(id,"[ZP] Checking for account %s.", target);
        //Check for a valid steamid
        if( equali(target, "STEAM", 5) )
        {
            replace_all(target,31," ", "");
            new authid[32];
            get_user_authid(id, authid ,31);
            if( containi(target, ".txt") == -1 )
                add(target,31, ".txt");
            nfv_string_clean( target, target, 31 )
            nfv_string_clean( authid, authid, 31 )
            if( equali(target, authid) )
            {
                console_print(id,"[ZP] You cannot give ammo packs to yourself.");
                return PLUGIN_HANDLED
            }

            new balance = nfv_add_num( nfv_file(target), "ZMbank", BANK_SAVES[BANK_BALANCE], amount );
            new adminbalance = nfv_add_num( nfv_file(target), "ZMbank", "AdminAP", amount );
            console_print(id,"[ZP] Account %s now has a balance of %d ammo packs. Total of %d ap from admins.",target,balance,adminbalance);
        }
        return PLUGIN_HANDLED
    }

    if( !amount )
        return PLUGIN_HANDLED;

    load(tid);
    new totam = amount

    player_add_num( tid, "ZMbank", "AdminAP", amount );

    new curmoney = zp_get_user_ammo_packs(tid)
    if( amount > 0 )
    {
        new newtotal = curmoney + amount
        if(newtotal > MAX_MONEY)
        {        
            zp_set_user_ammo_packs(tid,MAX_MONEY)
            amount = newtotal - MAX_MONEY
        }
        else
        {
            zp_set_user_ammo_packs(tid,newtotal)
            amount = 0
        }
    }
    else
    {
        if( curmoney > abs( amount ) )
        {
            zp_set_user_ammo_packs(tid,curmoney + amount)
            amount = 0
        }
        else
        {
            zp_set_user_ammo_packs(tid,0)
            amount += curmoney
        }
    }
    
    if(amount != 0)
    {    
        new balance = play_bank[id][BANK_BALANCE]
        if(balance != -1)
            set_balance(tid,balance + amount)
    }

    new name[32], tname[32]
    get_user_name(id,name,31)
    get_user_name(tid,tname,31)
    if(read_argc() == 4)
        print(id, "^x04[ZP]^x01 You gave ^x03%s^x04 %d^x01 ammo packs.",tname,totam)
    else
        console_print(id,"[ZP] You gave %s %d ammo packs.",tname,totam)
    print(tid, "^x04[ZP]^x03 %s^x01 gave you ^x04%d^x01 ammo packs, ^x04%d^x01 ammo packs of which went into your bank account.",name,totam,amount)

    new logger[128], sid[35], date[128];
    get_user_authid(tid, sid, 34);
    get_time("%m/%d/%Y - %H:%M:%S", date, 127);

    formatex(logger, 127, "%s %s gave %s %d ap, %d ap went into bank (%s).",date, name, tname, totam, amount, sid)
    write_file(g_LogFile, logger, -1);
    return PLUGIN_HANDLED
}
public bank_givesap(id,level,cid)
{
    if(!cmd_access(id,level,cid,3))
        return PLUGIN_HANDLED
    new target[32], tid
    read_argv(1,target,31)
    tid = cmd_target(id,target,2)

    new amountstr[10], amount
    read_argv(2,amountstr,9)
    amount = str_to_num(amountstr)

    if( id && tid == id )
    {
        console_print(id,"[ZP] You cannot give ammopacks to yourself.");
        return PLUGIN_HANDLED;
    }

    if(!tid)
    {
        console_print(id,"[ZP] Checking for account %s.", target);
        //Check for a valid steamid
        if( equali(target, "STEAM", 5) )
        {
            replace_all(target,31," ", "");
            new authid[32];
            get_user_authid(id, authid ,31);
            if( containi(target, ".txt") == -1 )
                add(target,31, ".txt");
            nfv_string_clean( target, target, 31 )
            nfv_string_clean( authid, authid, 31 )
            if( equali(target, authid) )
            {
                console_print(id,"[ZP] You cannot give ammopacks to yourself.");
                return PLUGIN_HANDLED
            }

            new balance = nfv_add_num( nfv_file(target), "ZMbank", BANK_SAVES[BANK_SAP], amount );
            new adminbalance = nfv_add_num( nfv_file(target), "ZMbank", "AdminSAP", amount );
            console_print(id,"[ZP] Account %s now has a SAP balance of %d ammo packs. Total of %d given by admins.",target,balance,adminbalance);
        }
        return PLUGIN_HANDLED
    }

    load(tid);

    sap[tid] += amount;
    player_set_num( tid, "ZMbank", BANK_SAVES[BANK_SAP], sap[tid] );
    player_add_num( tid, "ZMbank", "AdminSAP", amount );

    new name[32], tname[32]
    get_user_name(id,name,31)
    get_user_name(tid,tname,31)
    if(read_argc() == 4)
        print(id, "^x04[ZP]^x01 You gave ^x03%s^x04 %d^x01 special ammo packs.",tname,amount)
    else
        console_print(id,"[ZP] You gave %s %d special ammo packs.",tname,amount)
    print(tid, "^x04[ZP]^x03 %s^x01 gave you ^x04%d^x01 special ammo packs.",name,amount)

    new logger[128], sid[35], date[128];
    get_user_authid(tid, sid, 34);
    get_time("%m/%d/%Y - %H:%M:%S", date, 127);

    formatex(logger, 127, "%s %s gave %s %d sap (%s).",date, name, tname, amount, sid)
    write_file(g_LogFile, logger, -1);
    return PLUGIN_HANDLED
}
public bank_status(id,level,cid)
{
    if(!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED
    new target[32], tid
    read_argv(1,target,31)
    tid = cmd_target(id,target,2)

    if(!tid)
    {
        console_print(id,"[Bank] Checking for account %s.", target);
        //Check for a valid steamid
        if( equali(target, "STEAM", 5) )
        {
            replace_all(target,31," ", "");
            if( containi(target, ".txt") == -1 )
                add(target,31, ".txt");
            nfv_string_clean( target, target, 31 );

            new balance = nfv_get_num( nfv_file(target), "ZMbank", BANK_SAVES[BANK_BALANCE] );
            new sap_balance = nfv_get_num( nfv_file(target), "ZMbank", BANK_SAVES[BANK_SAP] );
            console_print(id,"[ZP] Account %s has a balance of %d ap and %d sap.",target,balance, sap_balance);
            new adminbalance = nfv_get_num( nfv_file(target), "ZMbank", "AdminAP" );
            new adminsbalance = nfv_get_num( nfv_file(target), "ZMbank", "AdminSAP" );
            console_print(id,"[ZP] Account %s has been given %d ap and %d sap by admins.",target,adminbalance, adminsbalance);
        }
        return PLUGIN_HANDLED
    }

    new tname[32]
    get_user_name(tid,tname,31)

    print(id, "^x04[ZP]^x03 %s has ^x04%d^x01 ammo packs, ^x04%d^x01 in bank, ^x04%d^x01 bank limit, ^x04%d^x01 interest time, ^x04%0.2f^x01 interest, ^x04%d^x01 SAP.",tname,zp_get_user_ammo_packs(tid),play_bank[tid][BANK_BALANCE],Limit[play_bank[tid][BANK_LIMIT]],IntTime[play_bank[tid][BANK_INTTIME]],Interest[play_bank[tid][BANK_INTEREST]], sap[tid])
    console_print(id,"[ZP] %s has %d ammo packs, %d in bank, %d bank limit, %d interest time, %0.2f interest, %d SAP.",tname,zp_get_user_ammo_packs(tid),play_bank[tid][BANK_BALANCE],Limit[play_bank[tid][BANK_LIMIT]],IntTime[play_bank[tid][BANK_INTTIME]],Interest[play_bank[tid][BANK_INTEREST]], sap[tid])
    console_print(id,"[ZP] %s has been given %d ap and %d sap by admins.",tname, player_get_num( tid, "ZMbank", "AdminAP" ), player_get_num( tid, "ZMbank", "AdminSAP" ));

    return PLUGIN_HANDLED
}    

public bank_transfer(id)
{
    new client = 0
    if(read_argc() > 3)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED
    load(id);
    new target[32]
    read_argv(1,target,31)
    new tgt = cmd_target(id,target,8)
    if(!tgt)
        return PLUGIN_HANDLED
    if(id == tgt)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You may not transfer money to yourself.")
        else
            console_print(id,"[ZP] You may not transfer money to yourself.")
        return PLUGIN_HANDLED
    }        
    load(tgt);
    new tamounts[9],tamount
    read_argv(2,tamounts,8)
    tamount = str_to_num(tamounts)
    if(tamount <= 0) return PLUGIN_HANDLED
    new balance = play_bank[id][BANK_BALANCE]
    if(balance == -1)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You do not have a bank account to transfer money from.")
        else
            console_print(id,"[ZP] You do not have a bank account to transfer money from.")
        return PLUGIN_HANDLED
    }
    new tbalance = play_bank[tgt][BANK_BALANCE]
    new name[32], tname[32]
    get_user_name(tgt,tname,31)
    get_user_name(id,name,31)    
    if(tbalance == -1)
    {
        if(client)
            print(id, "^x04[ZP]^x03 %s^x01 does not have a bank account to transfer money to.",tname)
        else
            console_print(id,"[ZP] %s does not have a bank account to transfer money to.",tname)
        print(tgt, "^x04[ZP]^x01 %s tried to transfer money to your account but you don't have a bank account!",name)
        return PLUGIN_HANDLED
    }
    if(tbalance+tamount > Limit[play_bank[tgt][BANK_LIMIT]])
    {
        if(client)
            print(id, "^x04[ZP]^x03 %s^x01 does not have room in his bank account.",tname)
        else
            console_print(id,"[ZP] %s does not have room in his bank account.",tname)
        print(tgt, "^x04[ZP]^x03 %s^x01 tried to transfer money to your account but you don't have any room!",name)
        return PLUGIN_HANDLED
    }
    balance -= tamount
    balance -= bankfees
    if(balance < 0)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You do not have enough money in your bank account.")
        else
            console_print(id,"[ZP] You do not have enough money in your bank account.")
        return PLUGIN_HANDLED
    }
    tbalance += tamount
    if(bankfees > 0)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You paid ^x04%d^x01 ammo packs in bank fees.",bankfees)
        else
            console_print(id,"[ZP] You paid %d ammo packs in bank fees.",bankfees)
    }        
    set_balance(id,balance)
    set_balance(tgt,tbalance)
    if(client)
        print(id, "^x04[ZP]^x01 You have transferred ^x04%d^x01 ammo packs to ^x03%s^x01's bank account. You now have ^x04%d^x01 ammo packs in your account.",tamount,tname,balance)
    else
        console_print(id,"[ZP] You have transferred %d ammo packs to %s's bank account. You now have %d ammo packs in your account.",tamount,tname,balance)
    print(tgt, "^x04[ZP]^x03 %s^x01 has transferred ^x04%d^x01 ammo packs to your bank account. You now have ^x04%d^x01 ammo packs in your account.",name,tamount,tbalance)
    return PLUGIN_HANDLED
}


public zp_user_infected_post(infector,victim, id)
{
    if( is_user_connected(id) && is_user_connected(victim) )
    {
        if( dynamic_deagle[victim] )
        {
            SAPMessage(id, "lost the Dynamic Deagle");
            dynamic_deagle[victim] = 0;
            deagle_count--;
        }
        if( gauntlet[victim] )
        {
            SAPMessage(id, "lost Emp`s Gauntlets");
            gauntlet[victim] = 0;
            gauntlet_count--;
        }
                if( dday[victim] )
                {
            SAPMessage(id, "lost Doomsday's Shotgun");
            dday[victim] = 0;
            dday_count--;
        }
                if( ww[victim] )
                {
            SAPMessage(id, "lost Wild West gun");
            ww[victim] = 0;
            ww_count--;
        }
                if( day[id] )
                {
            SAPMessage(id, "lost Doomsday's USP");
            day[victim] = 0;
            day_count--;
        }      

    }
        if( eafi[infector] )
        {
        zp_set_user_ammo_packs(infector, zp_get_user_ammo_packs(infector) + 5);
        }

    zombs = ZombieCount();

    if(!get_pcvar_num(bank_state) || !id)
        return PLUGIN_CONTINUE
    new curmoney = zp_get_user_ammo_packs(id)
    if(curmoney < MAX_MONEY)
        return PLUGIN_CONTINUE
    if(canuse[id] == false)
        return PLUGIN_CONTINUE
    new cvarrounds = get_pcvar_num(bank_offrounds)
    if(rounds <= cvarrounds)
        return PLUGIN_CONTINUE
    new balance = play_bank[id][BANK_BALANCE]
    if(balance == -1 || balance >= Limit[play_bank[id][BANK_LIMIT]])
        return PLUGIN_CONTINUE
    if(get_playersnum() >= get_pcvar_num(bank_min_players))
    {
        new deposit = curmoney;
        if( curmoney > AUTO_DEP )
            deposit = AUTO_DEP;

        balance += deposit
        set_balance(id,balance)
        zp_set_user_ammo_packs(id,curmoney-deposit)

        print(id, "^x04[ZP]^x01 ammo packs have been automatically deposited in your bank account. You now have ^x04%d^x01 ammo packs in your account.",deposit,balance)
    }
    return PLUGIN_CONTINUE
}

public bank_spam()
{
    new cvarval = get_pcvar_num(bank_state)
    if(cvarval)
    {
        new message[256]
        get_pcvar_string(bank_msg,message,255)
        print(0, message)
                print(0, "^x04[ZP]^x01 Type /help in chat to see SAP help.")
    }
    set_task(get_pcvar_float(bank_msg_interval),"bank_spam")
}

public bank_help(id)
{
    show_motd(id,gHELPPAGE,"AMX Bank Help")
}

public say_cheese(id)
{
    new said[191]
    read_args(said,190)
    remove_quotes(said)
    if(sayspecial[id])
    {
        switch(sayspecial[id])
        {
            case 1: client_cmd(id,"bank_deposit %s 1",said)
            case 2: client_cmd(id,"bank_withdraw %s 1",said)
            case 3: client_cmd(id,"bank_transfer %s 1",said)
        }
        sayspecial[id] = 0
        return PLUGIN_HANDLED
    }                
    if(equali(said,"/bank"))
    {
        client_cmd(id,"bank_menu 1")
        return PLUGIN_HANDLED
    }
    if(equali(said,"/sap"))
    {
        client_cmd(id,"sap_menu")
        return PLUGIN_HANDLED
    }
    if(said[0] == 'm')
    {
        if(equali(said,"maxwit"))
        {
            withdrawl_maximum(id)
            return PLUGIN_HANDLED
        }
        if(equali(said,"maxdep"))
        {
            deposit_maximum(id)
            return PLUGIN_HANDLED
        }
    }
    else if(said[0] == 'b')
    {
        if(containi(said,"bank_") != -1)
        {
            if(equali(said,"bank_amount"))
            {
                client_cmd(id,"bank_amount 1")
                return PLUGIN_HANDLED
            }
            if(containi(said,"bank_withdraw") != -1)
            {
                replace(said,190,"bank_withdraw","")
                client_cmd(id,"bank_withdraw %s 1",said)
                return PLUGIN_HANDLED
            }
            if(containi(said,"bank_deposit") != -1)
            {
                replace(said,190,"bank_deposit","")
                client_cmd(id,"bank_deposit %s 1",said)
                return PLUGIN_HANDLED
            }
            if(containi(said,"bank_transfer") != -1)
            {
                replace(said,190,"bank_transfer","")
                new target[51],amountstr[51]
                parse(said,target,50,amountstr,50)
                client_cmd(id,"bank_transfer %s %s 1",target,amountstr)
                return PLUGIN_HANDLED
            }
            if(containi(said,"bank_givemoney") != -1)
            {
                replace(said,190,"bank_givemoney","")
                new target[51],amountstr[51]
                parse(said,target,50,amountstr,50)
                client_cmd(id,"bank_givemoney %s %s 1",target,amountstr)
                return PLUGIN_HANDLED
            }
            if(equali(said,"bank_create"))
            {
                client_cmd(id,"bank_create 1")
                return PLUGIN_HANDLED
            }            
            if(equali(said,"bank_help"))
            {
                bank_help(id)
                return PLUGIN_HANDLED
            }
            if(equali(said,"bank_open"))
            {
                client_cmd(id,"bank_open 1")
                return PLUGIN_HANDLED
            }
            if(equali(said,"bank_close"))
            {
                client_cmd(id,"bank_close 1")
                return PLUGIN_HANDLED
            }
            if(equali(said,"bank_upgrade"))
            {
                client_cmd(id,"bank_upgrade 1")
                return PLUGIN_HANDLED
            }
            if(equali(said,"bank_menu") || equali(said,"bank"))
            {
                client_cmd(id,"bank_menu 1")
                return PLUGIN_HANDLED
            }
        }
    }
    return PLUGIN_CONTINUE
}

public giveinterest()
{
    rounds++
    if(!check_use(0,1)) return PLUGIN_CONTINUE
    bankfees = get_pcvar_num(bank_fees_base)
    if(!get_pcvar_num(bank_state))
        return PLUGIN_CONTINUE
    new balance, limit, givint, ammopacks, team;
    for(new i = 1;i<=32;i++)
    {
        if(is_user_connected(i))
        {
            team = _:cs_get_user_team(i);
            if( !team || team > 2 )
                continue;

            balance = play_bank[i][BANK_BALANCE]
            if(canuse[i] && balance > 0)
            {
                play_bank[i][BANK_ROUNDS]++
                if( play_bank[i][BANK_ROUNDS] >= IntTime[play_bank[i][BANK_INTTIME]] )
                {
                    play_bank[i][BANK_ROUNDS] = 0

                    limit = Limit[play_bank[i][BANK_LIMIT]]
                    givint = floatround( Interest[play_bank[i][BANK_INTEREST]] * float( clamp(balance,0,limit) ) )
                    if(givint > 0)
                    {
                        ammopacks = zp_get_user_ammo_packs(i);
                        //if bank is full, just give to them on hand
                        if( balance >= limit )
                        {
                            zp_set_user_ammo_packs(i,ammopacks+givint);
                            print(i, "^x04[ZP]^x01 You were given ^x04%d^x01 ammo packs in interest.",givint)
                        }
                        else
                        {
                            new allowed = MAX_MONEY - ammopacks
                            //if give amount is less than on hand max
                            if( givint <= allowed )
                            {
                                zp_set_user_ammo_packs(i,ammopacks+givint)
                                print(i, "^x04[ZP]^x01 You were given ^x04%d^x01 ammo packs in interest.",givint)
                            }
                            //if give amount maxs on hand
                            else
                            {
                                new dep = givint - allowed
                                //if give maxs hand and bank
                                if( balance + dep >= limit )
                                {
                                    print(i, "^x04[ZP]^x01 You were given ^x04%d^x01 ammo packs in interest ^x04%d^x01 ammo packs of which went into your account.",givint,dep)
                                    print(i, "^x04[ZP]^x01 Your bank is at its limit of ^x04%d^x01 ammo packs.",limit)
                                    dep = limit - balance;
                                    zp_set_user_ammo_packs(i,ammopacks + givint - dep)
                                    balance = limit;
                                }
                                else
                                {
                                    print(i, "^x04[ZP]^x01 You were given ^x04%d^x01 ammo packs in interest ^x04%d^x01 ammo packs of which went into your account.",givint,dep)
                                    zp_set_user_ammo_packs(i,MAX_MONEY)
                                    balance += dep
                                }
                                set_balance(i,balance)
                            }
                        }
                    }
                }
                player_set_num(i, "ZMbank", BANK_SAVES[BANK_ROUNDS], play_bank[i][BANK_ROUNDS] );
            }
        }
    }
    return PLUGIN_CONTINUE
}

public client_authorized(id)
{
    loaded[id] = 0
    withdrawals[id] = 0
    canuse[id] = false

    for( new BANK_DATA:i; i<BANK_DATA; i++ )
        play_bank[id][i] = 0;
    play_bank[id][BANK_BALANCE] = -1;

    switch(get_pcvar_num(bank_restrict))
    {
        case 0:
        {
            canuse[id] = true
        }
        case 1:
        {
            if(access(id,ADMIN_CHAT))
                canuse[id] = true
            else
                canuse[id] = false
        }
        case 2:
        {
            canuse[id] = false
            new sid[35]
            if(get_pcvar_num(bank_use_ip))
                get_user_ip(id,sid,34,1)
            else
                get_user_authid(id,sid,34)
            #if SQLON    
                result = dbi_query(dbc,"SELECT * FROM bankusers WHERE sid = '%s'",sid)
                if(result == RESULT_NONE)
                    canuse[id] = false
                else
                    canuse[id] = true
                dbi_free_result(result)
            #else
                new retstr[35],a,i
                while(read_file(allowfilepath,i,retstr,34,a))
                {
                    if(equali(sid,retstr))
                        canuse[id] = true
                    i++
                }
            #endif
        }
    }
}
load(id)
{
    if( loaded[id] )
        return;
    if( !player_get_data( id, "ZMbank", BANK_SAVES[BANK_BALANCE]) )
    {
        play_bank[id][BANK_BALANCE] = -1;
    }
    else
    {
        for( new BANK_DATA:i=BANK_BALANCE; i<BANK_DATA; i++ )
        {
            play_bank[id][i] = clamp( player_get_num( id, "ZMbank", BANK_SAVES[i] ), BANK_MIN[i], BANK_MAX[i] );
        }
        new name[32];
        get_user_name(id, name, 31);
        player_add_num( id, "Names", name, 1 );
    }
    loaded[id] = 1
}    

public client_disconnect(id)
{
    deposit_maximum(id);
    canuse[id] = false

    if( dynamic_deagle[id] )
    {
        dynamic_deagle[id] = 0;
        deagle_count--;
    }
    if( gauntlet[id] )
    {
        gauntlet[id] = 0;
        gauntlet_count--;
    }
        if( dday[id] )
    {
        dday[id] = 0;
        dday_count--;
    }
        if( ww[id] )
    {
        ww[id] = 0;
        ww_count--;
    }
        if( day[id] )
    {
        day[id] = 0;
        day_count--;
    }
        if(eafi[id] )
        {
                eafi[id] = 0
        }

    for( new BANK_DATA:i; i<BANK_DATA; i++ )
        play_bank[id][i] = 0;
    play_bank[id][BANK_BALANCE] = -1;

    loaded[id] = 0
}

public deposit_maximum(id)    
{
    if(!check_use(id,1)) return PLUGIN_HANDLED    
    new curmoney = zp_get_user_ammo_packs(id)
    load(id);
    new balance = play_bank[id][BANK_BALANCE]
    if(balance == -1)
    {
        print(id, "^x04[ZP]^x01 You do not have a bank account.")
        return PLUGIN_HANDLED    
    }
    new change;
    new limit = Limit[play_bank[id][BANK_LIMIT]];
    if( balance >= limit )
    {
        print(id, "^x04[ZP]^x01 The max amount to have in bank is ^x04%d^x01.",limit)
    }
    else
    {
        if( balance + curmoney <= limit )
        {
            change = curmoney
            balance += curmoney
            zp_set_user_ammo_packs(id,0)
        }
        else
        {
            change = limit - balance
            balance = limit
            zp_set_user_ammo_packs(id,curmoney-change)
        }
    }
    set_balance(id,balance)
    print(id, "^x04[ZP]^x01 You have deposited ^x04%d^x01 ammo packs in your bank account. You now have ^x04%d^x01 ammo packs in your account.",change,balance)
    return PLUGIN_HANDLED
}
public withdrawl_maximum(id)
{
    if(!check_use(id,1)) return PLUGIN_HANDLED
    load(id);
    new balance = play_bank[id][BANK_BALANCE]
    if(balance == -1)
    {
        print(id, "^x04[ZP]^x01 You do not have a bank account.")
        return PLUGIN_HANDLED
    }
    new curmoney = zp_get_user_ammo_packs(id)
    new maxmoney = MAX_MONEY - zp_get_user_ammo_packs(id)

    if(maxmoney > balance)
        maxmoney = balance

    if( maxmoney <= 0 && balance >= Limit[play_bank[id][BANK_LIMIT]] )
    {
        print(id, "^x04[ZP]^x01 You cannot withdraw any more money.")
        return PLUGIN_HANDLED
    }

/*
    if( withdrawals[id] >= MAX_MONEY ){
        print(id, "^x04[ZP]^x01 You have already withdrawn ^x04%d^x01 ammo packs from your bank, try again next map.", withdrawals[id] )
        return PLUGIN_HANDLED;
    }
*/

    balance -= maxmoney
    zp_set_user_ammo_packs(id,curmoney + maxmoney)
    withdrawals[id] += maxmoney

    if((balance - bankfees) > 0)
        balance -= bankfees
    else
        zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id) - bankfees)
    if(bankfees > 0)
        print(id, "^x04[ZP]^x01 You paid ^x04%d^x01 ammo packs in bank fees.",bankfees)
    bankfees += get_pcvar_num(bank_fees_increase)        
    set_balance(id,balance)
    print(id, "^x04[ZP]^x01 You have withdrawn ^x04%d^x01 ammo packs from your bank account. You now have ^x04%d^x01 ammo packs in your account.",maxmoney,balance)
    return PLUGIN_HANDLED
}
    
public bank_amount(id)
{
    new client = 0
    if(read_argc() > 1)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED
    load(id);
    new balance = play_bank[id][BANK_BALANCE]
    if(balance == -1)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You do not have a bank account.")
        else
            console_print(id,"[ZP] You do not have a bank account.")
        return PLUGIN_HANDLED        
    }
    else
    {
        if(client)
            print(id, "^x04[ZP]^x01 You have ^x04%d^x01 ammo packs in your bank account.",balance)
        else
            console_print(id,"[ZP] You have ^x04%d^x01 ammo packs in your bank account.",balance)
    }
    return PLUGIN_HANDLED
}

public bank_open(id,level,cid)
{
    if(!cmd_access(id,level,cid,1))
        return PLUGIN_HANDLED
    new client = 0
    if(read_argc() > 1)
        client = 1
    if(get_pcvar_num(bank_state))
    {
        if(client)
            print(id, "^x04[ZP]^x01 The AMX bank is already open.")
        else
            console_print(id,"[ZP] The AMX bank is already open.")
    }
    else
    {
        console_cmd(id,"amx_cvar bank_state 1")
        if(get_pcvar_num(bank_state))
        {
            if(client)
                print(id, "^x04[ZP]^x01 The bank is now open.")
            else
                console_print(id,"[ZP] The bank is now open.")
            print(0, "^x04[ZP]^x01 The bank is now open for business.")
        }        
        else
        {
            if(client)
                print(id, "^x04[ZP]^x01 You may not open the bank.")
            else
                console_print(id,"[ZP] You may not open the bank.")
        }    
    }
    return PLUGIN_HANDLED
}

public bank_close(id,level,cid)
{    
    if(!cmd_access(id,level,cid,1))
        return PLUGIN_HANDLED
    new client = 0
    if(read_argc() > 1)
        client = 1
    if(!get_pcvar_num(bank_state))
    {
        if(client)
            print(id, "^x04[ZP]^x01 The AMX bank is already closed.")
        else
            console_print(id,"[ZP] The AMX bank is already closed.")
    }
    else
    {
        console_cmd(id,"amx_cvar bank_state 0")
        if(!get_pcvar_num(bank_state))
        {
            if(client)
                print(id, "^x04[ZP]^x01 The bank is now closed.")
            else
                console_print(id,"[ZP] The bank is now closed.")
            print(0, "^x04[ZP]^x01 The bank is now closed.")
        }        
        else
        {
            if(client)
                print(id, "^x04[ZP]^x01 You may not close the bank.")
            else
                console_print(id,"[ZP] You may not close the bank.")
        }    
    }
    return PLUGIN_HANDLED
}

public sqlinit()
{
    #if SQLON
        new error[32],sqlhostname[35],sqluser[35],sqlpass[35],sqldbname[35]
        get_cvar_string("amx_sql_host",sqlhostname,34)
        get_cvar_string("amx_sql_user",sqluser,34)
        get_cvar_string("amx_sql_pass",sqlpass,34)
        get_cvar_string("amx_sql_db",sqldbname,34)
        dbc = dbi_connect(sqlhostname,sqluser,sqlpass,sqldbname,error,31)
        if(dbc == SQL_FAILED)
        {
            server_print("Could not connect.")
            return PLUGIN_HANDLED
        }
        result = dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `bank` (`sid` VARCHAR(35), `amount` BIGINT(20))")
        dbi_free_result(result)
        result = dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `bankusers` (`sid` VARCHAR(35), `comments` VARCHAR(100))")
        dbi_free_result(result)
    #endif
    return 1
}

public bank_create(id)
{
    new client = 0
    if(read_argc() > 1)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED
    load(id);
    new curmoney,neededmoney, amount
    neededmoney = get_pcvar_num(bank_default_opening)
    curmoney = zp_get_user_ammo_packs(id)
    if(curmoney >= neededmoney)
    {
        amount = neededmoney
        curmoney -= neededmoney
    }
    else
    {
        amount = curmoney
        curmoney = 0
    }
    #if SQLON
        new sid[35]
        if(get_pcvar_num(bank_use_ip))
            get_user_ip(id,sid,34,1)
        else
            get_user_authid(id,sid,34)
        result = dbi_query(dbc,"SELECT * FROM bank WHERE sid = '%s'",sid)
        if(result != RESULT_NONE)
        {
            if(client)
                print(id, "^x04[ZP]^x01 You already have a bank account!")
            else
                console_print(id,"[ZP] You already have a bank account!")
            return PLUGIN_HANDLED
        }
        dbi_free_result(result)
        result = dbi_query(dbc,"INSERT INTO bank VALUES ( '%s' , '%d')",sid,amount)
        dbi_free_result(result)
    #else
        new saveamstr[21]
        if( play_bank[id][BANK_BALANCE] > -1 )
        {
            if(client)
                print(id, "^x04[ZP]^x01 You already have a bank account!")
            else
                console_print(id,"[ZP] You already have a bank account!")
            return PLUGIN_HANDLED
        }
        num_to_str(amount,saveamstr,20)
        player_set_data( id, "ZMbank", BANK_SAVES[BANK_BALANCE], saveamstr);
    #endif            
    zp_set_user_ammo_packs(id,curmoney)
    if(client)
        print(id, "^x04[ZP]^x01 Bank account created successfully. Your account has ^x04%d^x01 ammo packs in it.",amount)
    else
        console_print(id,"[ZP] Bank account created successfully. Your account has %d ammo packs in it.",amount)

    bank_menu(id);
    return PLUGIN_HANDLED
}

public bank_withdrawl(id)
{
    new client = 0
    if(read_argc() > 2)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED
    load(id);
    new balance = play_bank[id][BANK_BALANCE]
    if(balance == -1)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You do not have a bank account.")
        else
            console_print(id,"[ZP] You do not have a bank account.")
        return PLUGIN_HANDLED
    }
    new ams[9],amn,maxam    
    read_args(ams,8)
    amn = str_to_num(ams)
    if(amn <= 0) return PLUGIN_HANDLED

/*
    if( withdrawals[id] >= MAX_MONEY ){
        print(id, "^x04[ZP]^x01 You have already withdrawn ^x04%d^x01 ammo packs from your bank, try again next map.", withdrawals[id] )
        return PLUGIN_HANDLED;
    }
*/

    maxam = MAX_MONEY - zp_get_user_ammo_packs(id)
    if(amn > maxam)
        amn = maxam

    if( amn <= 0 )
    {
        print(id, "^x04[ZP]^x01 You cannot withdraw any more ammo packs from your bank." )
        return PLUGIN_HANDLED;
    }

    if(amn > balance)
    {
        if(client)
            print(id, "^x04[ZP]^x01 There is not enough ammo packs in your bank account.")
        else
            console_print(id,"[ZP] There is not enough ammo packs in your bank account.")
        return PLUGIN_HANDLED
    }
    balance -= amn
    zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id) + amn)
    if(balance >= bankfees)
        balance -= bankfees
    else
        zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id) - bankfees)    
    set_balance(id,balance)
    if(bankfees > 0)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You paid ^x04%d^x01 ammo packs in bank fees.",bankfees)
        else
            console_print(id,"[ZP] You paid %d ammo packs in bank fees.",bankfees)
    }
    withdrawals[id] += amn;
    bankfees += get_pcvar_num(bank_fees_increase)
    if(client)
        print(id, "^x04[ZP]^x01 You have withdrawn ^x04%d^x01 ammo packs from your bank account. You now have ^x04%d^x01 ammo packs in your account.",amn,balance)
    else
        console_print(id,"[ZP] You have withdrawn %d ammo packs from your bank account. You now have %d ammo packs in your account.",amn,balance)
    return PLUGIN_HANDLED
}

public bank_deposit(id)
{
    new client = 0
    if(read_argc() > 2)
        client = 1
    if(!check_use(id,client)) return PLUGIN_HANDLED
    load(id);
    new damounts[9],damount,curmoney
    read_args(damounts,8)
    damount = str_to_num(damounts)
    if(damount <= 0) return PLUGIN_HANDLED
    curmoney = zp_get_user_ammo_packs(id)
    if(damount > curmoney)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You don't have that much ammo packs.")
        else
            console_print(id,"[ZP] You don't have that much ammo packs.")
        return PLUGIN_HANDLED
    }
    new balance = play_bank[id][BANK_BALANCE]
    if(balance == -1)
    {
        if(client)
            print(id, "^x04[ZP]^x01 You do not have a bank account.")
        else
            console_print(id,"[ZP] You do not have a bank account.")
        return PLUGIN_HANDLED
    }
    balance += damount
    if( balance > Limit[play_bank[id][BANK_LIMIT]] )
    {
        if(client)
                print(id, "^x04[ZP]^x01 The max amount to have in bank is ^x04%d^x01.",Limit[play_bank[id][BANK_LIMIT]])
        else
            console_print(id,"[ZP] The max amount to have in bank is %d.",Limit[play_bank[id][BANK_LIMIT]])
        return PLUGIN_HANDLED
    }
    set_balance(id,balance)
    zp_set_user_ammo_packs(id,curmoney - damount)
    if(client)
        print(id, "^x04[ZP]^x01 You have deposited ^x04%d^x01 ammo packs in your bank account. You now have ^x04%d^x01 ammo packs in your account.",damount,balance)
    else
        console_print(id,"[ZP] You have deposited %d ammo packs in your bank account. You now have %d ammo packs in your account.",damount,balance)
    return PLUGIN_HANDLED
}


public fw_PlayerPreThink(id)
{
    
    if (sap[id] > MAX_SAPS)
    {

        sap[id] = MAX_SAPS
        print(id, "^x04[ZP]^x01 You can't have more than ^x04%d^x01 SAPs", MAX_SAPS);
        print(id, "^x04[ZP]^x01 Your SAPs have been automatically reset to ^x04%d^x01 SAPs", MAX_SAPS);      

    }
    
        return FMRES_IGNORED

}

public fwHamPlayerSpawnPost(id)
{
    
        if ( sap[id] > 180 )
        {        
                new iEnt = engfunc(EngFunc_CreateNamedEntity, g_CachedStringInfoTarget)    
        set_pev(iEnt, pev_movetype, MOVETYPE_FOLLOW)
        set_pev(iEnt, pev_aiment, id)
        engfunc(EngFunc_SetModel, iEnt, RICHER)
    }
    
    
}


// Frost Grenade: Freeze Blast
create_blast3(const Float:originF[3])
{
    // Smallest ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+305.0*FROST_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(4) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(0) // red
    write_byte(100) // green
    write_byte(200) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()

    // Small ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+385.0*FROST_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(4) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(0) // red
    write_byte(100) // green
    write_byte(200) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()
    
    // Medium ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+470.0*FROST_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(4) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(0) // red
    write_byte(100) // green
    write_byte(200) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()
    
    // Largest ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+555.0*FROST_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(10) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(0) // red
    write_byte(100) // green
    write_byte(200) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()
}

create_blast4(const Float:originF[3])
{
    // Smallest ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+305.0*FLAME_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(4) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(255) // red
    write_byte(0) // green
    write_byte(0) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()

    // Small ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+385.0*FLAME_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(4) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(255) // red
    write_byte(0) // green
    write_byte(0) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()
    
    // Medium ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+470.0*FLAME_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(4) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(255) // red
    write_byte(0) // green
    write_byte(0) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()
    
    // Largest ring
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
    write_byte(TE_BEAMCYLINDER) // TE id
    engfunc(EngFunc_WriteCoord, originF[0]) // x
    engfunc(EngFunc_WriteCoord, originF[1]) // y
    engfunc(EngFunc_WriteCoord, originF[2]) // z
    engfunc(EngFunc_WriteCoord, originF[0]) // x axis
    engfunc(EngFunc_WriteCoord, originF[1]) // y axis
    engfunc(EngFunc_WriteCoord, originF[2]+555.0*FLAME_RINGMULT) // z axis
    write_short(g_exploSpr) // sprite
    write_byte(0) // startframe
    write_byte(0) // framerate
    write_byte(10) // life
    write_byte(60) // width
    write_byte(0) // noise
    write_byte(255) // red
    write_byte(0) // green
    write_byte(0) // blue
    write_byte(200) // brightness
    write_byte(0) // speed
    message_end()
}

public reset_render(id)
{
    id -= TASK_STEALTH;
    if( is_user_alive(id) )
    {
        set_user_rendering(id);
        print(id, "^x04[ZP]^x01 Stealth Mode has faded.");
        client_print(id, print_center, "Stealth Mode has faded.");
    }
}
public blackout(parm[3])
{
    new id = parm[0];
    new team = parm[2];

    parm[1]--;
    if( parm[1] > 0 )
    {
        SAPMessage(id, "killed the power!^nThere is a Black Out!", 1.0);

        for( new i; i<33; i++ )
        {
            if( is_user_alive(i) && _:cs_get_user_team(i) != team )
            {
                // Add a black tint to their screen
                message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, i)
                write_short(0) // duration
                write_short(0) // hold time
                write_short(FFADE_STAYOUT) // fade type
                write_byte(0) // red
                write_byte(0) // green
                write_byte(0) // blue
                write_byte(245) // alpha
                message_end()
            }
        }

        set_task(1.0, "blackout", 0, parm, 3);
    }
    else
    {
        SAPMessage(id, "restored the power!^nBlack Out has passed!");

        for( new i; i<33; i++ )
        {
            if( is_user_alive(i) )
            {
                // Gradually remove screen's black tint
                message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, i)
                write_short(UNIT_SECOND) // duration
                write_short(0) // hold time
                write_short(FFADE_IN) // fade type
                write_byte(0) // red
                write_byte(0) // green
                write_byte(0) // blue
                write_byte(0) // alpha
                message_end()
            }
        }
    }
}
public geo_reposition(parm[2])
{
    new id = parm[0];

    new message[128], name[32];
    get_user_name(id, name, 31);

    parm[1]--;
    if( parm[1] > 0 )
    {
        formatex(message, 127, "activated the Geographic Repostioner^nRepostioning %s in %d seconds", name, parm[1]);
        SAPMessage(id, message, 1.0);
        for( new i=1; i<33; i++ )
        {
            if( is_user_alive(i) )
                emit_sound(i, CHAN_ITEM, gSoundActivate, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
        }
        set_task(1.0, "geo_reposition", 0, parm, 2);
    }
    else
    {
        formatex(message, 127, "activated the Geographic Repostioner^n%s has been Repostioned", name);
        SAPMessage(id, message);

        new Float:position[3];
        new players[32], pnum, i, tid;
        new team = _:cs_get_user_team(id);
        for( i=1; i<33; i++ )
        {
            if( is_user_alive(i) && id!=i && _:cs_get_user_team(i)!=team )
            {
                players[pnum] = i;
                pnum++;
            }
        }
        tid = players[ random(pnum) ];
        pev( tid, pev_origin, position );
        set_pev( id, pev_origin, position );
    }
}
public leech_armor(parm[2])
{
    new id = parm[0];

    parm[1]--;
    if( parm[1] > 0 && is_user_alive(id) && zp_get_user_zombie(id) )
    {
        SAPMessage(id, "is Leeching Human Armor", 1.0);
        new armor, total, armor_take;
        for( new i=1; i<33; i++ )
        {
            if( is_user_alive(i) && fm_entity_range(id, i) < LEECH_DISTANCE && !zp_get_user_zombie(i) )
            {
                armor = get_user_armor(i);
                armor_take = min(armor, LEECH_ARMOR_MAX);
                total += armor_take;
                set_user_armor(i, armor-armor_take);
                set_user_health(id, get_user_health(id)+armor_take*LEECH_MULT);
            }
        }

        new origin[3];
        get_user_origin(id, origin);
        if( total ){
            message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
            write_byte(TE_IMPLOSION)
            write_coord(origin[0])
            write_coord(origin[1])
            write_coord(origin[2])
            write_byte(100)
            write_byte(total)
            write_byte(10)
            message_end()
        }

        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_BEAMDISK)
        write_coord(origin[0])
        write_coord(origin[1])
        write_coord(origin[2])
        write_coord(origin[0])
        write_coord(origin[1])
        write_coord(origin[2] + 100)
        write_short(g_exploSpr)
        write_byte(0)
        write_byte(0)
        write_byte(10)
        write_byte(10)
        write_byte(0)
        write_byte(10)
        write_byte(250)
        write_byte(10)
        write_byte(200)
        write_byte(0)
        message_end()

        set_task(1.0, "leech_armor", 0, parm, 2);
    }
}
public blackhole(parm[2])
{
    new id = parm[0];

    parm[1]--;
    if( parm[1] > 0 && is_user_alive(id) && zp_get_user_zombie(id) )
    {
        //so we only show this every second, instead of every 0.1 seconds
        if( (parm[1]+1) % 10 == 0 )
            SAPMessage(id, "is Sucking Humans Into His Black Hole", 1.0);

        new Float:forigin[3];
        pev(id, pev_origin, forigin);
        for( new i=1; i<33; i++ )
        {
            if( is_user_alive(i) && fm_entity_range(id, i) < HOLE_DISTANCE && !zp_get_user_zombie(i) )
            {
                entity_goto_origin(i, forigin, HOLE_SPEED);
            }
        }

        new origin[3];
        get_user_origin(id, origin);
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_IMPLOSION)
        write_coord(origin[0])
        write_coord(origin[1])
        write_coord(origin[2])
        write_byte(50)
        write_byte(5)
        write_byte(1)
        message_end()

        set_task(0.1, "blackhole", 0, parm, 2);
    }
}
stock entity_goto_origin(entity, Float:fl_Origin[3], speed)
{
    if ( !pev_valid(entity) ) return 0

    new Float:fl_EntOrigin[3]
    pev(entity, pev_origin, fl_EntOrigin)

    new Float:fl_InvTime = (float(speed) / vector_distance(fl_Origin, fl_EntOrigin))

    new Float:fl_Distance[3]
    fl_Distance[0] = fl_Origin[0] - fl_EntOrigin[0]
    fl_Distance[1] = fl_Origin[1] - fl_EntOrigin[1]
    fl_Distance[2] = fl_Origin[2] - fl_EntOrigin[2]

    new Float:fl_Velocity[3]
    fl_Velocity[0] = fl_Distance[0] * fl_InvTime
    fl_Velocity[1] = fl_Distance[1] * fl_InvTime
    fl_Velocity[2] = fl_Distance[2] * fl_InvTime

    set_pev(entity, pev_velocity, fl_Velocity)

    return 1
}
public HamPreDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
    if( is_user_alive(this) && is_user_alive(idattacker) )
    {
        if( gauntlet[idattacker] )
        {
            damage += GAUNTLET_INCREASE;
            if( get_user_weapon(idattacker) == CSW_KNIFE && !cs_get_user_stationary(idattacker) )
            {
                damage *= GAUNTLET_KNIFE;

                new origin[3];
                get_user_origin(this, origin);

                message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
                write_byte(TE_BEAMCYLINDER)
                write_coord(origin[0])
                write_coord(origin[1])
                write_coord(origin[2])
                write_coord(origin[0])
                write_coord(origin[1])
                write_coord(origin[2] + floatround(damage) )
                write_short(lightning)
                write_byte(0)
                write_byte(10)
                write_byte(10) //life
                write_byte(50) //width
                write_byte(20)//noise
                write_byte(150)
                write_byte(150)
                write_byte(200)
                write_byte(255)
                write_byte(10)
                message_end()
            }
            else
            {
//                damage *= random_float(GAUNTLET_MIN,GAUNTLET_MAX);
                damage *= (GAUNTLET_MIN + ( ( zombs * (GAUNTLET_MAX-GAUNTLET_MIN) ) / 32 ) );

                message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
                write_byte(TE_BEAMENTS)
                write_short(idattacker)
                write_short(this)
                write_short(lightning)
                write_byte(0)
                write_byte(10)
                write_byte(10) //life
                write_byte(50) //width
                write_byte(20) //noise
                write_byte(150)
                write_byte(150)
                write_byte(200)
                write_byte(255)
                write_byte(10)
                message_end()
            }
            SetHamParamFloat(4, damage );
        }
        if( dynamic_deagle[idattacker] && get_user_weapon(idattacker) == CSW_DEAGLE && !zp_get_user_nemesis(this) && !cs_get_user_stationary(idattacker) )
        {
            switch( random(8) )
            {
                case 1:{
                    zp_set_user_frozen(this, 1, DEAGLE_FROST);
                    client_print(idattacker, print_center, "Dynamic Deagle: Frost Shot");
                    client_print(this, print_center, "Dynamic Deagle: Frost Shot");
                }
                case 2:{
                    zp_set_user_burn(this, DEAGLE_FIRE);
                    client_print(idattacker, print_center, "Dynamic Deagle: Fire Shot");
                    client_print(this, print_center, "Dynamic Deagle: Fire Shot");
                }
                case 3:{
                    client_print(idattacker, print_center, "Dynamic Deagle: Black Shot");
                    client_print(this, print_center, "Dynamic Deagle: Black Shot");
                    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, this)
                    write_short(UNIT_SECOND) // duration
                    write_short(0) // hold time
                    write_short(FFADE_IN) // fade type
                    write_byte(0) // red
                    write_byte(0) // green
                    write_byte(0) // blue
                    write_byte(255) // alpha
                    message_end()
                }
                case 4:{
                    client_print(idattacker, print_center, "Dynamic Deagle: White Shot");
                    client_print(this, print_center, "Dynamic Deagle: White Shot");
                    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, this)
                    write_short(UNIT_SECOND) // duration
                    write_short(0) // hold time
                    write_short(FFADE_IN) // fade type
                    write_byte(255) // red
                    write_byte(255) // green
                    write_byte(255) // blue
                    write_byte(255) // alpha
                    message_end()
                }
                case 5:{
                    client_print(idattacker, print_center, "Dynamic Deagle: Power Shot");
                    client_print(this, print_center, "Dynamic Deagle: Power Shot");
                    SetHamParamFloat(4, damage+DEAGLE_POWER);
                }
                case 6:{
                    client_print(idattacker, print_center, "Dynamic Deagle: Shock Shot");
                    client_print(this, print_center, "Dynamic Deagle: Shock Shot");

                    new Float:start_origin[3], Float:end_origin[3];
                    pev(idattacker, pev_origin, start_origin);
                    pev(this, pev_origin, end_origin);
                    start_origin[0] = end_origin[0] - start_origin[0];
                    start_origin[1] = end_origin[1] - start_origin[1];
                    start_origin[2] = 0.0;
                    xs_vec_normalize( start_origin, end_origin );
                    end_origin[0] *= DEAGLE_SHOCK;
                    end_origin[1] *= DEAGLE_SHOCK;
                    end_origin[2] = 50.0;
                    set_pev(this, pev_velocity, end_origin);

                    SetHamParamFloat(4, 0.0);
                }
                case 7:{
                    client_print(idattacker, print_center, "Dynamic Deagle: Zombie Health Shot");
                    client_print(this, print_center, "Dynamic Deagle: Zombie Health Shot");
                    set_user_health(this, get_user_health(this)+DEAGLE_HEALTH);
                }
                default:{
                    new ap_give = random_num(DEAGLE_AP_MIN,DEAGLE_AP_MAX);
                    client_print(idattacker, print_center, "Dynamic Deagle: +%d AP Shot",ap_give);
                    zp_set_user_ammo_packs(idattacker, zp_get_user_ammo_packs(idattacker)+ap_give);
                }
            }
        }
                if( dday[idattacker] && get_user_weapon(idattacker) == CSW_M3 && !zp_get_user_nemesis(this) && !cs_get_user_stationary(idattacker) )
        {
            switch( random(7) )
            {
                case 1:{
                    zp_set_user_frozen(this, 1, DDAY_FROST);
                    client_print(idattacker, print_center, "Doomsday's Shotgun: Frost Shot");
                    client_print(this, print_center, "Doomsday's Shotgun: Frost Shot");
                }
                case 2:{
                    zp_set_user_burn(this, DDAY_FIRE);
                    client_print(idattacker, print_center, "Doomsday's Shotgun: Fire Shot");
                    client_print(this, print_center, "Doomsday's Shotgun: Fire Shot");
                }
                case 3:{
                            new Float:fVec[3];
                                        fVec[0] = random_float(DDAY_LOW , DDAY_HIGH);
                                        fVec[1] = random_float(DDAY_LOW , DDAY_HIGH);
                                        fVec[2] = random_float(DDAY_LOW , DDAY_HIGH);
                                        pev( this , pev_punchangle , fVec );
                                        message_begin(MSG_ONE , get_user_msgid("ScreenShake") , {0,0,0} ,this);
                                        write_short( 1<<14 );
                                        write_short( 1<<14 );
                                        write_short( 1<<14 );
                                        message_end();

                                        set_user_health(this, get_user_health(this) - random_num(30,50));            
                                        client_print(idattacker, print_center, "Doomsday's Shotgun: Shake shot");
                                        client_print(this, print_center, "Doomsday's Shotgun: Shake Shot");
                }
                case 4:{
                    client_print(idattacker, print_center, "Doomsday's Shotgun: White Shot");
                    client_print(this, print_center, "Doomsday's Shotgun: White Shot");
                    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, this)
                    write_short(UNIT_SECOND) // duration
                    write_short(0) // hold time
                    write_short(FFADE_IN) // fade type
                    write_byte(255) // red
                    write_byte(255) // green
                    write_byte(255) // blue
                    write_byte(255) // alpha
                    message_end()
                }
                case 5:{
                    client_print(idattacker, print_center, "Doomsday's Shotgun: Power Shot");
                    client_print(this, print_center, "Doomsday's Shotgun: Power Shot");
                    SetHamParamFloat(4, damage+DDAY_POWER);
                }
                case 6:{
                    client_print(idattacker, print_center, "Doomsday's Shotgun: Shock Shot");
                    client_print(this, print_center, "Doomsday's Shotgun: Shock Shot");

                    new Float:start_origin[3], Float:end_origin[3];
                    pev(idattacker, pev_origin, start_origin);
                    pev(this, pev_origin, end_origin);
                    start_origin[0] = end_origin[0] - start_origin[0];
                    start_origin[1] = end_origin[1] - start_origin[1];
                    start_origin[2] = 0.0;
                    xs_vec_normalize( start_origin, end_origin );
                    end_origin[0] *= DDAY_SHOCK;
                    end_origin[1] *= DDAY_SHOCK;
                    end_origin[2] = 50.0;
                    set_pev(this, pev_velocity, end_origin);

                    SetHamParamFloat(4, 0.0);
                }
                default:{
                    new ap_give = random_num(DDAY_AP_MIN,DDAY_AP_MAX);
                    client_print(idattacker, print_center, "Doomsday's Shotgun: +%d AP Shot",ap_give);
                    zp_set_user_ammo_packs(idattacker, zp_get_user_ammo_packs(idattacker)+ap_give);
                }
            }
        }

                if( ww[idattacker] && get_user_weapon(idattacker) == CSW_FIVESEVEN && !zp_get_user_nemesis(this) && !cs_get_user_stationary(idattacker) )
        {
            switch( random(5) )
            {
                case 1:{
                    zp_set_user_burn(this, WW_FIRE);
                    client_print(idattacker, print_center, "Wild West gun: Fire Shot");
                    client_print(this, print_center, "Wild West gun: Fire Shot");
                }
                case 2:{
                            new Float:fVec[3];
                                        fVec[0] = random_float(WW_LOW , WW_HIGH);
                                        fVec[1] = random_float(WW_LOW , WW_HIGH);
                                        fVec[2] = random_float(WW_LOW , WW_HIGH);
                                        pev( this , pev_punchangle , fVec );
                                        message_begin(MSG_ONE , get_user_msgid("ScreenShake") , {0,0,0} ,this);
                                        write_short( 1<<14 );
                                        write_short( 1<<14 );
                                        write_short( 1<<14 );
                                        message_end();

                                        set_user_health(this, get_user_health(this) - random_num(30,50));            
                                        client_print(idattacker, print_center, "Wild West gun: Shake shot");
                                        client_print(this, print_center, "Wild West gun: Shake Shot");
                }
                
                case 3:{
                    client_print(idattacker, print_center, "Wild West gun: Power Shot");
                    client_print(this, print_center, "Wild West gun: Power Shot");
                    SetHamParamFloat(4, damage+WW_POWER);
                }
                case 4:{
                    client_print(idattacker, print_center, "Wild West gun: Shock Shot");
                    client_print(this, print_center, "Wild West gun: Shock Shot");

                    new Float:start_origin[3], Float:end_origin[3];
                    pev(idattacker, pev_origin, start_origin);
                    pev(this, pev_origin, end_origin);
                    start_origin[0] = end_origin[0] - start_origin[0];
                    start_origin[1] = end_origin[1] - start_origin[1];
                    start_origin[2] = 0.0;
                    xs_vec_normalize( start_origin, end_origin );
                    end_origin[0] *= WW_SHOCK;
                    end_origin[1] *= WW_SHOCK;
                    end_origin[2] = 50.0;
                    set_pev(this, pev_velocity, end_origin);

                    SetHamParamFloat(4, 0.0);
                }
                default:{
                    new ap_give = random_num(WW_AP_MIN,WW_AP_MAX);
                    client_print(idattacker, print_center, "Wild West gun: +%d AP Shot",ap_give);
                    zp_set_user_ammo_packs(idattacker, zp_get_user_ammo_packs(idattacker)+ap_give);
                }
            }
        }

                if( day[idattacker] && get_user_weapon(idattacker) == CSW_USP && !zp_get_user_nemesis(this) && !cs_get_user_stationary(idattacker) )
        {
            switch( random(4) )
            {
                case 1:{
                    zp_set_user_frozen(this, 1, DDAY2_FROST);
                    client_print(idattacker, print_center, "Doomsday's USP: Frost Shot");
                    client_print(this, print_center, "Doomsday's USP: Frost Shot");
                }
                case 2:{
                    zp_set_user_burn(this, DDAY2_FIRE);
                    client_print(idattacker, print_center, "Doomsday's USP: Fire Shot");
                    client_print(this, print_center, "Doomsday's USP: Fire Shot");
                }


                case 3:{
                    new ap_give = random_num(DDAY2_ARMOR_MIN,DDAY2_ARMOR_MAX);
                    client_print(idattacker, print_center, "Doomsday's USP: +%d Armor Shot",ap_give);
                    zp_set_user_ammo_packs(idattacker, zp_get_user_ammo_packs(idattacker)+ap_give);                }
                default:{
                    new ap_give = random_num(DDAY2_AP_MIN,DDAY2_AP_MAX);
                    client_print(idattacker, print_center, "Dynamic Deagle: +%d AP Shot",ap_give);
                    zp_set_user_ammo_packs(idattacker, zp_get_user_ammo_packs(idattacker)+ap_give);
                }
            }
        }
        }
}

public hide_status(id)
{
       set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4)
       show_hudmessage(id,"")
   }
public show_status(id)
{
       new name[32],pid = read_data(2)
       get_user_name(pid,name,31)
       if (!zp_get_user_zombie(pid) && !zp_get_user_zombie(id))
       {
           set_hudmessage(0,255,0,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
           show_hudmessage(id,"[%s] ^n-=Health: %d=- ^n-=Armor: %d=- ^n-=Ammo packs: %d=- ^n-=SAPs: %d=- ",name,
               get_user_health(pid),get_user_armor(pid),zp_get_user_ammo_packs(pid), sap[pid])    
       }
       if (zp_get_user_zombie(id) && zp_get_user_zombie(pid))
       {
           set_hudmessage(0,0,255,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
           show_hudmessage(id,"[%s] ^n-=Health: %d=- ^n-=Ammo packs: %d=- ^n-=SAPs: %d=- ",name,
               get_user_health(pid),zp_get_user_ammo_packs(pid), sap[pid] )       
       }
          
}

SAPHelp(id)
{
    new message[1024], len;

    len += formatex(message[len], (1024-len),    "<center>SAP Help</center><br>");

    len += formatex(message[len], (1024-len),    "<br>Black Out - %d SAP - Makes it very difficult to see for %d seconds", BLACK_SAP, BLACK_TIME);
    len += formatex(message[len], (1024-len),    "<br>Stealth Mode - %d SAP - You cannot be seen for %0.1f seconds", STEALTH_SAP, STEALTH_TIME);
    len += formatex(message[len], (1024-len),    "<br>Geographic Repositioner - %d SAP - Moves all players to random places", SWAP_SAP);
    len += formatex(message[len], (1024-len),    "<br>SubZero Frost - %d SAP - Freezes all enemies for a few seconds", FROST_SAP);
    len += formatex(message[len], (1024-len),    "<br>Lottery - %d SAP - Lottery, can be both good and bad", LOTTERY_SAP);
    len += formatex(message[len], (1024-len),    "<br>Extra ammo for infections - %d SAP - Gain + 5 ammo packs for each infecting", EAFI_SAP);
    len += formatex(message[len], (1024-len),    "<br>Armor Leech - %d SAP - Drain armor for health from nearby enemies for %d seconds", LEECH_SAP, LEECH_TIME);
    len += formatex(message[len], (1024-len),    "<br>Black Hole - %d SAP - Suck nearby enemies toward you for %d seconds", HOLE_SAP, HOLE_TIME);
    len += formatex(message[len], (1024-len),    "<br>Nemesis - %d SAP - Become a Nemesis", NEMESIS_SAP);
    len += formatex(message[len], (1024-len),    "<br>Dynamic Deagle - %d SAP - Deagle shots have random effects: Frost,Fire,White,Black,Power,Shock,AP", DEAGLE_SAP);
    len += formatex(message[len], (1024-len),    "<br>Emp`s Gauntlets - %d SAP - Increased Damage with More Zombies", GAUNTLET_SAP);
    len += formatex(message[len], (1024-len),    "<br>Doomsday's Shotgun - %d SAP - M3 shots have random effects:Frost,Fire,Shake,White,Power,Shock,AP", DDAY_SAP);
    len += formatex(message[len], (1024-len),    "<br>Doomsday's USP - %d SAP - USP shots have random effects:Frost,Fire,Armor,AP", DDAY2_SAP);
    len += formatex(message[len], (1024-len),    "<br>Wild West gun - %d SAP - fiveseven shots have random effects:Fire,Shake,Power,Shock,AP", WW_SAP);
    len += formatex(message[len], (1024-len),    "<br>Survivor - %d SAP - Become a Survivor", SURVIVOR_SAP);
    len += formatex(message[len], (1024-len),    "<br>Imperial Armor - %d SAP - Gain %d Armor", IMPERIAL_SAP, IMPERIAL_ARMOR);
    len += formatex(message[len], (1024-len),    "<br>Self Infection - %d SAP - Turn into a zombie", INFECT_SAP);
    len += formatex(message[len], (1024-len),    "<br>Respawn - %d SAP - Become alive again", REVIVE_SAP);

    show_motd( id, message, "SAP Help" )
}
public SAP_help(id)
{
    show_motd(id,"SAP.txt","SAP HELP")
    return PLUGIN_CONTINUE  
}
public fw_PlayerSpawn_Post(id)
{
    zombs = ZombieCount();

    // Not alive or didn't join a team yet
    if (!is_user_alive(id) )
        return;
    load(id);
}
public fw_PlayerKilled_Post(id, idattacker, shouldgib)
{
    zombs = ZombieCount();
}
ZombieCount()
{
    new count;
    for( new i=1; i<33; i++ )
    {
        if( zp_get_user_zombie(i) && is_user_alive(i) )
            count++;
    }
    return count;
}


stock print(const id, const input[], any:...)
{
    
    new iCount = 1, iPlayers[32]
    
    static szMsg[191]
    vformat(szMsg, charsmax(szMsg), input, 3)
    
    replace_all(szMsg, 190, "^x04", "^4") // green txt
    replace_all(szMsg, 190, "^x01", "^1") // orange txt
    replace_all(szMsg, 190, "^x03", "^3") // team txt
    replace_all(szMsg, 190, "^x00", "^0") // team txt
    
    if(id) iPlayers[0] = id
    else get_players(iPlayers, iCount, "ch")
        
    for (new i = 0; i < iCount; i++)
    {
        if (is_user_connected(iPlayers[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i])
            write_byte(iPlayers[i])
            write_string(szMsg)
            message_end()
        }
    }
}


Может кто знает как с этим разобраться

Там как бе Ammo Packs + AMX Bank менюшка доджна добавляться понравилась а не работает...

Вот весь архив с плагином
Прикрепленный файл  Files.rar ( 114,91 килобайт ) Кол-во скачиваний: 10
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя neJlukaH
сообщение 8.3.2011, 22:35
Сообщение #2
Стаж: 15 лет

Сообщений: 173
Благодарностей: 29
Полезность: 36

идиот, используй спойлер
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя GREMLIN-71
сообщение 8.3.2011, 22:39
Сообщение #3
Стаж: 16 лет

Сообщений: 37
Благодарностей: 1
Полезность: < 0

Цитата(neJlukaH @ 8.3.2011, 23:35) *
идиот, используй спойлер


Идиот у тебя между ног.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Rejiser
сообщение 8.3.2011, 22:44
Сообщение #4


Стаж: 15 лет

Сообщений: 2261
Благодарностей: 1068
Полезность: 870

Цитата(GREMLIN-71 @ 8.3.2011, 23:39) *
Идиот у тебя между ног.

вроде уже как 2 года зареган, а элементарных вещей делать не умеешь
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя GREMLIN-71
сообщение 8.3.2011, 22:46
Сообщение #5
Стаж: 16 лет

Сообщений: 37
Благодарностей: 1
Полезность: < 0

Цитата(Rejiser @ 8.3.2011, 23:44) *
вроде уже как 2 года зареган, а элементарных вещей делать не умеешь


Не убирается под сполер



Ошибка использования BB кодов форума. Возможно вы неправильно использовали какой-то из тегов, как, например, тег [TAG], тогда как он должен использоваться в виде [TAG=] или наоборот.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Rejiser
сообщение 8.3.2011, 23:04
Сообщение #6


Стаж: 15 лет

Сообщений: 2261
Благодарностей: 1068
Полезность: 870

GREMLIN-71,
Код
[spoiler=траливали][/spoiler]
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя LaFA
сообщение 9.3.2011, 1:43
Сообщение #7


Стаж: 16 лет

Сообщений: 4505
Благодарностей: 3256
Полезность: 793

заебался гортать, сори за мат
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: