Заявки за vip модел на мод BaseBuilder

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Потребителски аватар

F33L Th3 P0W3R. REALSERV
Рекламатор
Рекламатор
Мнения: 471
Регистриран: 27 ное 2016, 17:47
Се отблагодари: 16 пъти
Получена благодарност: 37 пъти
Контакти:

Заявки за vip модел на мод BaseBuilder

Мнение от F33L Th3 P0W3R. REALSERV » 11 сеп 2018, 20:36

Редактирах ти нативите и библиотеката, тествай така:

Код: Избери всички

#include <amxmodx>
#include <vzbb_mod>
#include <cstrike>
#include <hamsandwich>

#define SKIN_FLAG ADMIN_IMMUNITY
#define SKIN_NAME "banan"

new bool:g_bHasCustomSkin[33]

public plugin_init()
{
    register_plugin("BaseBuilder VIP Model", "1.0", "OciXCrom")
    RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
}

public plugin_precache()
    precache_player_model(SKIN_NAME)

public client_putinserver(id)
    g_bHasCustomSkin[id] = false

public OnPlayerSpawn(id)
{
    if(is_user_alive(id))
    {
        if(get_user_flags(id) & SKIN_FLAG && !is_user_zombie(id))
        {
            cs_set_user_model(id, SKIN_NAME)
            g_bHasCustomSkin[id] = true
        }
        else if(g_bHasCustomSkin[id])
        {
            g_bHasCustomSkin[id] = false
            cs_reset_user_model(id)
        }
    }
}

precache_player_model(szModel[])
{
    static szFile[128]
    formatex(szFile, charsmax(szFile), "models/player/%s/%s.mdl", szModel, szModel)
    precache_model(szFile)
    replace(szFile, charsmax(szFile), ".mdl", "T.mdl")
    
    if(file_exists(szFile))
        precache_model(szFile)
}
There are people who have money and people who are rich. ~

RealServ в Steam и Discord.
ЗАПИШИ СЕ ЗА ТОМБОЛАТА НИ ВЪВ ФОРУМА (БЕЗПЛАТЕН CS:GO АКАУНТ И ОЩЕ)
Изображение

Потребителски аватар

Huehue 2MF4TH;
Модератор
Модератор
Мнения: 97
Регистриран: 16 яну 2017, 23:42
Се отблагодари: 2 пъти
Получена благодарност: 7 пъти

Заявки за vip модел на мод BaseBuilder

Мнение от Huehue 2MF4TH; » 11 сеп 2018, 22:02

Заповядайте

Код: Избери всички

/*
---------------------------------------------------------
   #  #  #    #===    ###    ##    #
  #    ##     #===   #      #  #    #
   #   #      #===    ###    ##    #
---------------------------------------------------------
<VeCo>'s Zombie BaseBuilder Mod 4.3

Special thanks to:
 - carbonated : for ideas and testing and reset_unlocks_tool.
 - PornStar : for the idea for vzbb_block_weapon_drop CVAR.
 - koyot- : for the idea for bonus credits for
            humans'/zombies' win and other.
 - pacoX : for ideas.
 - MusiC : for ideas.
 - DJ Alex : for ideas and testing.
 - 3emu : for ideas.
 - zNxx-_-Sm0k3 : for testing.
 - HoBaK : for ideas and testing.

If you modify the code, please DO NOT change the author!
---------------------------------------------------------
Contacts:
e-mail: veco.kn@gmail.com
skype: veco_kn
---------------------------------------------------------
Changes log:
 -> v 1.0 = First release!
 -> v 1.1 = Added CVAR vzbb_barrier_alpha.
	    Fixed admin block moving of claimed blocks.
	    Added CVAR vzbb_zombie_class_select_time.
	    Added customizable win sounds.
 -> v 1.2 = Fixed respawn and client command bugs.
 -> v 1.3 = Fixed respawn and client command bugs. (again)
 -> v 1.4 = Fixed bugs with credit reward for humans.
 -> v 1.5 = Blocked teamchange and kill command.
 -> v 1.6 = Fixed executing classic zombie's CVARs.
	    Added icons when you are burning or you are
	    frozen.
	    Changed first respawn after connect.
	    Fixed a lot of critical bugs.
 -> v 1.7 = Blocked respawn commands for spectators.
 -> v 1.8 = Fixed executing configs in Linux.
	    Fixed bug when you are moving block and disconnect.
 -> v 2.0 = Fixed bug with the secondary weapon menu.
	    Changed the method of model change for reducing
	    the crashes.
	    Added customizable human models.
	    Removed unneccessary code.
 -> v 2.1 = Fixed client command bug.
	    Fixed bug with the UNDEAD achievement.
 -> v 2.2 = Fixed bug with the achievements.
 -> v 2.3 = Fixed bug with the regeneration upgrade.
	    Added CVAR cvar_push_remove.
	    The build phase timer now shows minutes and
	    seconds (not only seconds).
	    Zombies can't take shields from the ground.
 -> v 2.4 = SQL defines are now CVARs.
	    Added CVAR vzbb_block_weapon_drop.
	    Fixed twice calling bug in round_end.
	    Admin Zombies can see claimers of the blocks.
 -> v 2.5 = Fixed bug with the rendering restore after removing
	    freeze.
	    Optimized achievement code.
	    Zombies can't infect or kill in the build phase.
 -> v 2.6 = Added better code for blocking the damage during
	    freezetime/round end and Build phase.
	    When a zombie touches a block in the Build phase,
	    the block will be reseted.
	    Added bonus credits for humans'/zombies' win.
	    Added instant auto heal on humans in the Build phase.
 -> v 2.7 = Added /guns command.
	    Now spectator admins can move blocks too.
	    Fixed bug with spectator team transfer.
	    Optimized SQL load/save code.
	    Added CVAR vzbb_credits_win_min_players.
 -> v 2.7.fixed = The old SQL load/save code have 
	    been back again.
 -> v 2.7.fixed.2 = Fixed SQL get_user_name error. (lol :d)
 -> v 2.8 = Added CVAR vzbb_hurt_remove.
	    Added VZBB Map Repair System for fixing the maps
	    where there is no barrier (like bb_icewar)
	    and added vzbb_mrs_addent command for it.
	    Fixed team transfer bug. (yeah, at last! :^) )
 -> v 2.9 = Added HUMILIATION achievement.
	    Added BIG BANG achievement.
	    Fixed bug with the regeneration.
	    Added vzbb_grenade_give_chance CVARs.
	    Changed functions of vzbb_weapons_start_grenade CVARs.
	    Big variable optimization.
	    Added Scan Grenade instead of Smoke Grenade
	    and CVARs for it (vzbb_grenade_scan CVARs).
	    Expanded data save string sizes.
	    Added new VZBB item - ScanNade and CVAR for it.
	    Added vzbb_sql_update SQL command for updating
	    the row sizes from version 2.8- to 2.9.
 -> v 2.9.fixed = Added limitations in the save data code.
 -> v 2.9.fixed.2 = Fixed SQL saving.
 -> v 3.0 = Added zombie item support and items for the
	    zombies.
	    Removed unneccessary code.
	    Added vzbb_grenade_counter CVAR.
	    Added vzbb_grenade_scan_sound CVAR.
	    Zombies must first reduce the humans' armor to 0
	    in order to infect them.
	    Changed FireNade damage code.
	    Now vzbb_grenade_fire_duration CVAR will work
	    for burn times.
	    Now the item menu will not close when you buy an item.
	    Fixed invisibility bugs.
	    Changed block render code.
	    Added VZBB Fun Mode and CVARs for it.
 -> v 3.1 = Fixed user_uninfect native.
	    Fixed item buying.
	    Added random color option in the /color command.
	    Changed some code.
	    Fixed remove money code.
 -> v 3.2 = Changed some code.
	    Fixed bug in block_teamchange function.
 -> v 3.3 = Changes some code.
	    Fixed random sound and random model set codes.
	    Fixed sniper zoom infect bug.
	    Fixed entity check in fun mode code.
	    Fixed cs_get_user_team runtime error in hook_say.
 -> v 3.4 = Added admin logging in /lock, /unclaim and /start commands.
	    Fixed get_total_zombie_classes and get_total_shop_items
	    natives.
	    Removed second default human win sound (it was loop sound).
	    Added "Round Deal" and command (/deal), CVARs for it.
	    Added vzbb_grenade_frost_cool* CVARs.
 -> v 3.5 = Fixed bug with frost grenade explosion.
	    Optimized admin give/take and revive commands.
	    Fixed bug with player rendering.
	    Fixed Round Deal info message.
	    Changed Item Buy System to work properly with Round Deal.
 -> v 3.6 = Changed some code.
	    Fixed start grenade CVARs.
	    Fixed respawn command.
	    Added reason in build ban message.
 -> v 3.7 = Added mp3 support for win sounds.
	    Fixed error on primary attack.
	    Added cvar_credit_limit CVAR.
 -> v 3.8 = Fixed set_user_block_ent native.
	    Changed set speed code.
	    Added function to make a specific zombie class
	    or item available only for players with specific
	    admin access.
	    Added admin /claim command.
	    Changed some code.
	    Added ability to block some custom forwards.
 -> v 3.9 = Optimized code.
	    Fixed bug with speed.
	    Now /claim command works only on unclaimed blocks.
	    Fixed user infect.
	    Fixed bug with fire and freeze grenades.
	    @ALL in admin give/take credit commands changed to @A.
	    Changed and fixed admin give/take credit commands code.
 -> v 3.9.fixed = Changed some code.
 -> v 3.9.fixed.2 = Fixed bug with custom grenades.
 -> v 4.0 = Now, you can disable an upgrade by setting the value 0
	    of one of it's CVARs.
	    Changed Item Buy System for easier and more reliable work.
	    Added function to allow specific items to be bought only
	    specific times per round.
	    Fixed user_infect native.
 -> v 4.0.fixed = Fixed bug with upgrades.
 -> v 4.1 = Fixed typo in the armor HUD message.
	    Added GREEN (regenerating) fun block and CVAR for it.
 -> v 4.2 = Fixed fun block types array size.
	    Added define for enabling better SQL chars escape.
	    Removed useless sql_update_28_29 command.
 -> v 4.3 = Fixed block moving with BattleBuild after being infected.
---------------------------------------------------------
Don't forget to visit http://www.amxmodxbg.org :)
---------------------------------------------------------
*/

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

//#define SQL

#if !defined SQL
#include <nvault>
#else
#include <sqlx>

//#define NEW_CHAR_ESCAPE
/* uncommend the previous line to enable better SQL character escape that doesn't replace
symbols with numbers in players' names (all previous data saves will not be loaded!) */
#endif

#define ADMIN_BLOCK_MOVE_BATTLE ADMIN_CFG // access level for moving blocks in the battle phase
#define ADMIN_BLOCK_LOCK ADMIN_KICK // access level for /lock command
#define ADMIN_BLOCK_UNCLAIM ADMIN_SLAY // access level for /unclaim command
#define ADMIN_BLOCK_CLAIM ADMIN_SLAY // access level for /claim command
#define ADMIN_START ADMIN_RESERVATION // access level for /start command
#define ADMIN_GIVE_CREDIT ADMIN_IMMUNITY // access level for vzbb_give command
#define ADMIN_TAKE_CREDIT ADMIN_RCON // access level for vzbb_take command

#define MAX_BLOCKS 250


/* От тук можеш да си промениш скина и флага */
#define VIP_SKIN	"banan"
#define VIP_SKIN_FLAG ADMIN_IMMUNITY

/*
iuser1 - is locked by an admin?
iuser2 - is being moved?
iuser3 - claimed by?
iuser4 - owner?

fuser1 - render mode?
fuser2 - render amount?
fuser3 - block type?
*/

#define FORWARD_CONTINUE 777 // do not edit or you won't have any luck in lifetime!

#define TASK_BURN 7000
#define TASK_FREEZE 8000
#define TASK_FREEZE_COOL 10000
#define TASK_BUILD_TIME_COUNTER 2000
#define TASK_USER_HUD_DATA 4000
#define TASK_ZCLASS_SELECT 6000
#define TASK_BRESPAWN_REUSE 9000

/*START - From colorchat.inc by Numb */
enum Color {
	NORMAL = 1,
	GREEN,
	TEAM_COLOR,
	GREY,
	RED,
	BLUE,
}

new TeamName[][] = {
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}
/*END - From colorchat.inc by Numb */

new const name_weapons[][] =
{
	"",
	"weapon_glock18",
	"weapon_usp",
	"weapon_p228",
	"weapon_deagle",
	"weapon_fiveseven",
	"weapon_elite",
	"weapon_galil",
	"weapon_m4a1",
	"weapon_mp5navy",
	"weapon_famas",
	"weapon_ak47",
	"weapon_sg552",
	"weapon_aug",
	"weapon_tmp",
	"weapon_ump45",
	"weapon_mac10",
	"weapon_p90",
	"weapon_scout",
	"weapon_m3",
	"weapon_xm1014",
	"weapon_sg550",
	"weapon_g3sg1",
	"weapon_awp",
	"weapon_m249"
}

new const csw_weapons[] =
{
	0,
	CSW_GLOCK18,
	CSW_USP,
	CSW_P228,
	CSW_DEAGLE,
	CSW_FIVESEVEN,
	CSW_ELITE,
	CSW_GALIL,
	CSW_M4A1,
	CSW_MP5NAVY,
	CSW_FAMAS,
	CSW_AK47,
	CSW_SG552,
	CSW_AUG,
	CSW_TMP,
	CSW_UMP45,
	CSW_MAC10,
	CSW_P90,
	CSW_SCOUT,
	CSW_M3,
	CSW_XM1014,
	CSW_SG550,
	CSW_G3SG1,
	CSW_AWP,
	CSW_M249
}

enum _:ZOMBIE_CLASS_DATA
{
	ZOMBIE_NAME[32],
	ZOMBIE_INFO[32],
	ZOMBIE_MDL[128],
	ZOMBIE_CLAWMDL[128],
	ZOMBIE_HEALTH,
	Float:ZOMBIE_GRAVITY,
	Float:ZOMBIE_SPEED,
	ZOMBIE_ACCESS
}

enum _:SHOP_ITEM_DATA
{
	ITEM_NAME[32],
	ITEM_COST,
	ITEM_USE,
	ITEM_TEAM,
	ITEM_ACCESS,
	ITEM_MAX,
	ITEM_MAX_PRIVATE
}

enum
{
	ACH_BLOODPARTY = 0,
	ACH_GENOCIDE,
	ACH_FIREWORKS,
	ACH_ICEAGE,
	ACH_BASEBUILDER,
	ACH_UNDEAD,
	ACH_SURVIVOR,
	ACH_UPGRADEME,
	ACH_UNLOCKERZ,
	ACH_BIOHAZARD,
	ACH_HUMILIATION,
	ACH_BIGBANG,
	MAX_ACH
}

enum
{
	ACH_LEVEL_WHITE = 1,
	ACH_LEVEL_YELLOW,
	ACH_LEVEL_RED,
	MAX_ACH_LEVEL
}

new const ach_name[][] =
{
	"BLOOD PARTY",
	"GENOCIDE",
	"FIREWORKS",
	"ICE AGE",
	"BASEBUILDER",
	"UNDEAD",
	"SURVIVOR",
	"UPGRADE ME!",
	"UNLOCKERZ",
	"BIOHAZARD",
	"HUMILIATION",
	"BIG BANG"
}

new const ach_level_color[][] =
{
	"\d",
	"\w",
	"\y"
}

new const ach_info1[][] =
{
	"Kill ",
	"Kill ",
	"Burn ",
	"Freeze ",
	"Move ",
	"Respawn ",
	"Survive ",
	"Buy ",
	"Unlock ",
	"Infect ",
	"Kill ",
	"Kill "
}

new const ach_info2[][] =
{
	" humans",
	" zombies",
	" zombies at once",
	" zombies at once",
	" blocks",
	" times",
	" minutes as a human in the battle phase",
	" upgrades",
	" weapons",
	" humans",
	" zombies with a knife",
	" zombies with a fire grenade"
}

enum
{
	UPGRADE_HEALTH = 0,
	UPGRADE_ARMOR,
	UPGRADE_REGENERATION,
	UPGRADE_RECOIL,
	UPGRADE_SPEED,
	UPGRADE_GRAVITY,
	UPGRADE_INVISIBILITY,
	MAX_UPGRADES
}

new const upgrade_name[][] =
{
	"Health",
	"Armor",
	"Regeneration",
	"Recoil",
	"Speed",
	"Gravity",
	"Invisibility"
}

new const sound_zombie_pain[][] =
{
	"zombie_blood/pain1.wav",
	"zombie_blood/pain2.wav",
	"zombie_blood/pain3.wav",
	"zombie_blood/pain4.wav"
}

new const sound_zombie_die[][] =
{
	"zombie_blood/die1.wav",
	"zombie_blood/die2.wav",
	"zombie_blood/die3.wav"
}

new const sound_zombies_win[][] =
{
	"ambience/the_horror1.wav",
	"ambience/the_horror2.wav"
}

new const sound_humans_win[][] =
{
	"ambience/goal_1.wav"
}

new const human_models[][] =
{
	"arctic",
	"guerilla",
	"leet",
	"terror",
	"gign",
	"gsg9",
	"sas",
	"urban"
}

new const nade_names[][] =
{
	"weapon_hegrenade",
	"weapon_flashbang",
	"weapon_smokegrenade"
}

new const csw_nades[] =
{
	CSW_HEGRENADE,
	CSW_FLASHBANG,
	CSW_SMOKEGRENADE
}

enum
{
	BLOCKS_NORMAL = 0,
	BLOCKS_YELLOW,
	BLOCKS_BLACK,
	BLOCKS_BLUE,
	BLOCKS_RED,
	BLOCKS_GREEN,
	MAX_BLOCKTYPES
}

new const Float:fun_blocks_colors[][3] =
{
	{0.0,0.0,0.0},
	{255.0,255.0,0.0},
	{0.0,0.0,0.0},
	{0.0,0.0,255.0},
	{255.0,0.0,0.0},
	{0.0,255.0,0.0}
}

new const fun_blocks_names[][] =
{
	"Normal Block",
	"Yellow Block",
	"Black Block",
	"Blue Block",
	"Red Block",
	"Green Block"
}

new const short_team_names[][] =
{
	"A",
	"Z",
	"H"
}

new const long_team_names[][] =
{
	"players",
	"zombies",
	"humans"
}

new const log_file[] = "addons/amxmodx/logs/vzbb_mod_log.log"
new const mrs_file[] = "addons/amxmodx/configs/vzbb_mod_mrs.ini"

new spr_trail,spr_flame,spr_smoke, mdl_glassgibs,
sv_backslash_str[2], cvar_build_time, cvar_data_save_type, cvar_mode, cvar_push_remove,cvar_hurt_remove, cvar_barrier_alpha, cvar_block_wpn_drop,
cvar_respawn_time,cvar_respawn_bchance,cvar_respawn_bchance_cost,cvar_respawn_bchance_reuse_time,
cvar_zclass_nr_select,cvar_zclass_select_time,
cvar_zombie_classic_mdl,cvar_zombie_classic_clawmdl,cvar_zombie_classic_hp,cvar_zombie_classic_grav,cvar_zombie_classic_speed,
cvar_block_nr_reset,cvar_block_claim,cvar_block_maxclaims, cvar_block_select_alpha,cvar_block_select_color,cvar_block_user_select_color,
cvar_move_pull_push_speed,cvar_move_min_dist,cvar_move_max_dist,
cvar_weapons_weapons[sizeof name_weapons],cvar_weapons_start_grenade[3],
cvar_unlock[sizeof name_weapons],cvar_unlock_cost[sizeof name_weapons],
cvar_credit_start,cvar_credit_limit, cvar_credit_give,cvar_credit_look, cvar_credits_hkill,cvar_credits_zkill,cvar_credits_hkillhs,cvar_credits_zkillhs,
cvar_credits_z_win,cvar_credits_h_win,cvar_credits_win_min_players,
cvar_round_deal,cvar_round_deal_chance, cvar_round_deal_min_items,cvar_round_deal_max_items, cvar_round_deal_min_discount,cvar_round_deal_max_discount,
cvar_nade_give_chance[3],cvar_nade_counter,
cvar_nade_fire,cvar_nade_fire_radius,cvar_nade_fire_dur,cvar_nade_fire_damage,cvar_nade_fire_dmgstep,cvar_nade_fire_can_kill,
cvar_nade_frost,cvar_nade_frost_radius,cvar_nade_frost_dur, cvar_nade_frost_cool,cvar_nade_frost_cool_radius,cvar_nade_frost_cool_dur,
cvar_nade_scan_sound,cvar_nade_scan,cvar_nade_scan_radius,cvar_nade_scan_step,
cvar_ach,cvar_ach_price[MAX_ACH_LEVEL],cvar_ach_get[MAX_ACH][MAX_ACH_LEVEL],
cvar_upgrade[3][MAX_UPGRADES],cvar_upgrade_levels[3][MAX_UPGRADES],cvar_upgrade_cost[3][MAX_UPGRADES],
cvar_fun,cvar_fun_blocks_num[MAX_BLOCKTYPES], Float:g_fOffset1[33], Float:g_fOffset2[33], Float:g_fOffset3[33], //dsa
#if defined SQL
cvar_sql_host,cvar_sql_user,cvar_sql_pass,cvar_sql_db,
#endif
get_barrierent, maxplayers,maxrounds, sync,sync2,sync3,sync4, freezetime,
cvar_get_select_color[3], get_blocks[MAX_BLOCKS],total_blocks,
count_build_time, can_build, total_rounds, h_lose, round_mode, was_zombie[33], hud_cache_text[128],hud_cache_colors[3],bool:hud_cache_condition,
is_banned[33],user_banreason[33][128], can_bc_respawn[33], user_race[33], user_credits[33], user_unlock[33][sizeof name_weapons], selected_weapons[33],
user_upgrade_level[33][3][MAX_UPGRADES],user_upgrade_last_race[33],user_buy_last_race[33], round_deal_items,round_deal_discount,
zclassic_mdl_str[128],zclassic_clawmdl_str[128],
user_class[33],get_zclass_clawmdl[33][128],Float:get_user_speed[33],can_select_zclass[33],must_change_zclass[33],
Float:user_block_color[33][3],user_blockent[33],Float:user_block_dist[33],user_block_claims[33], user_build_battle[33],
user_fire_dur[33],user_fire_atk[33], user_frost[33],user_frost_cool[33],user_block_frost[33], user_played_seconds[33], user_ach_progress[33][MAX_ACH],user_ach_level[33][MAX_ACH],must_save[33],
total_zombie_classes,total_shop_items,
Array:zombie_array,Array:shop_item_array,
fwd_zombie_class_selected,fwd_shop_item_selected,fwd_block_pull_push,fwd_battle_phase_begin,fwd_battle_phase_begin_adm,
fwd_throw_nade_pre,fwd_throw_nade_post, fwd_user_burn_pre,fwd_user_burn_post,fwd_user_remove_burn,
fwd_user_freeze_pre,fwd_user_freeze_post,fwd_user_unfreeze_pre,fwd_user_unfreeze_post,
fwd_user_freeze_cool_pre,fwd_user_freeze_cool_post,fwd_user_unfreeze_cool_pre,fwd_user_unfreeze_cool_post,
fwd_user_infect_pre,fwd_user_infect_post,fwd_user_uninfect_pre,fwd_user_uninfect_post, fwd_grab_block_pre,fwd_grab_block_post,
fwd_release_block_pre,fwd_release_block_post, fwd_update_user_hud_data, fwd_fun_block_touch_pre,fwd_fun_block_touch_post,
msg_hideweapon,msg_health,msg_sendaudio,msg_deathmsg,msg_scoreattrib,msg_scoreinfo,msg_screenfade,msg_statusicon,
fwd_return,
bots_cvar,pointer_activity,bots_reg

#if !defined SQL
new vault
#else
new Handle:mysql_tuple,str_error[512]
#endif

public plugin_precache()
{
	new cfgfile[44], cache_mdl_str[128],cache_clawmdl_str[128], i, ent = create_entity("info_bomb_target")
	
	spr_trail = precache_model("sprites/white.spr")
	spr_flame = precache_model("sprites/flame.spr")
	spr_smoke = precache_model("sprites/black_smoke3.spr")
	
	mdl_glassgibs = precache_model("models/glassgibs.mdl")
	
	cvar_zombie_classic_mdl = register_cvar("vzbb_zombie_classic_mdl","zombie_source")
	cvar_zombie_classic_clawmdl = register_cvar("vzbb_zombie_classic_clawmdl","v_claws")
	
	cvar_zombie_classic_hp = register_cvar("vzbb_zombie_classic_health","2500")
	cvar_zombie_classic_grav = register_cvar("vzbb_zombie_classic_gravity","1.0")
	cvar_zombie_classic_speed = register_cvar("vzbb_zombie_classic_speed","0.0")
	
	formatex(cfgfile,43,"addons/amxmodx/configs/vzbb_mod_classes.cfg")
	
	if(file_exists(cfgfile))
	{
		server_cmd("exec %s", cfgfile)
	} else {
		log_amx("[VZBB] ERROR: File configs/vzbb_mod_classes doesn't exist!")
		log_amx("[VZBB] Default CVAR values will be loaded instead.")
	}
	
	get_pcvar_string(cvar_zombie_classic_mdl,zclassic_mdl_str,127)
	get_pcvar_string(cvar_zombie_classic_clawmdl,zclassic_clawmdl_str,127)
	
	formatex(cache_mdl_str,127,"models/player/%s/%s.mdl",zclassic_mdl_str,zclassic_mdl_str)
	formatex(cache_clawmdl_str,127,"models/%s.mdl",zclassic_clawmdl_str)
	
	precache_model(cache_mdl_str)
	precache_model(cache_clawmdl_str)
	
	for(i=0;i<sizeof human_models;i++)
	{
		formatex(cache_mdl_str,127,"models/player/%s/%s.mdl",human_models[i],human_models[i])
		precache_model(cache_mdl_str)
	}

	precache_player_model(VIP_SKIN)
	
	new cache_str[128]
	for(i=0;i<sizeof sound_zombie_pain;i++) precache_sound(sound_zombie_pain[i])
	for(i=0;i<sizeof sound_zombie_die;i++) precache_sound(sound_zombie_die[i])
	
	for(i=0;i<sizeof sound_zombies_win;i++)
	{
		if(!equal(sound_zombies_win[i][strlen(sound_zombies_win[i]) - 4],".mp3"))
		{
			precache_sound(sound_zombies_win[i])
		} else {
			formatex(cache_str,127,"sound/%s",sound_zombies_win[i])
			precache_generic(cache_str)
		}
	}
	
	for(i=0;i<sizeof sound_humans_win;i++)
	{
		if(!equal(sound_humans_win[i][strlen(sound_humans_win[i]) - 4],".mp3"))
		{
			precache_sound(sound_humans_win[i])
		} else {
			formatex(cache_str,127,"sound/%s",sound_humans_win[i])
			precache_generic(cache_str)
		}
	}
	
	precache_sound("zombie_blood/infect1.wav")
	
	precache_sound("turret/tu_ping.wav")
	precache_sound("debris/beamstart8.wav")
	precache_sound("ambience/flameburst1.wav")
	
	if(ent) entity_set_origin(ent,Float:{8192.0,8192.0,8192.0})
}

public plugin_init() {
	register_plugin("<VeCo>'s Zombie BaseBuilder Mod", "4.3", "<VeCo>")
	
	cvar_build_time = register_cvar("vzbb_build_time","120")
	
	cvar_data_save_type = register_cvar("vzbb_data_save_type","0")
	
	cvar_mode = register_cvar("vzbb_mode","0")
	
	cvar_push_remove = register_cvar("vzbb_push_remove","0")
	cvar_hurt_remove = register_cvar("vzbb_hurt_remove","0")
	
	cvar_barrier_alpha = register_cvar("vzbb_barrier_alpha","175.0")
	
	cvar_block_wpn_drop = register_cvar("vzbb_block_weapon_drop","0")
	
	cvar_respawn_time = register_cvar("vzbb_respawn_time","2.0")
	cvar_respawn_bchance = register_cvar("vzbb_respawn_battle_chance","6")
	cvar_respawn_bchance_cost = register_cvar("vzbb_respawn_battle_chance_cost","8")
	cvar_respawn_bchance_reuse_time = register_cvar("vzbb_respawn_battle_chance_reuse_time","60.0")
	
	cvar_zclass_nr_select = register_cvar("vzbb_zombie_class_newround_select","1")
	cvar_zclass_select_time = register_cvar("vzbb_zombie_class_select_time","9.0")
	
	cvar_block_nr_reset = register_cvar("vzbb_block_newround_reset","1")
	cvar_block_claim = register_cvar("vzbb_block_claim","1")
	cvar_block_maxclaims = register_cvar("vzbb_block_max_claims","8")
	cvar_block_select_alpha = register_cvar("vzbb_block_select_alpha","100.0")
	cvar_block_select_color = register_cvar("vzbb_block_select_color","255 0 0")
	cvar_block_user_select_color = register_cvar("vzbb_block_user_select_color","1")
	
	new select_cvar_str[12], r[4],g[4],b[4]
	get_pcvar_string(cvar_block_select_color, select_cvar_str,11)
	parse(select_cvar_str, r,3, g,3, b,3)
	cvar_get_select_color[0] = str_to_num(r)
	cvar_get_select_color[1] = str_to_num(g)
	cvar_get_select_color[2] = str_to_num(b)
	
	cvar_move_pull_push_speed = register_cvar("vzbb_move_pull_push_speed","2.0")
	cvar_move_min_dist = register_cvar("vzbb_move_min_distance","80.0")
	cvar_move_max_dist = register_cvar("vzbb_move_max_distance","900.0")
	
	new i,weapon_str[36]
	for(i=1;i<sizeof name_weapons;i++)
	{
		formatex(weapon_str,35,"vzbb_%s",name_weapons[i])
		cvar_weapons_weapons[i] = register_cvar(weapon_str,"1")
		
		formatex(weapon_str,35,"vzbb_unlock_%s",name_weapons[i])
		cvar_unlock[i] = register_cvar(weapon_str,"0")
		
		formatex(weapon_str,35,"vzbb_unlock_cost_%s",name_weapons[i])
		cvar_unlock_cost[i] = register_cvar(weapon_str,"2")
	}
	
	cvar_weapons_start_grenade[0] = register_cvar("vzbb_weapon_start_grenade_he","1")
	cvar_weapons_start_grenade[1] = register_cvar("vzbb_weapon_start_grenade_fb","1")
	cvar_weapons_start_grenade[2] = register_cvar("vzbb_weapon_start_grenade_sg","1")
	
	cvar_credit_start = register_cvar("vzbb_credit_start","5")
	cvar_credit_limit = register_cvar("vzbb_credit_limit","0")
	
	cvar_credit_give = register_cvar("vzbb_credit_give","1")
	cvar_credit_look = register_cvar("vzbb_credit_look","1")
	
	cvar_credits_hkill = register_cvar("vzbb_credits_human_kill","2")
	cvar_credits_zkill = register_cvar("vzbb_credits_zombie_kill","1")
	cvar_credits_hkillhs = register_cvar("vzbb_credits_human_kill_headshot","4")
	cvar_credits_zkillhs = register_cvar("vzbb_credits_zombie_kill_headshot","2")
	
	cvar_credits_h_win = register_cvar("vzbb_credits_humans_win","10")
	cvar_credits_z_win = register_cvar("vzbb_credits_zombies_win","10")
	cvar_credits_win_min_players = register_cvar("vzbb_credits_win_min_players","4")
	
	cvar_round_deal = register_cvar("vzbb_round_deal","1")
	cvar_round_deal_chance = register_cvar("vzbb_round_deal_chance","98")
	cvar_round_deal_min_items = register_cvar("vzbb_round_deal_min_items","1")
	cvar_round_deal_max_items = register_cvar("vzbb_round_deal_max_items","3")
	cvar_round_deal_min_discount = register_cvar("vzbb_round_deal_min_discount","1")
	cvar_round_deal_max_discount = register_cvar("vzbb_round_deal_max_discount","4")
	
	cvar_nade_give_chance[0] = register_cvar("vzbb_grenade_give_chance_fire","100")
	cvar_nade_give_chance[1] = register_cvar("vzbb_grenade_give_chance_frost","100")
	cvar_nade_give_chance[2] = register_cvar("vzbb_grenade_give_chance_scan","75")
	
	cvar_nade_counter = register_cvar("vzbb_grenade_counter","1")
	
	cvar_nade_fire = register_cvar("vzbb_grenade_fire","1")
	cvar_nade_fire_radius = register_cvar("vzbb_grenade_fire_radius","200")
	cvar_nade_fire_dur = register_cvar("vzbb_grenade_fire_duration","10")
	cvar_nade_fire_damage = register_cvar("vzbb_grenade_fire_damage","20")
	cvar_nade_fire_dmgstep = register_cvar("vzbb_grenade_fire_damage_step","0.5")
	cvar_nade_fire_can_kill = register_cvar("vzbb_grenade_fire_can_kill","1")
	
	cvar_nade_frost = register_cvar("vzbb_grenade_frost","1")
	cvar_nade_frost_radius = register_cvar("vzbb_grenade_frost_radius","200")
	cvar_nade_frost_dur = register_cvar("vzbb_grenade_frost_duration","4.0")
	cvar_nade_frost_cool = register_cvar("vzbb_grenade_frost_cool","1")
	cvar_nade_frost_cool_radius = register_cvar("vzbb_grenade_frost_cool_radius","100")
	cvar_nade_frost_cool_dur = register_cvar("vzbb_grenade_frost_cool_duration","4.0")
	
	cvar_nade_scan = register_cvar("vzbb_grenade_scan","1")
	cvar_nade_scan_radius = register_cvar("vzbb_grenade_scan_radius","300")
	cvar_nade_scan_step = register_cvar("vzbb_grenade_scan_step","0.5")
	cvar_nade_scan_sound = register_cvar("vzbb_grenade_scan_sound","0")
	
	cvar_ach = register_cvar("vzbb_achievement","1")
	
	cvar_ach_price[ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_white_price","30")
	cvar_ach_price[ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_yellow_price","50")
	cvar_ach_price[ACH_LEVEL_RED] = register_cvar("vzbb_achievement_red_price","100")
	
	cvar_ach_get[ACH_BLOODPARTY][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_bloodparty_white","200")
	cvar_ach_get[ACH_BLOODPARTY][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_bloodparty_yellow","400")
	cvar_ach_get[ACH_BLOODPARTY][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_bloodparty_red","600")
	
	cvar_ach_get[ACH_GENOCIDE][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_genocide_white","200")
	cvar_ach_get[ACH_GENOCIDE][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_genocide_yellow","400")
	cvar_ach_get[ACH_GENOCIDE][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_genocide_red","600")
	
	cvar_ach_get[ACH_FIREWORKS][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_fireworks_white","5")
	cvar_ach_get[ACH_FIREWORKS][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_fireworks_yellow","6")
	cvar_ach_get[ACH_FIREWORKS][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_fireworks_red","7")
	
	cvar_ach_get[ACH_ICEAGE][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_iceage_white","5")
	cvar_ach_get[ACH_ICEAGE][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_iceage_yellow","6")
	cvar_ach_get[ACH_ICEAGE][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_iceage_red","7")
	
	cvar_ach_get[ACH_BASEBUILDER][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_basebuilder_white","100")
	cvar_ach_get[ACH_BASEBUILDER][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_basebuilder_yellow","300")
	cvar_ach_get[ACH_BASEBUILDER][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_basebuilder_red","750")
	
	cvar_ach_get[ACH_UNDEAD][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_undead_white","300")
	cvar_ach_get[ACH_UNDEAD][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_undead_yellow","550")
	cvar_ach_get[ACH_UNDEAD][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_undead_red","725")
	
	cvar_ach_get[ACH_SURVIVOR][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_survivor_white","100")
	cvar_ach_get[ACH_SURVIVOR][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_survivor_yellow","600")
	cvar_ach_get[ACH_SURVIVOR][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_survivor_red","1200")
	
	cvar_ach_get[ACH_UPGRADEME][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_upgrademe_white","5")
	cvar_ach_get[ACH_UPGRADEME][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_upgrademe_yellow","12")
	cvar_ach_get[ACH_UPGRADEME][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_upgrademe_red","50")
	
	cvar_ach_get[ACH_UNLOCKERZ][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_unlockerz_white","2")
	cvar_ach_get[ACH_UNLOCKERZ][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_unlockerz_yellow","5")
	cvar_ach_get[ACH_UNLOCKERZ][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_unlockerz_red","7")
	
	cvar_ach_get[ACH_BIOHAZARD][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_biohazard_white","500")
	cvar_ach_get[ACH_BIOHAZARD][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_biohazard_yellow","1000")
	cvar_ach_get[ACH_BIOHAZARD][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_biohazard_red","1350")
	
	cvar_ach_get[ACH_HUMILIATION][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_humiliation_white","1")
	cvar_ach_get[ACH_HUMILIATION][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_humiliation_yellow","2")
	cvar_ach_get[ACH_HUMILIATION][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_humiliation_red","3")
	
	cvar_ach_get[ACH_BIGBANG][ACH_LEVEL_WHITE] = register_cvar("vzbb_achievement_bigbang_white","1")
	cvar_ach_get[ACH_BIGBANG][ACH_LEVEL_YELLOW] = register_cvar("vzbb_achievement_bigbang_yellow","2")
	cvar_ach_get[ACH_BIGBANG][ACH_LEVEL_RED] = register_cvar("vzbb_achievement_bigbang_red","3")
	
	
	cvar_upgrade[1][UPGRADE_HEALTH] = register_cvar("vzbb_upgrade_zombie_health","100")
	cvar_upgrade_levels[1][UPGRADE_HEALTH] = register_cvar("vzbb_upgrade_zombie_health_levels","20")
	cvar_upgrade_cost[1][UPGRADE_HEALTH] = register_cvar("vzbb_upgrade_zombie_health_cost","18")
	
	cvar_upgrade[1][UPGRADE_REGENERATION] = register_cvar("vzbb_upgrade_zombie_regeneration","1")
	cvar_upgrade_levels[1][UPGRADE_REGENERATION] = register_cvar("vzbb_upgrade_zombie_regeneration_levels","20")
	cvar_upgrade_cost[1][UPGRADE_REGENERATION] = register_cvar("vzbb_upgrade_zombie_regeneration_cost","25")
	
	cvar_upgrade[1][UPGRADE_SPEED] = register_cvar("vzbb_upgrade_zombie_speed","20.0")
	cvar_upgrade_levels[1][UPGRADE_SPEED] = register_cvar("vzbb_upgrade_zombie_speed_levels","20")
	cvar_upgrade_cost[1][UPGRADE_SPEED] = register_cvar("vzbb_upgrade_zombie_speed_cost","20")
	
	cvar_upgrade[1][UPGRADE_GRAVITY] = register_cvar("vzbb_upgrade_zombie_gravity","0.025")
	cvar_upgrade_levels[1][UPGRADE_GRAVITY] = register_cvar("vzbb_upgrade_zombie_gravity_levels","20")
	cvar_upgrade_cost[1][UPGRADE_GRAVITY] = register_cvar("vzbb_upgrade_zombie_gravity_cost","25")
	
	cvar_upgrade[1][UPGRADE_INVISIBILITY] = register_cvar("vzbb_upgrade_zombie_invisibility","12")
	cvar_upgrade_levels[1][UPGRADE_INVISIBILITY] = register_cvar("vzbb_upgrade_zombie_invisibility_levels","20")
	cvar_upgrade_cost[1][UPGRADE_INVISIBILITY] = register_cvar("vzbb_upgrade_zombie_invisibility_cost","20")
	
	
	cvar_upgrade[2][UPGRADE_HEALTH] = register_cvar("vzbb_upgrade_human_health","10")
	cvar_upgrade_levels[2][UPGRADE_HEALTH] = register_cvar("vzbb_upgrade_human_health_levels","20")
	cvar_upgrade_cost[2][UPGRADE_HEALTH] = register_cvar("vzbb_upgrade_human_health_cost","15")
	
	cvar_upgrade[2][UPGRADE_ARMOR] = register_cvar("vzbb_upgrade_human_armor","8")
	cvar_upgrade_levels[2][UPGRADE_ARMOR] = register_cvar("vzbb_upgrade_human_armor_levels","20")
	cvar_upgrade_cost[2][UPGRADE_ARMOR] = register_cvar("vzbb_upgrade_human_armor_cost","10")
	
	cvar_upgrade[2][UPGRADE_RECOIL] = register_cvar("vzbb_upgrade_human_recoil","0.1")
	cvar_upgrade_levels[2][UPGRADE_RECOIL] = register_cvar("vzbb_upgrade_human_recoil_levels","20")
	cvar_upgrade_cost[2][UPGRADE_RECOIL] = register_cvar("vzbb_upgrade_human_recoil_cost","20")
	
	cvar_upgrade[2][UPGRADE_SPEED] = register_cvar("vzbb_upgrade_human_speed","15.0")
	cvar_upgrade_levels[2][UPGRADE_SPEED] = register_cvar("vzbb_upgrade_human_speed_levels","20")
	cvar_upgrade_cost[2][UPGRADE_SPEED] = register_cvar("vzbb_upgrade_human_speed_cost","20")
	
	cvar_upgrade[2][UPGRADE_GRAVITY] = register_cvar("vzbb_upgrade_human_gravity","0.06")
	cvar_upgrade_levels[2][UPGRADE_GRAVITY] = register_cvar("vzbb_upgrade_human_gravity_levels","20")
	cvar_upgrade_cost[2][UPGRADE_GRAVITY] = register_cvar("vzbb_upgrade_human_gravity_cost","25")
	
	cvar_upgrade[2][UPGRADE_INVISIBILITY] = register_cvar("vzbb_upgrade_human_invisibility","12")
	cvar_upgrade_levels[2][UPGRADE_INVISIBILITY] = register_cvar("vzbb_upgrade_human_invisibility_levels","20")
	cvar_upgrade_cost[2][UPGRADE_INVISIBILITY] = register_cvar("vzbb_upgrade_human_invisibility_cost","20")
	
	cvar_fun = register_cvar("vzbb_fun","0")
	
	cvar_fun_blocks_num[BLOCKS_YELLOW] = register_cvar("vzbb_fun_blocks_yellow_num","4")
	cvar_fun_blocks_num[BLOCKS_BLACK] = register_cvar("vzbb_fun_blocks_black_num","2")
	cvar_fun_blocks_num[BLOCKS_BLUE] = register_cvar("vzbb_fun_blocks_blue_num","1")
	cvar_fun_blocks_num[BLOCKS_RED] = register_cvar("vzbb_fun_blocks_red_num","1")
	cvar_fun_blocks_num[BLOCKS_GREEN] = register_cvar("vzbb_fun_blocks_green_num","1")
	
	fwd_zombie_class_selected = CreateMultiForward("zombie_class_selected",ET_IGNORE, FP_CELL,FP_CELL)
	fwd_shop_item_selected = CreateMultiForward("shop_item_selected",ET_CONTINUE, FP_CELL,FP_CELL)
	fwd_block_pull_push = CreateMultiForward("block_pull_push",ET_CONTINUE, FP_CELL,FP_CELL)
	fwd_battle_phase_begin = CreateMultiForward("battle_phase_begin",ET_IGNORE)
	fwd_battle_phase_begin_adm = CreateMultiForward("battle_phase_begin_admin",ET_IGNORE,FP_CELL)
	
	fwd_throw_nade_pre = CreateMultiForward("throw_nade_pre",ET_CONTINUE, FP_CELL,FP_CELL,FP_CELL)
	fwd_throw_nade_post = CreateMultiForward("throw_nade_post",ET_IGNORE, FP_CELL,FP_CELL,FP_CELL)
	
	fwd_user_burn_pre = CreateMultiForward("user_burn_pre",ET_IGNORE, FP_CELL)
	fwd_user_burn_post = CreateMultiForward("user_burn_post",ET_IGNORE, FP_CELL)
	fwd_user_remove_burn = CreateMultiForward("user_remove_burn",ET_IGNORE, FP_CELL)
	
	fwd_user_freeze_pre = CreateMultiForward("user_freeze_pre",ET_IGNORE, FP_CELL)
	fwd_user_freeze_post = CreateMultiForward("user_freeze_post",ET_IGNORE, FP_CELL)
	fwd_user_unfreeze_pre = CreateMultiForward("user_unfreeze_pre",ET_IGNORE, FP_CELL)
	fwd_user_unfreeze_post = CreateMultiForward("user_unfreeze_post",ET_IGNORE, FP_CELL)
	
	fwd_user_freeze_cool_pre = CreateMultiForward("user_freeze_cool_pre",ET_IGNORE, FP_CELL)
	fwd_user_freeze_cool_post = CreateMultiForward("user_freeze_cool_post",ET_IGNORE, FP_CELL)
	fwd_user_unfreeze_cool_pre = CreateMultiForward("user_unfreeze_cool_pre",ET_IGNORE, FP_CELL)
	fwd_user_unfreeze_cool_post = CreateMultiForward("user_unfreeze_cool_post",ET_IGNORE, FP_CELL)
	
	fwd_user_infect_pre = CreateMultiForward("user_infect_pre",ET_CONTINUE, FP_CELL,FP_CELL)
	fwd_user_infect_post = CreateMultiForward("user_infect_post",ET_IGNORE, FP_CELL)
	
	fwd_user_uninfect_pre = CreateMultiForward("user_uninfect_pre",ET_CONTINUE, FP_CELL)
	fwd_user_uninfect_post = CreateMultiForward("user_uninfect_post",ET_IGNORE, FP_CELL)
	
	fwd_grab_block_pre = CreateMultiForward("grab_block_pre",ET_CONTINUE, FP_CELL)
	fwd_grab_block_post = CreateMultiForward("grab_block_post",ET_IGNORE, FP_CELL)
	
	fwd_release_block_pre = CreateMultiForward("release_block_pre",ET_CONTINUE, FP_CELL)
	fwd_release_block_post = CreateMultiForward("release_block_post",ET_IGNORE, FP_CELL)
	
	fwd_update_user_hud_data = CreateMultiForward("update_user_hud_data",ET_CONTINUE)
	
	fwd_fun_block_touch_pre = CreateMultiForward("fun_block_touch_pre",ET_CONTINUE, FP_CELL,FP_CELL,FP_CELL)
	fwd_fun_block_touch_post = CreateMultiForward("fun_block_touch_post",ET_IGNORE, FP_CELL,FP_CELL,FP_CELL)
	
	msg_hideweapon = get_user_msgid("HideWeapon")
	msg_health = get_user_msgid("Health")
	msg_sendaudio = get_user_msgid("SendAudio")
	msg_deathmsg = get_user_msgid("DeathMsg")
	msg_scoreattrib = get_user_msgid("ScoreAttrib")
	msg_scoreinfo = get_user_msgid("ScoreInfo")
	msg_screenfade = get_user_msgid("ScreenFade")
	msg_statusicon = get_user_msgid("StatusIcon")
	msg_scoreattrib = get_user_msgid("ScoreAttrib")
	
	register_clcmd("jointeam","block_teamchange")
	register_clcmd("chooseteam","block_teamchange")
	
	register_clcmd("+grab","grab_block")
	register_clcmd("-grab","release_block")
	
	register_concmd("vzbb_give","admin_give_credits",ADMIN_GIVE_CREDIT,"<name / #userid / @H / @Z / @A> <credits>")
	register_concmd("vzbb_take","admin_take_credits",ADMIN_TAKE_CREDIT,"<name / #userid / @H / @Z / @A> <credits>")
	
	register_clcmd("vzbb_ban","admin_ban_user",ADMIN_BAN,"<name / #userid> <reason>")
	register_clcmd("vzbb_unban","admin_unban_user",ADMIN_BAN,"<name / #userid>")
	
	register_clcmd("vzbb_mrs_addent","admin_mrs_addent",ADMIN_RCON,"- Aim at the entity you want to make barrier")
	
	register_clcmd("say","hook_say")
	register_clcmd("say_team","hook_say")
	
	register_event("HLTV","event_hltv","a","1=0","2=0")
	register_event("DeathMsg","hook_death","a")
	register_event("CurWeapon","event_curweapon","be","1=1")
	register_event("TextMsg","event_textmsg","a","2&#Game_Commencing")
	
	register_logevent("round_end",2,"1=Round_End")
	register_logevent("round_start",2,"1=Round_Start")
	
	register_message(msg_health,"message_health")
	register_message(msg_sendaudio,"message_sendaudio")
	register_message(msg_scoreattrib,"message_scoreattrib")
	
	RegisterHam(Ham_Spawn,"weaponbox","weapon_remove")
	RegisterHam(Ham_Spawn,"weapon_shield","weapon_remove")
	RegisterHam(Ham_Spawn,"player","player_spawn",1)
	RegisterHam(Ham_TakeDamage,"player","player_take_damage")
	RegisterHam(Ham_Touch,"armoury_entity","weapon_touch")
	RegisterHam(Ham_Touch,"weaponbox","weapon_touch")
	RegisterHam(Ham_Touch,"weapon_shield","weapon_touch")
	RegisterHam(Ham_Touch,"func_wall","player_wall_touch")
	RegisterHam(Ham_Item_PreFrame,"player","player_item_pre_frame",1)
	
	for(i=1;i<sizeof name_weapons;i++) RegisterHam(Ham_Weapon_PrimaryAttack,name_weapons[i],"weapon_primary_attack",1)
	
	register_forward(FM_SetModel,"fm_set_model")
	register_forward(FM_EmitSound,"fm_emit_sound")
	register_forward(FM_ClientKill,"fm_block_kill")
	register_forward(FM_SetClientKeyValue,"fm_block_mdl")
	register_forward(FM_ClientUserInfoChanged,"fm_check_user_model")
	
	register_think("info_scanner","scan_think")
	
	get_barrierent = find_ent_by_tname(-1,"barrier")
	
	if(!get_barrierent)
	{
		if(file_exists(mrs_file))
		{
			new data_file[128], get_map_name[64],get_barrier_ent[4], file, current_map[64]
			
			file = fopen(mrs_file,"rt")
			
			if(!file) return
			
			get_mapname(current_map,63)
			
			while(!feof(file))
			{
				fgets(file,data_file,127)
				
				if(!data_file[0]) continue
				
				parse(data_file, get_map_name,63, get_barrier_ent,3)
				
				if(equal(current_map,get_map_name))
				{
					get_barrierent = str_to_num(get_barrier_ent)
					
					log_amx("[VZBB] VZBB Map Repair System: Map found and loaded successfully!")
					
					break
				}
			}
			
			fclose(file)
		} else {
			log_amx("[VZBB] ERROR: File configs/vzbb_mod_mrs doesn't exist!")
			log_amx("[VZBB] VZBB Map Repair System won't work.")
		}
	}
	
	new ent_trgname[7],ent = -1
	while((ent = find_ent_by_class(ent,"func_wall")) != 0)
	{
		entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
		if(!equal(ent_trgname,"ignore") && ent != get_barrierent)
		{
			get_blocks[total_blocks] = ent
			
			entity_set_float(ent,EV_FL_fuser1,float(entity_get_int(ent,EV_INT_rendermode)))
			entity_set_float(ent,EV_FL_fuser2,entity_get_float(ent,EV_FL_renderamt))
			entity_set_vector(ent,EV_VEC_rendercolor,Float:{0.0,0.0,0.0})
			
			total_blocks++
		}
	}
	
	if(get_pcvar_num(cvar_fun)) log_amx("[VZBB] VZBB Fun Mode is active. Total Movable Blocks: %i",total_blocks)
	
	if(get_pcvar_num(cvar_push_remove)) remove_entity_name("trigger_push")
	if(get_pcvar_num(cvar_hurt_remove)) remove_entity_name("trigger_hurt")
	
	maxplayers = get_maxplayers()
	maxrounds = get_cvar_pointer("mp_maxrounds")
	
	bots_cvar = get_cvar_pointer("bot_quota")
	pointer_activity = get_cvar_pointer("amx_show_activity")
	
	sync = CreateHudSyncObj()
	sync2 = CreateHudSyncObj()
	sync3 = CreateHudSyncObj()
	sync4 = CreateHudSyncObj()
	
#if !defined SQL
	vault = nvault_open("vzbb_mod")
#else
	cvar_sql_host = register_cvar("vzbb_sql_host","localhost")
	cvar_sql_user = register_cvar("vzbb_sql_user","username")
	cvar_sql_pass = register_cvar("vzbb_sql_pass","password")
	cvar_sql_db = register_cvar("vzbb_sql_db","database")
	
	set_task(1.0,"mysql_connect")
#endif
}

#if defined SQL
public mysql_connect()
{
	new cvar_cache_str[4][128]
	
	get_pcvar_string(cvar_sql_host,cvar_cache_str[0],127)
	get_pcvar_string(cvar_sql_user,cvar_cache_str[1],127)
	get_pcvar_string(cvar_sql_pass,cvar_cache_str[2],127)
	get_pcvar_string(cvar_sql_db,cvar_cache_str[3],127)
	
	mysql_tuple = SQL_MakeDbTuple(cvar_cache_str[0],cvar_cache_str[1],cvar_cache_str[2],cvar_cache_str[3])
	
	new error, Handle:mysql_connection = SQL_Connect(mysql_tuple,error, str_error,511)
	
	if(mysql_connection == Empty_Handle) set_fail_state(str_error)
	
	new Handle:mysql_query
	
	mysql_query = SQL_PrepareQuery(mysql_connection,"CREATE TABLE IF NOT EXISTS vzbb_mod_userdata (userdata varchar(32),credits INT(10),isbanned INT(2),banreason varchar(128),unlocks varchar(50),upgrades_z varchar(4096),upgrades_h varchar(4096),ach_prog varchar(4096),ach_level varchar(4096))")
	
	if(!SQL_Execute(mysql_query))
	{
		SQL_QueryError(mysql_query, str_error,511)
		set_fail_state(str_error)
	}
	
	SQL_FreeHandle(mysql_query)
	SQL_FreeHandle(mysql_connection)
}
#endif

public plugin_natives()
{
	zombie_array = ArrayCreate(ZOMBIE_CLASS_DATA)
	shop_item_array = ArrayCreate(SHOP_ITEM_DATA)
	
	register_library("vzbb_mod")
	
	register_native("register_zombie_class","native_register_zombie_class")
	register_native("register_shop_item","native_register_shop_item")
	
	register_native("get_user_zombie_class","native_get_user_zombie_class")
	register_native("set_user_zombie_class","native_set_user_zombie_class")
	
	register_native("is_user_zombie","native_is_user_zombie")
	register_native("is_user_human","native_is_user_human")
	
	register_native("get_user_credits","native_get_user_credits")
	register_native("set_user_credits","native_set_user_credits")
	
	register_native("get_total_zombie_classes","native_get_total_zombie_classes")
	register_native("get_total_shop_items","native_get_total_shop_items")
	
	register_native("get_user_can_build_battle","native_get_user_can_bb")
	register_native("set_user_can_build_battle","native_set_user_can_bb")
	
	register_native("get_user_block_ent","native_get_user_block_ent")
	register_native("set_user_block_ent","native_set_user_block_ent")
	
	register_native("is_freezetime","native_is_freezetime")
	register_native("get_build_phase_remaining_time","native_get_bp_remaining_time")
	
	register_native("user_can_build","native_user_can_build")
	register_native("set_user_can_build","native_set_user_can_build")
	
	register_native("get_roundmode","native_get_roundmode")
	
	register_native("was_user_zombie","native_was_user_zombie")
	register_native("set_user_was_zombie","native_set_user_was_zombie")
	
	register_native("is_user_banned","native_is_user_banned")
	
	register_native("get_user_fire_duration","native_get_user_fire_duration")
	register_native("set_user_fire_duration","native_set_user_fire_duration")
	register_native("is_user_frozen","native_is_user_frozen")
	register_native("is_user_frozen_cool","native_is_user_frozen_cool")
	
	register_native("user_burn","native_user_burn")
	
	register_native("user_freeze","native_user_freeze")
	register_native("user_unfreeze","native_user_unfreeze")
	register_native("user_freeze_cool","native_user_freeze_cool")
	register_native("user_unfreeze_cool","native_user_unfreeze_cool")
	
	register_native("user_infect","native_user_infect")
	register_native("user_uninfect","native_user_uninfect")
	
	register_native("get_block_fun_type","native_get_block_fun_type")
	register_native("set_block_fun_type","native_set_block_fun_type")
	register_native("reset_block_fun_type","native_reset_block_fun_type")
	
	register_native("get_deal_discount","native_get_deal_discount")
	register_native("is_deal_offer","native_is_deal_offer")
	
	register_native("hide_barrierent","native_hide_barrierent")
	register_native("reset_barrierent","native_reset_barrierent")
	
	register_native("set_hud_cache_text","native_set_hud_cache_text")
	register_native("set_hud_cache_colors","native_set_hud_cache_colors")
	register_native("set_hud_cache_condition","native_set_hud_cache_condition")
	
	register_native("force_user_hud_data","native_force_user_hud_data")
	register_native("force_weapon_menu","native_force_weapon_menu")
	
	register_native("restore_user_rendering","native_restore_user_rendering")
}

public native_register_zombie_class(plugin,params)
{
	static get_zombie_data[ZOMBIE_CLASS_DATA], cache_mdl_str[128],cache_clawmdl_str[128]
	
	get_string(1, get_zombie_data[ZOMBIE_NAME],31)
	get_string(2, get_zombie_data[ZOMBIE_INFO],31)
	get_string(3, get_zombie_data[ZOMBIE_MDL],127)
	get_string(4, get_zombie_data[ZOMBIE_CLAWMDL],127)
	get_zombie_data[ZOMBIE_HEALTH] = get_param(5)
	get_zombie_data[ZOMBIE_GRAVITY] = get_param(6)
	get_zombie_data[ZOMBIE_SPEED] = get_param(7)
	get_zombie_data[ZOMBIE_ACCESS] = get_param(8)
	
	formatex(cache_mdl_str,127,"models/player/%s/%s.mdl",get_zombie_data[ZOMBIE_MDL],get_zombie_data[ZOMBIE_MDL])
	formatex(cache_clawmdl_str,127,"models/%s.mdl",get_zombie_data[ZOMBIE_CLAWMDL])
	
	precache_model(cache_mdl_str)
	precache_model(cache_clawmdl_str)
	
	ArrayPushArray(zombie_array,get_zombie_data)
	
	total_zombie_classes++
	
	return total_zombie_classes - 1
}

public native_register_shop_item(plugin,params)
{
	static get_item_data[SHOP_ITEM_DATA]
	
	get_string(1, get_item_data[ITEM_NAME],31)
	get_item_data[ITEM_COST] = get_param(2)
	get_item_data[ITEM_USE] = get_param(3)
	get_item_data[ITEM_TEAM] = get_param(4)
	get_item_data[ITEM_ACCESS] = get_param(5)
	get_item_data[ITEM_MAX] = get_param(6)
	// get_item_data[ITEM_MAX_PRIVATE] - private!
	
	ArrayPushArray(shop_item_array,get_item_data)
	
	total_shop_items++
	
	return total_shop_items - 1
}

public native_get_user_zombie_class(plugin,params) return user_class[get_param(1)]
public native_set_user_zombie_class(plugin,params)
{
	static id
	id = get_param(1)
	
	user_class[id] = get_param(2)
	
	if(id == -1)
	{
		set_user_health(id,get_pcvar_num(cvar_zombie_classic_hp))
		set_user_gravity(id,get_pcvar_float(cvar_zombie_classic_grav))
		set_task(0.5 + ((id * 0.2)),"update_user_model",id)
		
		formatex(get_zclass_clawmdl[id],127,"models/%s.mdl",zclassic_clawmdl_str)
		get_user_speed[id] = get_pcvar_float(cvar_zombie_classic_speed)
		
		entity_set_string(id,EV_SZ_viewmodel,get_zclass_clawmdl[id])
		
		ColorChat(id,GREEN,"[VZBB]^x01 You have selected^x04 Classic Zombie^x01.")
	} else {
		static get_zombie_data[ZOMBIE_CLASS_DATA]
		
		ArrayGetArray(zombie_array,user_class[id],get_zombie_data)
		
		set_user_health(id,get_zombie_data[ZOMBIE_HEALTH])
		set_user_gravity(id,get_zombie_data[ZOMBIE_GRAVITY])
		set_task(0.5 + ((id * 0.2)),"update_user_model",id)
		
		formatex(get_zclass_clawmdl[id],127,"models/%s.mdl",get_zombie_data[ZOMBIE_CLAWMDL])
		get_user_speed[id] = get_zombie_data[ZOMBIE_SPEED]
		
		entity_set_string(id,EV_SZ_viewmodel,get_zclass_clawmdl[id])
		
		ColorChat(id,GREEN,"[VZBB]^x01 You have selected^x04 %s^x01.",get_zombie_data[ZOMBIE_NAME])
		if(!get_pcvar_num(cvar_zclass_nr_select)) ColorChat(id,GREEN,"[VZBB]^x01 Type ^x04/class^x01 in the chat to change your zombie class.")
		
		ExecuteForward(fwd_zombie_class_selected,fwd_return,id,user_class[id])
	}
	
	ExecuteHamB(Ham_Item_PreFrame,id)
}

public native_is_user_zombie(plugin,params) return user_race[get_param(1)] == 1
public native_is_user_human(plugin,params) return user_race[get_param(1)] == 2

public native_get_user_credits(plugin,params) return user_credits[get_param(1)]
public native_set_user_credits(plugin,params) user_credits[get_param(1)] = get_param(2)

public native_get_total_zombie_classes(plugin,params) return total_zombie_classes
public native_get_total_shop_items(plugin,params) return total_shop_items

public native_get_user_can_bb(plugin,params) return user_build_battle[get_param(1)]
public native_set_user_can_bb(plugin,params) user_build_battle[get_param(1)] = get_param(2)

public native_get_user_block_ent(plugin,params) return user_blockent[get_param(1)]
public native_set_user_block_ent(plugin,params) user_blockent[get_param(1)] = get_param(2)

public native_is_freezetime(plugin,params) return freezetime
public native_get_bp_remaining_time(plugin,params) return count_build_time

public native_user_can_build(plugin,params) return can_build
public native_set_user_can_build(plugin,params) can_build = get_param(1)

public native_get_roundmode(plugin,params) return round_mode

public native_was_user_zombie(plugin,params) return was_zombie[get_param(1)]
public native_set_user_was_zombie(plugin_params) was_zombie[get_param(1)] = get_param(2)

public native_is_user_banned(plugin,params) return is_banned[get_param(1)]

public native_get_user_fire_duration(plugin,params) return user_fire_dur[get_param(1)]
public native_set_user_fire_duration(plugin,params) return user_fire_dur[get_param(1)] = get_param(2)

public native_is_user_frozen(plugin,params) return user_frost[get_param(1)]
public native_is_user_frozen_cool(plugin,params) return user_frost_cool[get_param(1)]

public native_user_burn(plugin,params)
{
	remove_task(get_param(2) + TASK_BURN)
	user_fire_atk[get_param(2)] = get_param(1)
	user_fire_dur[get_param(2)] += (get_param(3)) ? get_param(3) : get_pcvar_num(cvar_nade_fire_dur)
	
	set_task(0.1,"start_burn",get_param(2) + TASK_BURN)
}

public native_user_freeze(plugin,params)
{
	remove_task(get_param(1) + TASK_FREEZE)
	set_task(0.1,"start_freeze",get_param(1) + TASK_FREEZE)
}

public native_user_unfreeze(plugin,params) set_task(0.1,"stop_freeze",get_param(1) + TASK_FREEZE)
public native_user_unfreeze_cool(plugin,params) set_task(0.1,"stop_freeze_cool",get_param(1) + TASK_FREEZE_COOL)

public native_user_freeze_cool(plugin,params)
{
	remove_task(get_param(1) + TASK_FREEZE_COOL)
	set_task(0.1,"start_freeze_cool",get_param(1) + TASK_FREEZE_COOL)
}

public native_user_infect(plugin,params) user_infect(get_param(1),get_param(2))
public native_user_uninfect(plugin,params)
{
	static id
	id = get_param(1)
	
	ExecuteForward(fwd_user_uninfect_pre,fwd_return,id)
	
	if(fwd_return >= FORWARD_CONTINUE) return
	
	cs_set_user_team(id,CS_TEAM_CT)
	
	set_user_health(id,100)
	set_user_armor(id,0)
	set_user_gravity(id,1.0)
	
	spawn_data(get_param(1),0)
	
	ExecuteForward(fwd_user_uninfect_post,fwd_return,id)
}

public native_get_block_fun_type(plugin,params) return floatround(entity_get_float(get_param(1),EV_FL_fuser3))
public native_set_block_fun_type(plugin,params)
{
	static ent,type
	
	ent = get_param(1)
	type = get_param(2)
	
	entity_set_float(ent,EV_FL_fuser3,float(type))
	
	entity_set_int(ent,EV_INT_rendermode,1)
	entity_set_float(ent,EV_FL_renderamt,255.0)
	entity_set_vector(ent,EV_VEC_rendercolor,fun_blocks_colors[type])
}

public native_reset_block_fun_type(plugin,params)
{
	static ent
	
	ent = get_param(1)
	
	entity_set_float(ent,EV_FL_fuser3,0.0)
	
	entity_set_int(ent,EV_INT_rendermode,floatround(entity_get_float(ent,EV_FL_fuser1)))
	entity_set_float(ent,EV_FL_renderamt,entity_get_float(ent,EV_FL_fuser2))
	entity_set_vector(ent,EV_VEC_rendercolor,Float:{0.0,0.0,0.0})
}

public native_get_deal_discount(plugins,params) return round_deal_discount
public native_is_deal_offer(plugins,params) return round_deal_items & (1<<get_param(1))

public native_hide_barrierent(plugin,params) if(get_barrierent) entity_set_origin(get_barrierent,Float:{-8192.0,-8192.0,-8192.0})
public native_reset_barrierent(plugin,params) if(get_barrierent) entity_set_origin(get_barrierent,Float:{0.0,0.0,0.0})

public native_set_hud_cache_text(plugin,params) get_string(1,hud_cache_text,127)
public native_set_hud_cache_colors(plugin,params)
{
	hud_cache_colors[0] = get_param(1)
	hud_cache_colors[1] = get_param(2)
	hud_cache_colors[2] = get_param(3)
}
public native_set_hud_cache_condition(plugin,params) hud_cache_condition = bool:get_param(1)

public native_force_user_hud_data(plugin,params) show_user_hud_data()
public native_force_weapon_menu(plugin,params) show_weapon_menu(get_param(1))

public native_restore_user_rendering(plugin,params)
{
	static id
	id = get_param(1)
	
	set_user_rendering(id,kRenderFxGlowShell, 0,0,0, kRenderTransAlpha, (255 - (get_pcvar_num(cvar_upgrade[user_race[id]][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][user_race[id]][UPGRADE_INVISIBILITY])) < 0 ? 0 : 255 - (get_pcvar_num(cvar_upgrade[user_race[id]][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][user_race[id]][UPGRADE_INVISIBILITY]))
}

public event_hltv()
{
	static i, get_item_data[SHOP_ITEM_DATA]
	for(i=0;i<total_shop_items;i++)
	{
		ArrayGetArray(shop_item_array,i,get_item_data)
		
		if(!get_item_data[ITEM_MAX] || !get_item_data[ITEM_MAX_PRIVATE]) continue
		
		get_item_data[ITEM_MAX_PRIVATE] = 0
		
		ArraySetArray(shop_item_array,i,get_item_data)
	}
	
	remove_task(TASK_BUILD_TIME_COUNTER)
	remove_task(TASK_USER_HUD_DATA)
	
	if(get_pcvar_num(cvar_nade_scan)) remove_entity_name("info_scanner")
	
	can_build = true
	
	entity_set_origin(get_barrierent,Float:{0.0,0.0,0.0})
	entity_set_int(get_barrierent,EV_INT_rendermode,2)
	entity_set_float(get_barrierent,EV_FL_renderamt,get_pcvar_float(cvar_barrier_alpha))
	
	static ent_trgname[7],ent
	ent = -1
	while((ent = find_ent_by_class(ent,"func_wall")) != 0)
	{
		entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
		if(!equal(ent_trgname,"ignore") && ent != get_barrierent && !entity_get_int(ent,EV_INT_iuser1))
		{
			if(get_pcvar_num(cvar_block_nr_reset)) entity_set_origin(ent,Float:{0.0,0.0,0.0})
			entity_set_int(ent,EV_INT_iuser3,0)
			entity_set_int(ent,EV_INT_iuser4,0)
			entity_set_float(ent,EV_FL_fuser3,0.0)
			
			entity_set_int(ent,EV_INT_rendermode,floatround(entity_get_float(ent,EV_FL_fuser1)))
			entity_set_float(ent,EV_FL_renderamt,entity_get_float(ent,EV_FL_fuser2))
			entity_set_vector(ent,EV_VEC_rendercolor,Float:{0.0,0.0,0.0})
		}
	}
	
	if(get_pcvar_num(cvar_fun))
	{
		static ii, random_block
		
		for(i=1;i<MAX_BLOCKTYPES;i++)
		{
			for(ii=0;ii<get_pcvar_num(cvar_fun_blocks_num[i]);ii++)
			{
				while(!is_valid_ent(get_blocks[random_block]) || entity_get_float(get_blocks[random_block],EV_FL_fuser3)) random_block = random_num(1,total_blocks)
				
				entity_set_float(get_blocks[random_block],EV_FL_fuser3,float(i))
				
				entity_set_int(get_blocks[random_block],EV_INT_rendermode,1)
				entity_set_float(get_blocks[random_block],EV_FL_renderamt,255.0)
				entity_set_vector(get_blocks[random_block],EV_VEC_rendercolor,fun_blocks_colors[i])
			}
		}
	}
	
	static id
	for(id=1;id<=maxplayers;id++)
	{
		if(!is_user_connected(id)) continue
		
		user_block_claims[id] = 0
	}
	
	count_build_time = get_pcvar_num(cvar_build_time)
	start_build_time_counter()
	
	if(get_pcvar_num(cvar_round_deal) && total_shop_items)
	{
		round_deal_items = 0
		
		if(random_num(get_pcvar_num(cvar_round_deal_chance),100) == 100)
		{
			static get_random,get_random_item, i
			
			get_random = random_num(get_pcvar_num(cvar_round_deal_min_items),min(total_shop_items,get_pcvar_num(cvar_round_deal_max_items)))
			
			for(i=0;i<get_random;i++)
			{
				do {get_random_item = random_num(0,total_shop_items);} while(round_deal_items & (1<<get_random_item))
				
				round_deal_items |= (1<<get_random_item)
			}
			
			round_deal_discount = random_num(get_pcvar_num(cvar_round_deal_min_discount),get_pcvar_num(cvar_round_deal_max_discount))
			
			ColorChat(0,GREEN,"[VZBB]^x01 There is a^x04 Round Deal^x01 with^x04 %i^x01 offer%s and^x04 %i^x01 credit%s discount this round. Type^x04 /deal^x01 to see the offer%s.",get_random,(get_random == 1) ? "" : "s",round_deal_discount,\
			(round_deal_discount == 1) ? "" : "s",(get_random == 1) ? "" : "s")
		} else {
			ColorChat(0,GREEN,"[VZBB]^x01 No^x04 Round Deal^x01 offers this round.")
		}
	}
}

public start_build_time_counter()
{
	if(count_build_time > 0)
	{
		set_hudmessage(random(255), random(255), random(255), -1.0, 0.03, count_build_time < 11 ? 1 : 0, 6.0, 1.0, 0.1, 0.2, -1)
		ShowSyncHudMsg(0,sync, ".: Build Time :.^n%i minute%s %i second%s",count_build_time / 60,(count_build_time / 60) == 1 ? "" : "s", count_build_time % 60,(count_build_time % 60) == 1 ? "" : "s")
		
		if(count_build_time < 11)
		{
			static word[6]
			num_to_word(count_build_time,word,5)
			
			client_cmd(0,"spk ^"%s^"",word)
		}
		
		set_task(1.0,"start_build_time_counter",TASK_BUILD_TIME_COUNTER)
	} else {
		set_hudmessage(255, 0, 0, -1.0, 0.03, 0, 6.0, 1.0, 0.1, 0.2, -1)
		ShowSyncHudMsg(0,sync, ".: !!! THE BATTLE HAS STARTED !!! :.")
		
		can_build = false
		
		entity_set_origin(get_barrierent,Float:{-8192.0,-8192.0,-8192.0})
		
		static id
		for(id=1;id<=maxplayers;id++)
		{
			if(!is_user_connected(id) || !is_user_alive(id)) continue
			
			if(user_blockent[id] && is_valid_ent(user_blockent[id])) release_block(id)
			if(user_race[id] == 2) show_weapon_menu(id)
			
			user_build_battle[id] = false
		}
		
		if(get_pcvar_num(cvar_mode) == 2)
		{
			round_mode = (random(8) < 4) ? 0 : 1
		} else {
			round_mode = get_pcvar_num(cvar_mode)
		}
		
		ExecuteForward(fwd_battle_phase_begin,fwd_return)
	}
	
	count_build_time--
	
	show_user_hud_data()
}

public show_user_hud_data()
{
	formatex(hud_cache_text,127,".: Current Mode : %s :.",round_mode == 0 ? "Kill Mode" : "Infection Mode")
	
	hud_cache_colors[0] = 255
	hud_cache_colors[1] = (round_mode == 0) ? 255 : 0
	hud_cache_colors[2] = 0
	
	hud_cache_condition = (!can_build && get_pcvar_num(cvar_mode) == 2)
	
	ExecuteForward(fwd_update_user_hud_data,fwd_return)
	
	if(hud_cache_condition)
	{
		set_hudmessage(hud_cache_colors[0], hud_cache_colors[1], hud_cache_colors[2], -1.0, 0.03, 0, 6.0, 1.0, 0.1, 0.2, -1)
		ShowSyncHudMsg(0,sync, hud_cache_text)
	}
	
	if(fwd_return >= FORWARD_CONTINUE)
	{
		remove_task(TASK_USER_HUD_DATA)
		
		set_task(1.0,"show_user_hud_data",TASK_USER_HUD_DATA)
		
		return
	}
	
	static id
	for(id=1;id<=maxplayers;id++)
	{
		if(!is_user_connected(id) || !is_user_alive(id)) continue
		
		cs_set_user_money(id,0)
		
		if(!can_build && user_race[id] == 2)
		{
			user_played_seconds[id]++
			
			if(user_played_seconds[id] == 60)
			{
				user_played_seconds[id] = 0
				check_achievement(id,ACH_SURVIVOR,0)
			}
		}
		
		set_hudmessage(255, 255, 255, 0.01, 0.93, 0, 6.0, 1.0, 0.1, 0.2, -1)
		
		if(get_pcvar_num(cvar_fun))
		{
			static ent, ent_trgname[7],ent_classname[10]
			
			ent = entity_get_edict(id,EV_ENT_groundentity)
			
			if(ent != get_barrierent && ent > maxplayers && is_valid_ent(ent))
			{
				entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
				entity_get_string(ent,EV_SZ_classname,ent_classname,9)
				
				if(!equal(ent_trgname,"ignore") && equal(ent_classname,"func_wall"))
				{
					static type
					type = floatround(entity_get_float(ent,EV_FL_fuser3))
					
					ExecuteForward(fwd_fun_block_touch_pre,fwd_return,id,ent,type)
					
					if(fwd_return < FORWARD_CONTINUE)
					{
						switch(type)
						{
							case BLOCKS_RED:
							{	
								if(!user_fire_dur[id])
								{
									user_fire_atk[id] = 0
									user_fire_dur[id] = 3
									
									set_task(0.1,"start_burn",id + TASK_BURN)
								}
								
								user_block_frost[id] = false
							}
							case BLOCKS_BLUE: user_block_frost[id] = true
							case BLOCKS_GREEN:
							{
								if(user_race[id] == 1)
								{
									static get_zombie_data[ZOMBIE_CLASS_DATA]
									
									if(user_class[id] == -1)
									{
										get_zombie_data[ZOMBIE_HEALTH] = get_pcvar_num(cvar_zombie_classic_hp)
									} else {
										ArrayGetArray(zombie_array,user_class[id],get_zombie_data)
									}
									
									get_zombie_data[ZOMBIE_HEALTH] += (get_pcvar_num(cvar_upgrade[1][UPGRADE_HEALTH]) * user_upgrade_level[id][1][UPGRADE_HEALTH])
									
									if(get_user_health(id) < get_zombie_data[ZOMBIE_HEALTH])
									{
										set_user_health(id,get_user_health(id) + 1)
									}
								} else {
									if(get_user_health(id) < (100 + (get_pcvar_num(cvar_upgrade[2][UPGRADE_HEALTH]) * user_upgrade_level[id][2][UPGRADE_HEALTH])))
									{
										set_user_health(id,get_user_health(id) + 1)
									}
								}
							}
							default: user_block_frost[id] = false
						}
						
						ExecuteForward(fwd_fun_block_touch_post,fwd_return,id,ent,type)
					} else {
						user_block_frost[id] = false
					}
				} else {
					user_block_frost[id] = false
				}
			} else {
				user_block_frost[id] = false
			}
			
			ExecuteHamB(Ham_Item_PreFrame,id)
		}
		
		if(user_race[id] == 1)
		{
			ShowSyncHudMsg(id,sync2, "Health: %i | Credits: %i",get_user_health(id),user_credits[id])
			
			if(user_upgrade_level[id][1][UPGRADE_REGENERATION])
			{
				static get_zombie_data[ZOMBIE_CLASS_DATA]
				
				if(user_class[id] == -1)
				{
					get_zombie_data[ZOMBIE_HEALTH] = get_pcvar_num(cvar_zombie_classic_hp)
				} else {
					ArrayGetArray(zombie_array,user_class[id],get_zombie_data)
				}
				
				get_zombie_data[ZOMBIE_HEALTH] += (get_pcvar_num(cvar_upgrade[1][UPGRADE_HEALTH]) * user_upgrade_level[id][1][UPGRADE_HEALTH])
				
				if(get_user_health(id) < get_zombie_data[ZOMBIE_HEALTH])
				{
					set_user_health(id,get_user_health(id) + (get_pcvar_num(cvar_upgrade[1][UPGRADE_REGENERATION]) * user_upgrade_level[id][1][UPGRADE_REGENERATION]))
					if(get_user_health(id) > get_zombie_data[ZOMBIE_HEALTH]) set_user_health(id,get_zombie_data[ZOMBIE_HEALTH])
				}
			}
			
			if(!is_user_admin(id)) continue
		} else {
			ShowSyncHudMsg(id,sync2, "Health: %i | Armor: %i | Credits: %i",get_user_health(id),get_user_armor(id),user_credits[id])
			
			if(can_build && get_user_health(id) < (100 + (get_pcvar_num(cvar_upgrade[2][UPGRADE_HEALTH]) * user_upgrade_level[id][2][UPGRADE_HEALTH])))
			{
				set_user_health(id,100 + (get_pcvar_num(cvar_upgrade[2][UPGRADE_HEALTH]) * user_upgrade_level[id][2][UPGRADE_HEALTH]))
			}
		}
		
		static ent,body
		get_user_aiming(id,ent,body)
		
		if(ent == get_barrierent || ent <= maxplayers || !is_valid_ent(ent)) continue
		
		static ent_trgname[7],ent_classname[10]
		
		entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
		entity_get_string(ent,EV_SZ_classname,ent_classname,9)
		
		if(equal(ent_trgname,"ignore") || !equal(ent_classname,"func_wall")) continue
		
		if(is_banned[id])
		{
			set_hudmessage(255, 0, 0, -1.0, 0.38, 1, 6.0, 1.0, 0.1, 0.2, -1)
			ShowSyncHudMsg(id,sync3, "Your block moving is banned!^nReason: %s",user_banreason[id])
			
			continue
		}
		
		if(entity_get_int(ent,EV_INT_iuser1))
		{
			set_hudmessage(255, 0, 0, -1.0, 0.38, 1, 6.0, 1.0, 0.1, 0.2, -1)
			ShowSyncHudMsg(id,sync3, "This block is locked by an admin!")
			
			continue
		}
		
		if(get_pcvar_num(cvar_block_claim))
		{
			if(entity_get_int(ent,EV_INT_iuser2)) continue
			
			if(entity_get_int(ent,EV_INT_iuser3))
			{
				if(is_user_connected(entity_get_int(ent,EV_INT_iuser3)))
				{
					static name[32]
					get_user_name(entity_get_int(ent,EV_INT_iuser3),name,31)
					
					set_hudmessage(0, 255, 255, -1.0, 0.38, 0, 6.0, 1.0, 0.1, 0.2, -1)
					
					if(!get_pcvar_num(cvar_fun))
					{
						ShowSyncHudMsg(id,sync3, "Claimed by %s",name)
					} else {
						ShowSyncHudMsg(id,sync3, "%s^nClaimed by %s",fun_blocks_names[floatround(entity_get_float(ent,EV_FL_fuser3))],name)
					}
				} else {
					entity_set_int(ent,EV_INT_iuser3,0)
					
					set_hudmessage(0, 255, 255, -1.0, 0.38, 0, 6.0, 1.0, 0.1, 0.2, -1)
					
					if(!get_pcvar_num(cvar_fun))
					{
						ShowSyncHudMsg(id,sync3, "This block hasn't been claimed")
					} else {
						ShowSyncHudMsg(id,sync3, "%s^nThis block hasn't been claimed",fun_blocks_names[floatround(entity_get_float(ent,EV_FL_fuser3))])
					}
				}
			} else {
				set_hudmessage(0, 255, 255, -1.0, 0.38, 0, 6.0, 1.0, 0.1, 0.2, -1)
				
				if(!get_pcvar_num(cvar_fun))
				{
					ShowSyncHudMsg(id,sync3, "This block hasn't been claimed")
				} else {
					ShowSyncHudMsg(id,sync3, "%s^nThis block hasn't been claimed",fun_blocks_names[floatround(entity_get_float(ent,EV_FL_fuser3))])
				}
			}
		}
	}
	
	if(!can_build) set_task(1.0,"show_user_hud_data",TASK_USER_HUD_DATA)
}

public round_end()
{
	static Float:last_end,Float:get__time
	get__time = get_gametime()
	
	if((get__time - last_end) < 0.5) return
	
	last_end = get__time
	
	h_lose = true
	
	if(total_rounds > 1)
	{
		static id
		for(id=1;id<=maxplayers;id++)
		{
			if(!is_user_connected(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED) continue
			
			if(is_user_alive(id) && user_race[id] == 2) h_lose = false
			
			cs_set_user_team(id,was_zombie[id] ? CS_TEAM_CT : CS_TEAM_T)
		}
	}
	
	set_task(0.01,"show_round_end_info")
	
	freezetime = true
}

public show_round_end_info()
{
	client_print(0,print_center,"%s win!",h_lose ? "Zombies" : "Humans")
	
	static random_sound
	if(h_lose)
	{
		random_sound = random(sizeof sound_zombies_win)
		
		if(!equal(sound_zombies_win[random_sound][strlen(sound_zombies_win[random_sound]) - 4],".mp3"))
		{
			client_cmd(0,"spk ^"%s^"",sound_zombies_win[random_sound])
		} else {
			client_cmd(0,"mp3 play ^"sound/%s^"",sound_zombies_win[random_sound])
		}
	} else {
		random_sound = random(sizeof sound_humans_win)
		
		if(!equal(sound_humans_win[random_sound][strlen(sound_humans_win[random_sound]) - 4],".mp3"))
		{
			client_cmd(0,"spk ^"%s^"",sound_humans_win[random_sound])
		} else {
			client_cmd(0,"mp3 play ^"sound/%s^"",sound_humans_win[random_sound])
		}
	}
	
	if(get_playersnum() < get_pcvar_num(cvar_credits_win_min_players)) return
	
	if(get_pcvar_num(cvar_credits_h_win))
	{
		if(!h_lose)
		{
			static id
			for(id=1;id<=maxplayers;id++)
			{
				if(!is_user_connected(id) || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T) continue
				
				user_credits[id] += get_pcvar_num(cvar_credits_h_win)
			}
		}
	}
}

public round_start()
{
	total_rounds++
	
	freezetime = false
}

public event_textmsg() total_rounds = 1

public message_health(msgid,msgdest,entid) if(get_msg_arg_int(1) > 255) set_msg_arg_int(1,0,255)

public message_sendaudio(msgid,msgdest,entid)
{
	static sendaudio_str[17]
	get_msg_arg_string(2,sendaudio_str,16)
	
	if(equal(sendaudio_str[7], "terwin") || equal(sendaudio_str[7], "ctwin") || equal(sendaudio_str[7], "rounddraw")) return PLUGIN_HANDLED
	
	return PLUGIN_CONTINUE
}

public message_scoreattrib(msgid,msgdest,entid) if(get_msg_arg_int(2) & 2) set_msg_arg_int(2,0,0)

public hook_death()
{
	static killer,victim, hs, weapon[2]
	killer = read_data(1)
	victim = read_data(2)
	hs = read_data(3)
	read_data(4,weapon,1)
	
	if((can_build && user_race[victim] == 2) || user_race[victim] == 1) set_task(get_pcvar_float(cvar_respawn_time),"respawn",victim)
	
	if(user_race[killer] == user_race[victim] || !is_user_connected(killer) || !is_user_connected(victim)) return
	
	switch(user_race[killer])
	{
		case 1:
		{
			user_credits[killer] += (hs) ? get_pcvar_num(cvar_credits_hkillhs) : get_pcvar_num(cvar_credits_hkill)
			check_achievement(killer,ACH_BLOODPARTY,0)
			
			if(get_playersnum() < get_pcvar_num(cvar_credits_win_min_players)) return
			
			static players[32],num
			get_players(players,num,"ae","CT")
			if(!num) user_credits[killer] += get_pcvar_num(cvar_credits_z_win)
		}
		case 2:
		{
			user_credits[killer] += (hs) ? get_pcvar_num(cvar_credits_zkillhs) : get_pcvar_num(cvar_credits_zkill)
			check_achievement(killer,ACH_GENOCIDE,0)
			
			if(weapon[0] == 'k') check_achievement(killer,ACH_HUMILIATION,0)
		}
	}
}

public respawn(id)
{
	if(is_user_alive(id) || !is_user_connected(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED) return
	
	ExecuteHamB(Ham_CS_RoundRespawn,id)
	
	if(!can_build && user_race[id] == 1) check_achievement(id,ACH_UNDEAD,0)
}

public event_curweapon(id)
{
	static weapon
	weapon = read_data(2)
	
	switch(user_race[id])
	{
		case 1:
		{
			if(weapon == CSW_KNIFE)
			{
				entity_set_string(id,EV_SZ_viewmodel,get_zclass_clawmdl[id])
				entity_set_string(id,EV_SZ_weaponmodel,"")
			} else {
				engclient_cmd(id,"weapon_knife")
			}
		}
		case 2:
		{
			if(weapon == CSW_C4 || weapon == CSW_HEGRENADE || weapon == CSW_SMOKEGRENADE || weapon == CSW_FLASHBANG || weapon == CSW_KNIFE) return
			cs_set_user_bpammo(id,weapon,254)
		}
	}
}

public weapon_remove(ent)
{
	if(!is_valid_ent(ent) || !get_pcvar_num(cvar_block_wpn_drop)) return HAM_IGNORED
	
	entity_set_int(ent,EV_INT_effects,entity_get_int(ent,EV_INT_effects) | EF_NODRAW)
	
	return HAM_SUPERCEDE
}

public player_spawn(id)
{
	if(!is_user_alive(id)) return
	
	spawn_data(id,1)
}

public spawn_data(id,is_spawn)
{
	if(!is_user_connected(id)) return
	
	user_frost[id] = false
	user_frost_cool[id] = false
	user_fire_dur[id] = 0
	
	formatex(get_zclass_clawmdl[id],127,"models/%s.mdl",zclassic_clawmdl_str)
	get_user_speed[id] = 0.0
	
	remove_task(id + TASK_BURN)
	remove_task(id + TASK_FREEZE)
	remove_task(id + TASK_BRESPAWN_REUSE)
	remove_task(id + TASK_FREEZE_COOL)
	remove_task(id + TASK_ZCLASS_SELECT)
	
	can_bc_respawn[id] = true
	
	can_select_zclass[id] = true
	selected_weapons[id] = false
	
	set_user_rendering(id)
	set_user_armor(id,0)
	
	strip_user_weapons(id)
	give_item(id,"weapon_knife")
	
	message_begin(MSG_ONE,msg_hideweapon,{0,0,0},id)
	write_byte(1<<5)
	message_end()
	
	switch(cs_get_user_team(id))
	{
		case CS_TEAM_T:
		{
			user_race[id] = 1
			if(is_spawn) was_zombie[id] = true
			
			if(get_pcvar_num(cvar_zclass_nr_select)) must_change_zclass[id] = true
			
			if(user_class[id] == -1)
			{
				set_user_health(id,get_pcvar_num(cvar_zombie_classic_hp))
				set_user_gravity(id,get_pcvar_float(cvar_zombie_classic_grav))
				set_task(0.5 + ((id * 0.2)),"update_user_model",id)
				
				formatex(get_zclass_clawmdl[id],127,"models/%s.mdl",zclassic_clawmdl_str)
				get_user_speed[id] = get_pcvar_float(cvar_zombie_classic_speed)
				
				entity_set_string(id,EV_SZ_viewmodel,get_zclass_clawmdl[id])
			} else {
				static get_zombie_data[ZOMBIE_CLASS_DATA]
				
				ArrayGetArray(zombie_array,user_class[id],get_zombie_data)
				
				set_user_health(id,get_zombie_data[ZOMBIE_HEALTH])
				set_user_gravity(id,get_zombie_data[ZOMBIE_GRAVITY])
				set_task(0.5 + ((id * 0.2)),"update_user_model",id)
					
				formatex(get_zclass_clawmdl[id],127,"models/%s.mdl",get_zombie_data[ZOMBIE_CLAWMDL])
				get_user_speed[id] = get_zombie_data[ZOMBIE_SPEED]
				
				entity_set_string(id,EV_SZ_viewmodel,get_zclass_clawmdl[id])
				
				ExecuteForward(fwd_zombie_class_selected,fwd_return,id,user_class[id])
			}
			
			if(must_change_zclass[id]) show_zclass_menu(id)
			
			set_user_health(id,get_user_health(id) + (get_pcvar_num(cvar_upgrade[1][UPGRADE_HEALTH]) * user_upgrade_level[id][1][UPGRADE_HEALTH]))
			
			set_user_gravity(id,get_user_gravity(id) - (get_pcvar_float(cvar_upgrade[1][UPGRADE_GRAVITY]) * user_upgrade_level[id][1][UPGRADE_GRAVITY]))
			if(get_user_gravity(id) < 0.1) set_user_gravity(id, 0.1)
			
			set_user_rendering(id,kRenderFxGlowShell, 0,0,0, kRenderTransAlpha, (255 - (get_pcvar_num(cvar_upgrade[1][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][1][UPGRADE_INVISIBILITY])) < 0 ? 0 : 255 - (get_pcvar_num(cvar_upgrade[1][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][1][UPGRADE_INVISIBILITY]))
			
			if(get_user_speed[id] == 0.0) get_user_speed[id] = 240.0
			get_user_speed[id] += (get_pcvar_float(cvar_upgrade[1][UPGRADE_SPEED]) * user_upgrade_level[id][1][UPGRADE_SPEED])
		}
		case CS_TEAM_CT:
		{
			user_race[id] = 2
			if(is_spawn) was_zombie[id] = false
			
			set_task(0.5 + ((id * 0.2)),"update_user_model",id)
			
			show_weapon_menu(id)
			
			set_user_health(id,get_user_health(id) + (get_pcvar_num(cvar_upgrade[2][UPGRADE_HEALTH]) * user_upgrade_level[id][2][UPGRADE_HEALTH]))
			set_user_armor(id,get_user_armor(id) + (get_pcvar_num(cvar_upgrade[2][UPGRADE_ARMOR]) * user_upgrade_level[id][2][UPGRADE_ARMOR]))
			
			set_user_gravity(id,get_user_gravity(id) - (get_pcvar_float(cvar_upgrade[2][UPGRADE_GRAVITY]) * user_upgrade_level[id][2][UPGRADE_GRAVITY]))
			if(get_user_gravity(id) < 0.1) set_user_gravity(id, 0.1)
			
			set_user_rendering(id,kRenderFxGlowShell, 0,0,0, kRenderTransAlpha, (255 - (get_pcvar_num(cvar_upgrade[2][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][2][UPGRADE_INVISIBILITY])) < 0 ? 0 : 255 - (get_pcvar_num(cvar_upgrade[2][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][2][UPGRADE_INVISIBILITY]))
			
			if(get_user_speed[id] == 0.0) get_user_speed[id] = 240.0
			get_user_speed[id] += (get_pcvar_float(cvar_upgrade[2][UPGRADE_SPEED]) * user_upgrade_level[id][2][UPGRADE_SPEED])
		}
	}
	
	ExecuteHamB(Ham_Item_PreFrame,id)
}

public update_user_model(id)
{
	if(!is_user_connected(id)) return
	
	switch(user_race[id])
	{
		case 1:
		{
			if(user_class[id] == -1)
			{
				set_user_info(id,"model",zclassic_mdl_str)
			} else {
				static get_zombie_data[ZOMBIE_CLASS_DATA]
				
				ArrayGetArray(zombie_array,user_class[id],get_zombie_data)
				
				set_user_info(id,"model",get_zombie_data[ZOMBIE_MDL])
			}
		}
		case 2:
		{
			if (get_user_flags(id) & VIP_SKIN_FLAG)
			{
				set_user_info(id, "model", VIP_SKIN)
			}
			else
			{
				set_user_info(id,"model",human_models[random(sizeof human_models)])
			}
		}
	}
}

public player_take_damage(victim,inflictor,attacker,Float:damage,damage_bits)
{
	if(!is_user_connected(victim) || !is_user_connected(attacker)) return HAM_IGNORED
	
	if(freezetime || can_build) return HAM_SUPERCEDE
	
	if(round_mode != 1 || user_race[attacker] != 1 || user_race[victim] != 2) return HAM_IGNORED
	
	static players[32],num
	get_players(players,num,"ae","CT")
	
	if(num > 1)
	{
		if(get_user_armor(victim))
		{
			set_user_armor(victim,max(0,get_user_armor(victim) - floatround(damage)))
			return HAM_SUPERCEDE
		}
		
		user_infect(victim,attacker)
		return HAM_SUPERCEDE
	}
	
	return HAM_IGNORED
}

public user_infect(id,killer)
{
	static players[32],num
	get_players(players,num,"ae","CT")
	
	if(num < 2) return
	
	if(user_race[id] == 1) return
	
	ExecuteForward(fwd_user_infect_pre,fwd_return,id,killer)
	
	if(fwd_return >= FORWARD_CONTINUE) return
	
	cs_set_user_zoom(id,CS_RESET_ZOOM,1)
	
	user_race[id] = 1
	
	user_build_battle[id] = false
	if(user_blockent[id] && is_valid_ent(user_blockent[id])) release_block(id)
	
	user_credits[killer] += get_pcvar_num(cvar_credits_hkill)
	
	check_achievement(killer,ACH_BIOHAZARD,0)
	
	message_begin(MSG_BROADCAST,msg_deathmsg)
	write_byte(killer)
	write_byte(id)
	write_byte(1)
	write_string("infection")
	message_end()
	
	message_begin(MSG_BROADCAST,msg_scoreattrib)
	write_byte(id)
	write_byte(0)
	message_end()
	
	set_user_frags(killer,get_user_frags(killer) + 1)
	cs_set_user_deaths(id,cs_get_user_deaths(id) + 1)
	
	message_begin(MSG_BROADCAST,msg_scoreinfo)
	write_byte(killer)
	write_short(get_user_frags(killer))
	write_short(cs_get_user_deaths(killer))
	write_short(0)
	write_short(_:cs_get_user_team(killer))
	message_end()
	
	message_begin(MSG_BROADCAST,msg_scoreinfo)
	write_byte(id)
	write_short(get_user_frags(id))
	write_short(cs_get_user_deaths(id))
	write_short(0)
	write_short(_:cs_get_user_team(id))
	message_end()
	
	set_task(0.1,"user_infect2",id)
}

public user_infect2(id)
{
	if(!is_user_connected(id)) return
	
	message_begin(MSG_ONE_UNRELIABLE,msg_screenfade,{0,0,0},id)
	write_short(2048)
	write_short(1024)
	write_short(0x0000)
	write_byte(0)
	write_byte(255)
	write_byte(0)
	write_byte(200)
	message_end()
	
	static 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(6)
	write_byte(5)
	message_end()
	
	cs_set_user_team(id,CS_TEAM_T)
	
	set_task(0.1,"spawn_data",id)
	
	emit_sound(id,CHAN_AUTO,"zombie_blood/infect1.wav",VOL_NORM,ATTN_NORM,0,PITCH_HIGH)
	
	ExecuteForward(fwd_user_infect_post,fwd_return,id)
}

public weapon_touch(ent,id)
{
	if(is_user_connected(id) && user_race[id] == 1) return HAM_SUPERCEDE
	return HAM_IGNORED
}

public player_wall_touch(ent,id)
{
	if(!can_build || ent == get_barrierent || ent <= maxplayers || !is_user_connected(id) || user_race[id] != 1 || !is_valid_ent(ent)) return HAM_IGNORED
	
	static ent_trgname[7]
	entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
	
	if(equal(ent_trgname,"ignore") || entity_get_int(ent,EV_INT_iuser1) || entity_get_int(ent,EV_INT_iuser2)) return HAM_IGNORED
	
	entity_set_origin(ent,Float:{0.0,0.0,0.0})
	entity_set_int(ent,EV_INT_iuser3,0)
	entity_set_int(ent,EV_INT_iuser4,0)
	
	return HAM_IGNORED
}

public weapon_primary_attack(ent)
{
	if(!is_valid_ent(ent)) return HAM_IGNORED
	
	static id,Float:angle[3]
	id = entity_get_edict(ent,EV_ENT_owner)
	
	if(user_race[id] != 2 || !user_upgrade_level[id][2][UPGRADE_RECOIL]) return HAM_IGNORED
	
	entity_get_vector(id,EV_VEC_punchangle,angle)
	
	static i
	for(i=0;i<3;i++)
	{
		if(angle[i] < 0.0)
		{
			angle[i] += (get_pcvar_float(cvar_upgrade[2][UPGRADE_RECOIL]) * user_upgrade_level[id][2][UPGRADE_RECOIL])
			if(angle[i] > 0.0) angle[i] = 0.0
		} else {
			angle[i] -= (get_pcvar_float(cvar_upgrade[2][UPGRADE_RECOIL]) * user_upgrade_level[id][2][UPGRADE_RECOIL])
			if(angle[i] < 0.0) angle[i] = 0.0
		}
	}
	
	entity_set_vector(id,EV_VEC_punchangle,angle)
	
	return HAM_IGNORED
}

public show_zclass_menu(id)
{
	if(!total_zombie_classes) return
	
	static menu, get_zombie_data[ZOMBIE_CLASS_DATA], menu_item[64],num_str[4]
	menu = menu_create("Select a zombie class:","zclass_menu_handler")
	
	menu_additem(menu,"Classic Zombie \y[balanced]","-1")
	
	static i
	for(i=0;i<total_zombie_classes;i++)
	{
		ArrayGetArray(zombie_array,i,get_zombie_data)
		
		if(access(id,get_zombie_data[ZOMBIE_ACCESS]))
		{
			num_to_str(i,num_str,3)
			formatex(menu_item,63,"%s \y[%s]",get_zombie_data[ZOMBIE_NAME],get_zombie_data[ZOMBIE_INFO])
			
			menu_additem(menu,menu_item,num_str)
		} else {
			formatex(menu_item,63,"\r%s [%s]",get_zombie_data[ZOMBIE_NAME],get_zombie_data[ZOMBIE_INFO])
			
			menu_additem(menu,menu_item,"-2")
		}
	}
	
	menu_display(id,menu)
	
	set_task(get_pcvar_float(cvar_zclass_select_time),"remove_select_zclass",id + TASK_ZCLASS_SELECT)
}

public zclass_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || user_race[id] == 2)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	if(!can_select_zclass[id])
	{
		ColorChat(id,GREEN,"[VZBB]^x01 The time for selecting a zombie class has finished.")
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static access,callback, info[5], get_info
	menu_item_getinfo(menu,item,access, info,4, _,_, callback)
	
	get_info = str_to_num(info)
	
	switch(get_info)
	{
		case -2:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You don't have access to use this class.")
			
			show_zclass_menu(id)
			
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
		case -1:
		{
			user_class[id] = get_info
			must_change_zclass[id] = false
			
			set_user_health(id,get_pcvar_num(cvar_zombie_classic_hp))
			set_user_gravity(id,get_pcvar_float(cvar_zombie_classic_grav))
			set_task(0.5 + ((id * 0.2)),"update_user_model",id)
			
			formatex(get_zclass_clawmdl[id],127,"models/%s.mdl",zclassic_clawmdl_str)
			get_user_speed[id] = get_pcvar_float(cvar_zombie_classic_speed)
			
			entity_set_string(id,EV_SZ_viewmodel,get_zclass_clawmdl[id])
			
			ColorChat(id,GREEN,"[VZBB]^x01 You have selected^x04 Classic Zombie^x01.")
		}
		default:
		{
			user_class[id] = get_info
			must_change_zclass[id] = false
			
			static get_zombie_data[ZOMBIE_CLASS_DATA]
			
			ArrayGetArray(zombie_array,user_class[id],get_zombie_data)
			
			set_user_health(id,get_zombie_data[ZOMBIE_HEALTH])
			set_user_gravity(id,get_zombie_data[ZOMBIE_GRAVITY])
			set_task(0.5 + ((id * 0.2)),"update_user_model",id)
			
			formatex(get_zclass_clawmdl[id],127,"models/%s.mdl",get_zombie_data[ZOMBIE_CLAWMDL])
			get_user_speed[id] = get_zombie_data[ZOMBIE_SPEED]
			
			entity_set_string(id,EV_SZ_viewmodel,get_zclass_clawmdl[id])
			
			ColorChat(id,GREEN,"[VZBB]^x01 You have selected^x04 %s^x01.",get_zombie_data[ZOMBIE_NAME])
			if(!get_pcvar_num(cvar_zclass_nr_select)) ColorChat(id,GREEN,"[VZBB]^x01 Type ^x04/class^x01 in the chat to change your zombie class.")
			
			ExecuteForward(fwd_zombie_class_selected,fwd_return,id,user_class[id])
		}
	}
	
	set_user_health(id,get_user_health(id) + (get_pcvar_num(cvar_upgrade[1][UPGRADE_HEALTH]) * user_upgrade_level[id][1][UPGRADE_HEALTH]))
	
	set_user_gravity(id,get_user_gravity(id) - (get_pcvar_float(cvar_upgrade[1][UPGRADE_GRAVITY]) * user_upgrade_level[id][1][UPGRADE_GRAVITY]))
	if(get_user_gravity(id) < 0.1) set_user_gravity(id, 0.1)
	
	set_user_rendering(id,kRenderFxGlowShell, 0,0,0, kRenderTransAlpha, (255 - (get_pcvar_num(cvar_upgrade[1][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][1][UPGRADE_INVISIBILITY])) < 0 ? 0 : 255 - (get_pcvar_num(cvar_upgrade[1][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][1][UPGRADE_INVISIBILITY]))
	
	if(get_user_speed[id] == 0.0) get_user_speed[id] = 240.0
	get_user_speed[id] += (get_pcvar_float(cvar_upgrade[1][UPGRADE_SPEED]) * user_upgrade_level[id][1][UPGRADE_SPEED])
	
	ExecuteHamB(Ham_Item_PreFrame,id)
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public remove_select_zclass(id)
{
	id -= TASK_ZCLASS_SELECT
	
	if(!is_user_connected(id)) return
	can_select_zclass[id] = false
}

public show_item_menu(id)
{
	static menu, get_item_data[SHOP_ITEM_DATA], menu_title[60],menu_item[64],num_str[5]
	formatex(menu_title,59,"Select an item and by it:^nYoy have\w %i\y credits.",user_credits[id])
	menu = menu_create(menu_title,"item_menu_handler")
	
	user_buy_last_race[id] = user_race[id]
	
	static i
	for(i=0;i<total_shop_items;i++)
	{
		ArrayGetArray(shop_item_array,i,get_item_data)
		
		if(get_item_data[ITEM_TEAM] != 3 && get_item_data[ITEM_TEAM] != user_race[id]) continue
		
		if(access(id,get_item_data[ITEM_ACCESS]))
		{
			if(get_item_data[ITEM_USE] != 2 && get_item_data[ITEM_USE] != can_build)
			{
				formatex(menu_item,63,"\d%s [%i credits]",get_item_data[ITEM_NAME],get_item_data[ITEM_COST])
				menu_additem(menu,menu_item,"-2")
				continue
			}
			
			if(get_item_data[ITEM_MAX] && get_item_data[ITEM_MAX_PRIVATE] == get_item_data[ITEM_MAX])
			{
				formatex(menu_item,63,"\d%s [%i credits] [%i buys]",get_item_data[ITEM_NAME],get_item_data[ITEM_COST], get_item_data[ITEM_MAX])
				menu_additem(menu,menu_item,"-4")
				continue
			}
			
			formatex(menu_item,63,"%s \%s[%i credits]",get_item_data[ITEM_NAME],user_credits[id] < get_item_data[ITEM_COST] ? "r" : "y",get_item_data[ITEM_COST])
			
			num_to_str(i,num_str,4)
			menu_additem(menu,menu_item,user_credits[id] < get_item_data[ITEM_COST] ? "-1" : num_str)
		} else {
			formatex(menu_item,63,"\r%s [%i credits]",get_item_data[ITEM_NAME],get_item_data[ITEM_COST])
			menu_additem(menu,menu_item,"-3")
		}
	}
	
	menu_display(id,menu)
}

public item_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || user_buy_last_race[id] != user_race[id])
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static access,callback, info[5], get_info
	menu_item_getinfo(menu,item,access, info,4, _,_, callback)
	
	get_info = str_to_num(info)
	
	switch(get_info)
	{
		case -4:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 Buy limit for this item have been reached. Please wait till the next round.")
			
			show_item_menu(id)
	
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
		case -3:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You don't have access to buy this item.")
			
			show_item_menu(id)
	
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
		case -2: ColorChat(id,GREEN,"[VZBB]^x01 You can't buy this item in the^x04 %s Phase^x01.",can_build ? "Build" : "Battle")
		case -1: ColorChat(id,GREEN,"[VZBB]^x01 You don't have enough credits to buy this item.")
		default:
		{
			static get_item_data[SHOP_ITEM_DATA]
			
			ArrayGetArray(shop_item_array,get_info,get_item_data)
			
			ExecuteForward(fwd_shop_item_selected,fwd_return,id,get_info)
			
			if(fwd_return >= FORWARD_CONTINUE)
			{
				show_item_menu(id)
				
				menu_destroy(menu)
				return PLUGIN_HANDLED
			}
			
			user_credits[id] -= get_item_data[ITEM_COST]
			
			if(get_item_data[ITEM_MAX])
			{
				get_item_data[ITEM_MAX_PRIVATE]++
				ArraySetArray(shop_item_array,get_info,get_item_data)
			}
		}
	}
	
	show_item_menu(id)
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public show_deal_menu(id)
{
	static menu, get_item_data[SHOP_ITEM_DATA], menu_title[60],menu_item[64],num_str[5]
	formatex(menu_title,59,"Select an item and by it:^nYoy have\w %i\y credits.",user_credits[id])
	menu = menu_create(menu_title,"deal_menu_handler")
	
	user_buy_last_race[id] = user_race[id]
	
	static i, real_cost
	for(i=0;i<total_shop_items;i++)
	{
		if(~round_deal_items & (1<<i)) continue
		
		ArrayGetArray(shop_item_array,i,get_item_data)
		
		if(get_item_data[ITEM_TEAM] != 3 && get_item_data[ITEM_TEAM] != user_race[id]) continue
		
		real_cost = get_item_data[ITEM_COST]
		get_item_data[ITEM_COST] = max(1,real_cost - round_deal_discount)
		
		if(access(id,get_item_data[ITEM_ACCESS]))
		{
			if(get_item_data[ITEM_USE] != 2 && get_item_data[ITEM_USE] != can_build)
			{
				formatex(menu_item,63,"\d%s [%i credits] [%i discount]",get_item_data[ITEM_NAME],get_item_data[ITEM_COST],round_deal_discount)
				menu_additem(menu,menu_item,"-2")
				continue
			}
			
			if(get_item_data[ITEM_MAX] && get_item_data[ITEM_MAX_PRIVATE] == get_item_data[ITEM_MAX])
			{
				formatex(menu_item,63,"\d%s [%i credits] [%i buys]",get_item_data[ITEM_NAME],get_item_data[ITEM_COST], get_item_data[ITEM_MAX])
				menu_additem(menu,menu_item,"-4")
				continue
			}
			
			formatex(menu_item,63,"%s \%s[%i credits] \y[%i discount]",get_item_data[ITEM_NAME],user_credits[id] < get_item_data[ITEM_COST] ? "r" : "y",get_item_data[ITEM_COST],round_deal_discount)
			
			num_to_str(i,num_str,4)
			menu_additem(menu,menu_item,user_credits[id] < get_item_data[ITEM_COST] ? "-1" : num_str)
		} else {
			formatex(menu_item,63,"\r%s [%i credits] [%i discount]",get_item_data[ITEM_NAME],get_item_data[ITEM_COST],round_deal_discount)
			menu_additem(menu,menu_item,"-3")
		}
	}
	
	menu_display(id,menu)
}

public deal_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || user_buy_last_race[id] != user_race[id])
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static access,callback, info[5], get_info
	menu_item_getinfo(menu,item,access, info,4, _,_, callback)
	
	get_info = str_to_num(info)
	
	switch(get_info)
	{
		case -4:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 Buy limit for this item have been reached. Please wait till the next round.")
			
			show_item_menu(id)
	
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
		case -3:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You don't have access to buy this item.")
			
			show_deal_menu(id)
	
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
		case -2: ColorChat(id,GREEN,"[VZBB]^x01 You can't buy this item in the^x04 %s Phase^x01.",can_build ? "Build" : "Battle")
		case -1: ColorChat(id,GREEN,"[VZBB]^x01 You don't have enough credits to buy this item.")
		default:
		{
			static get_item_data[SHOP_ITEM_DATA]
			
			ArrayGetArray(shop_item_array,get_info,get_item_data)
			
			ExecuteForward(fwd_shop_item_selected,fwd_return,id,get_info)
			
			if(fwd_return >= FORWARD_CONTINUE)
			{
				show_deal_menu(id)
				
				menu_destroy(menu)
				return PLUGIN_HANDLED
			}
			
			user_credits[id] -= max(1,get_item_data[ITEM_COST] - round_deal_discount)
			
			if(get_item_data[ITEM_MAX])
			{
				get_item_data[ITEM_MAX_PRIVATE]++
				ArraySetArray(shop_item_array,get_info,get_item_data)
			}
		}
	}
	
	show_deal_menu(id)
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public show_ach_menu(id)
{
	static menu, menu_ach[128]
	menu = menu_create("Achievement Progress:","ach_menu_handler")
	
	static i
	for(i=0;i<MAX_ACH;i++)
	{
		if((!get_pcvar_num(cvar_nade_fire) && (i == ACH_FIREWORKS || i == ACH_BIGBANG)) || (!get_pcvar_num(cvar_nade_fire_can_kill) && i == ACH_BIGBANG) || (!get_pcvar_num(cvar_nade_frost) && i == ACH_ICEAGE) || (!get_pcvar_num(cvar_mode) && i == ACH_BIOHAZARD)) continue
		
		if(user_ach_level[id][i] == 3)
		{
			formatex(menu_ach,127,"\r%s:^n\yProgress:\w COMPLETED!",ach_name[i])
			menu_additem(menu,menu_ach)
		} else {
			formatex(menu_ach,127,"%s%s:^n%s%s%i%s^n\yProgress:\w %i\d/\w%i",ach_level_color[user_ach_level[id][i]],ach_name[i],ach_level_color[user_ach_level[id][i]],ach_info1[i],get_pcvar_num(cvar_ach_get[i][user_ach_level[id][i] + 1]),ach_info2[i],user_ach_progress[id][i],\
			get_pcvar_num(cvar_ach_get[i][user_ach_level[id][i] + 1]))
			
			menu_additem(menu,menu_ach)
		}
	}
	
	menu_setprop(menu,MPROP_PERPAGE,6)
	menu_display(id,menu)
}

public ach_menu_handler(id,menu,item)
{
	menu_destroy(menu)
	
	return PLUGIN_HANDLED
}

public show_unlock_menu(id)
{
	static menu
	menu = menu_create("Select and unlock a weapon:","unlock_menu_handler")
	
	static get_name_weapons[31],num_str[3], i
	for(i=1;i<sizeof name_weapons;i++)
	{
		if(get_pcvar_num(cvar_weapons_weapons[i]))
		{
			if(user_unlock[id][i])
			{
				formatex(get_name_weapons,30,"%s%s\%s [%i credits]",user_unlock[id][i] ? "" : "\d",name_weapons[i],user_credits[id] < get_pcvar_num(cvar_unlock_cost[i]) ? "r" : "y",get_pcvar_num(cvar_unlock_cost[i]))
			} else {
				formatex(get_name_weapons,30,"%s%s",user_unlock[id][i] ? "" : "\d",name_weapons[i])
			}
			
			replace(get_name_weapons,30,"weapon_","")
			strtoupper(get_name_weapons)
			replace(get_name_weapons,30,"CREDITS","credits")
			replace(get_name_weapons,30,"\D","\d")
			replace(get_name_weapons,30,"\R","\r")
			replace(get_name_weapons,30,"\Y","\y")
			
			if(user_unlock[id][i])
			{
				num_to_str(i,num_str,2)
				
				menu_additem(menu,get_name_weapons,user_credits[id] < get_pcvar_num(cvar_unlock_cost[i]) ? "-1" : num_str)
			} else {
				menu_additem(menu,get_name_weapons,"0")
			}
		}
	}
	
	menu_display(id,menu)
}

public unlock_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static access,callback, info[3], get_info
	menu_item_getinfo(menu,item,access, info,2, _,_, callback)
	
	get_info = str_to_num(info)
	
	switch(get_info)
	{
		case -1:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You don't have enough credits to unlock this weapon.")
			
			show_unlock_menu(id)
			
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
		case 0:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You have already unlocked this weapon.")
			
			show_unlock_menu(id)
			
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
	}
	
	user_unlock[id][get_info] = 0
	user_credits[id] -= get_pcvar_num(cvar_unlock_cost[get_info])
	
	ColorChat(id,GREEN,"[VZBB]^x01 You have unlocked^x04 %s^x01!",name_weapons[get_info])
	
	check_achievement(id,ACH_UNLOCKERZ,0)
	
	show_unlock_menu(id)
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public show_upgrade_menu(id)
{
	if(!user_race[id]) return
	
	static menu
	menu = menu_create("Select and buy an upgrade:","upgrade_menu_handler")
	
	user_upgrade_last_race[id] = user_race[id]
	
	static get_upgrade[128],num_str[3], i
	for(i=0;i<MAX_UPGRADES;i++)
	{
		if((user_race[id] == 1 && (i == UPGRADE_ARMOR || i == UPGRADE_RECOIL)) || (user_race[id] == 2 && i == UPGRADE_REGENERATION) ||
		(!get_pcvar_float(cvar_upgrade[user_race[id]][i])) || (!get_pcvar_float(cvar_upgrade_levels[user_race[id]][i])) || (!get_pcvar_float(cvar_upgrade_cost[user_race[id]][i]))) continue
		
		if(user_upgrade_level[id][user_race[id]][i] == get_pcvar_num(cvar_upgrade_levels[user_race[id]][i]))
		{
			if(i == UPGRADE_HEALTH || i == UPGRADE_ARMOR || i == UPGRADE_INVISIBILITY || i == UPGRADE_REGENERATION)
			{
				formatex(get_upgrade,127,"\r%s (+ %i):^n\w COMPLETED!",upgrade_name[i],get_pcvar_num(cvar_upgrade[user_race[id]][i]))
			} else {
				formatex(get_upgrade,127,"\r%s (%s %.3f):^n\w COMPLETED!",upgrade_name[i],(i == 3 || i == 5) ? "-" : "+",get_pcvar_float(cvar_upgrade[user_race[id]][i]))
			}
			
			menu_additem(menu,get_upgrade,"-2")
		} else {
			num_to_str(i,num_str,2)
			
			if(i == UPGRADE_HEALTH || i == UPGRADE_ARMOR || i == UPGRADE_INVISIBILITY || i == UPGRADE_REGENERATION)
			{
				formatex(get_upgrade,127,"%s%s (+ %i):^n\yCost:\w %i\y credits^nLevel:\w %i\d/\w%i",user_credits[id] < get_pcvar_num(cvar_upgrade_cost[user_race[id]][i]) * (user_upgrade_level[id][user_race[id]][i] + 1) ? "\d" : "",\
				upgrade_name[i],get_pcvar_num(cvar_upgrade[user_race[id]][i]),get_pcvar_num(cvar_upgrade_cost[user_race[id]][i]) * (user_upgrade_level[id][user_race[id]][i] + 1),user_upgrade_level[id][user_race[id]][i],get_pcvar_num(cvar_upgrade_levels[user_race[id]][i]))
			} else {
				formatex(get_upgrade,127,"%s%s (%s %.3f):^n\yCost:\w %i\y credits^nLevel:\w %i\d/\w%i",user_credits[id] < get_pcvar_num(cvar_upgrade_cost[user_race[id]][i]) * (user_upgrade_level[id][user_race[id]][i] + 1) ? "\d" : "",upgrade_name[i],(i==3 || i==5) ? "-" : "+",get_pcvar_float(cvar_upgrade[user_race[id]][i]),get_pcvar_num(cvar_upgrade_cost[user_race[id]][i]) * (user_upgrade_level[id][user_race[id]][i] + 1),user_upgrade_level[id][user_race[id]][i],get_pcvar_num(cvar_upgrade_levels[user_race[id]][i]))
			}
			
			menu_additem(menu,get_upgrade,user_credits[id] < get_pcvar_num(cvar_upgrade_cost[user_race[id]][i]) * (user_upgrade_level[id][user_race[id]][i] + 1) ? "-1" : num_str)
		}
	}
	
	menu_display(id,menu)
}

public upgrade_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static access,callback, info[3], get_info
	menu_item_getinfo(menu,item,access, info,2, _,_, callback)
	
	get_info = str_to_num(info)
	
	switch(get_info)
	{
		case -2:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You have reached the maximum amount of upgrades for this.")
			
			show_upgrade_menu(id)
			
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
		case -1:
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You don't have enough credits to upgrade this.")
			
			show_upgrade_menu(id)
			
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}
	}
	
	user_upgrade_level[id][user_upgrade_last_race[id]][get_info]++
	user_credits[id] -= get_pcvar_num(cvar_upgrade_cost[user_upgrade_last_race[id]][get_info]) * (user_upgrade_level[id][user_upgrade_last_race[id]][get_info])
	
	ColorChat(id,GREEN,"[VZBB]^x01 You have upgraded your^x04 %s^x01 to level^x04 %i^x01.",upgrade_name[get_info],user_upgrade_level[id][user_upgrade_last_race[id]][get_info])
	
	check_achievement(id,ACH_UPGRADEME,0)
	
	show_upgrade_menu(id)
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public show_weapon_menu(id)
{
	if(can_build) return
	
	static menu
	menu = menu_create("Select a primary weapon:","weapon1_menu_handler")
	
	static get_name_weapons[20],num_str[3], i
	for(i=7;i<sizeof name_weapons;i++)
	{
		if(get_pcvar_num(cvar_weapons_weapons[i]))
		{
			formatex(get_name_weapons,19,"%s%s",user_unlock[id][i] ? "\d" : "",name_weapons[i])
			replace(get_name_weapons,19,"weapon_","")
			strtoupper(get_name_weapons)
			replace(get_name_weapons,19,"\D","\d")
			
			if(!user_unlock[id][i])
			{
				num_to_str(i,num_str,2)
				menu_additem(menu,get_name_weapons,num_str)
			}
		}
	}
	
	for(i=7;i<sizeof name_weapons;i++)
	{
		if(get_pcvar_num(cvar_weapons_weapons[i]))
		{
			formatex(get_name_weapons,19,"%s%s",user_unlock[id][i] ? "\d" : "",name_weapons[i])
			replace(get_name_weapons,19,"weapon_","")
			strtoupper(get_name_weapons)
			replace(get_name_weapons,19,"\D","\d")
			
			if(user_unlock[id][i]) menu_additem(menu,get_name_weapons,"0")
		}
	}
	
	menu_display(id,menu)
}

public weapon1_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || user_race[id] == 1 || can_build)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static access,callback, info[3], get_info
	menu_item_getinfo(menu,item,access, info,2, _,_, callback)
	
	get_info = str_to_num(info)
	
	if(!get_info)
	{
		ColorChat(id,GREEN,"[VZBB]^x01 This weapon is locked! Type^x04 /unlock^x01 in the chat and unlock it with credits.")
		
		show_weapon_menu(id)
		
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	selected_weapons[id] = true
	
	give_item(id,name_weapons[get_info])
	cs_set_user_bpammo(id,csw_weapons[get_info],254)
	
	show_weapon_menu2(id)
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public show_weapon_menu2(id)
{
	if(can_build) return
	
	static menu
	menu = menu_create("Select a secondary weapon:","weapon2_menu_handler")
	
	static get_name_weapons[20],num_str[3], i
	for(i=1;i<7;i++)
	{
		if(get_pcvar_num(cvar_weapons_weapons[i]))
		{
			formatex(get_name_weapons,19,"%s%s",user_unlock[id][i] ? "\d" : "",name_weapons[i])
			replace(get_name_weapons,19,"weapon_","")
			strtoupper(get_name_weapons)
			replace(get_name_weapons,19,"\D","\d")
			
			if(!user_unlock[id][i])
			{
				num_to_str(i,num_str,2)
				menu_additem(menu,get_name_weapons,num_str)
			}
		}
	}
	
	for(i=1;i<7;i++)
	{
		if(get_pcvar_num(cvar_weapons_weapons[i]))
		{
			formatex(get_name_weapons,19,"%s%s",user_unlock[id][i] ? "\d" : "",name_weapons[i])
			replace(get_name_weapons,19,"weapon_","")
			strtoupper(get_name_weapons)
			replace(get_name_weapons,19,"\D","\d")
			
			if(user_unlock[id][i]) menu_additem(menu,get_name_weapons,"0")
		}
	}
	
	menu_display(id,menu)
}

public weapon2_menu_handler(id,menu,item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || user_race[id] == 1 || can_build)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static access,callback, info[3], get_info
	menu_item_getinfo(menu,item,access, info,2, _,_, callback)
	
	get_info = str_to_num(info)
	
	if(!get_info)
	{
		ColorChat(id,GREEN,"[VZBB]^x01 This weapon is locked! Type^x04 /unlock^x01 in the chat and unlock it with credits.")
		
		show_weapon_menu2(id)
		
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	give_item(id,name_weapons[get_info])
	cs_set_user_bpammo(id,csw_weapons[get_info],254)
	
	static i
	for(i=0;i<3;i++)
	{
		if(random_num(get_pcvar_num(cvar_nade_give_chance[i]),100) == 100)
		{
			give_item(id,nade_names[i])
			
			cs_set_user_bpammo(id,csw_nades[i],get_pcvar_num(cvar_weapons_start_grenade[i]))
			
			if(get_pcvar_num(cvar_nade_give_chance[i]) != 100) ColorChat(id,GREEN,"[VZBB]^x01 You won a^x04 %s^x01 (^x04%i%%^x01 chance).",nade_names[i],get_pcvar_num(cvar_nade_give_chance[i]))
		}
	}
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public fm_set_model(ent,const model[])
{
	if(!is_valid_ent(ent)) return FMRES_IGNORED
	
	static ent_classname[8]
	entity_get_string(ent,EV_SZ_classname,ent_classname,7)
	
	if(!equal(ent_classname,"grenade")) return FMRES_IGNORED
	
	static owner
	owner = entity_get_edict(ent,EV_ENT_owner)
	
	switch(model[9])
	{
		case 'h':
		{
			ExecuteForward(fwd_throw_nade_pre,fwd_return,owner,ent,1)
	
			if(fwd_return >= FORWARD_CONTINUE) return FMRES_IGNORED
			
			if(get_pcvar_num(cvar_nade_fire) && user_race[owner] == 2)
			{
				entity_set_float(ent,EV_FL_dmgtime,7000.0)
				
				set_rendering(ent,kRenderFxGlowShell, 255,85,0, kRenderNormal, 80)
				
				message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
				write_byte(TE_BEAMFOLLOW)
				write_short(ent)
				write_short(spr_trail)
				write_byte(20)
				write_byte(5)
				write_byte(255)
				write_byte(85)
				write_byte(0)
				write_byte(130)
				message_end()
				
				if(!task_exists(ent)) set_task(1.5,"explode_fire",ent)
				
				ExecuteForward(fwd_throw_nade_post,fwd_return,owner,ent,1)
			}
		}
		case 's':
		{
			ExecuteForward(fwd_throw_nade_pre,fwd_return,owner,ent,2)
	
			if(fwd_return >= FORWARD_CONTINUE) return FMRES_IGNORED
			
			if(get_pcvar_num(cvar_nade_scan) && user_race[owner] == 2)
			{
				entity_set_float(ent,EV_FL_dmgtime,7000.0)
				
				set_rendering(ent,kRenderFxGlowShell, 100,255,100, kRenderNormal, 80)
				
				message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
				write_byte(TE_BEAMFOLLOW)
				write_short(ent)
				write_short(spr_trail)
				write_byte(20)
				write_byte(5)
				write_byte(100)
				write_byte(255)
				write_byte(100)
				write_byte(130)
				message_end()
				
				if(!task_exists(ent)) set_task(1.5,"attach_scan",ent)
				
				ExecuteForward(fwd_throw_nade_post,fwd_return,owner,ent,2)
			}
		}
		case 'f':
		{
			ExecuteForward(fwd_throw_nade_pre,fwd_return,owner,ent,3)
	
			if(fwd_return >= FORWARD_CONTINUE) return FMRES_IGNORED
			
			if(get_pcvar_num(cvar_nade_frost) && user_race[owner] == 2)
			{
				entity_set_float(ent,EV_FL_dmgtime,7000.0)
				
				set_rendering(ent,kRenderFxGlowShell, 0,200,255, kRenderNormal, 80)
				
				message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
				write_byte(TE_BEAMFOLLOW)
				write_short(ent)
				write_short(spr_trail)
				write_byte(20)
				write_byte(5)
				write_byte(0)
				write_byte(200)
				write_byte(255)
				write_byte(130)
				message_end()
				
				if(!task_exists(ent)) set_task(1.5,"explode_frost",ent)
				
				ExecuteForward(fwd_throw_nade_post,fwd_return,owner,ent,3)
			}
		}
	}
	
	return FMRES_IGNORED
}

public fm_emit_sound(id,channel,const sample[],Float:volume,Float:attn,flags,pitch)
{
	if(!is_user_connected(id) || user_race[id] == 2) return FMRES_IGNORED
	
	if(equal(sample[7], "die", 3) || equal(sample[7], "dea", 3))
	{
		emit_sound(id,channel,sound_zombie_die[random(sizeof sound_zombie_die)],volume,attn,flags,pitch)
		return FMRES_SUPERCEDE
	}
	
	if(equal(sample[7], "bhit", 4))
	{
		emit_sound(id,channel,sound_zombie_pain[random(sizeof sound_zombie_pain)],volume,attn,flags,pitch)
		return FMRES_SUPERCEDE
	}
	
	return FMRES_IGNORED
}

public fm_block_kill(id) return FMRES_SUPERCEDE

public fm_block_mdl(id,const buffer[],const key[])
{
	if(equal(key,"model")) return FMRES_SUPERCEDE
	
	return FMRES_IGNORED
}

public fm_check_user_model(id)
{
	if(!is_user_connected(id)) return
	
	static i, user_mdl[128]
	get_user_info(id,"model",user_mdl,127)
	
	switch(user_race[id])
	{
		case 1:
		{
			if(user_class[id] == -1)
			{
				if(!equal(user_mdl,zclassic_mdl_str)) set_user_info(id,"model",zclassic_mdl_str)
			} else {
				static get_zombie_data[ZOMBIE_CLASS_DATA]
				
				ArrayGetArray(zombie_array,user_class[id],get_zombie_data)
				
				if(!equal(user_mdl,get_zombie_data[ZOMBIE_MDL])) set_user_info(id,"model",get_zombie_data[ZOMBIE_MDL])
			}
		}
		case 2:
		{
			static must_rechange
			must_rechange = true
			for(i=0;i<sizeof human_models;i++)
			{
				if(equal(user_mdl,human_models[i]))
				{
					must_rechange = false
					break
				}
			}
			
			if(must_rechange)
			{
				if (get_user_flags(id) & VIP_SKIN_FLAG)
				{
					set_user_info(id, "model", VIP_SKIN)
				}
				else
				{
					set_user_info(id,"model",human_models[random(sizeof human_models)])
				}
			}
		}
	}
}

public explode_fire(ent)
{
	if(!is_valid_ent(ent)) return
	
	static Float:origin[3],origin2[3], owner, id, count
	id = -1
	owner = entity_get_edict(ent,EV_ENT_owner)
	
	entity_get_vector(ent,EV_VEC_origin,origin)
	FVecIVec(origin,origin2)
	
	while((id = find_ent_in_sphere(id,origin,float(get_pcvar_num(cvar_nade_fire_radius)))) != 0)
	{
		if(!is_user_connected(id) || !is_user_alive(id) || user_race[owner] != 2 || user_race[id] != 1) continue
		
		remove_task(id + TASK_BURN)
		user_fire_atk[id] = owner
		user_fire_dur[id] += (1 + get_pcvar_num(cvar_nade_fire_dur))
		set_task(0.1,"start_burn",id + TASK_BURN)
		
		check_achievement(owner,ACH_FIREWORKS,1)
		
		count++
	}
	
	if(get_pcvar_num(cvar_nade_counter))
	{
		set_hudmessage(255, 0, 0, -1.0, 0.41, 0, 6.0, 2.0, 0.1, 0.2, -1)
		ShowSyncHudMsg(owner,sync4, "Burned players: %i",count)
	}
	
	count = 0
	
	user_ach_progress[owner][ACH_FIREWORKS] = 0
	
	emit_sound(ent,CHAN_AUTO,"ambience/flameburst1.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM)
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2] + get_pcvar_num(cvar_nade_fire_radius))
	write_short(spr_trail)
	write_byte(0)
	write_byte(0)
	write_byte(5)
	write_byte(get_pcvar_num(cvar_nade_fire_radius))
	write_byte(0)
	write_byte(255)
	write_byte(85)
	write_byte(0)
	write_byte(180)
	write_byte(0)
	message_end()
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2] + floatround(get_pcvar_num(cvar_nade_fire_radius) * 0.5))
	write_short(spr_trail)
	write_byte(0)
	write_byte(0)
	write_byte(5)
	write_byte(get_pcvar_num(cvar_nade_fire_radius))
	write_byte(0)
	write_byte(255)
	write_byte(85)
	write_byte(0)
	write_byte(180)
	write_byte(5)
	message_end()
	
	remove_entity(ent)
}

public start_burn(id)
{
	id -= TASK_BURN
	
	if(!is_user_connected(id) || !is_user_alive(id)) return
	
	static origin[3]
	get_user_origin(id,origin)
	
	ExecuteForward(fwd_user_burn_pre,fwd_return,id)
	
	message_begin(MSG_ONE_UNRELIABLE,msg_statusicon,{0,0,0},id)
	write_byte(0)
	write_string("dmg_heat")
	message_end()
	
	if(~entity_get_int(id,EV_INT_flags) & FL_INWATER)
	{
		user_fire_dur[id]--
	} else {
		user_fire_dur[id] = 0
	}
	
	if(user_fire_dur[id] > 0)
	{
		if(get_user_health(id) > get_pcvar_num(cvar_nade_fire_damage))
		{
			set_user_health(id,get_user_health(id) - get_pcvar_num(cvar_nade_fire_damage))
			
			message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
			write_byte(TE_SPRITE)
			write_coord(origin[0])
			write_coord(origin[1])
			write_coord(origin[2])
			write_short(spr_flame)
			write_byte(10)
			write_byte(180)
			message_end()
			
			message_begin(MSG_ONE_UNRELIABLE,msg_statusicon,{0,0,0},id)
			write_byte(3)
			write_string("dmg_heat")
			write_byte(255)
			write_byte(85)
			write_byte(0)
			message_end()
		} else {
			user_fire_dur[id] = 0
			
			if(get_pcvar_num(cvar_nade_fire_can_kill))
			{
				if(user_frost[id])
				{
					remove_task(id + TASK_FREEZE)
					stop_freeze(id + TASK_FREEZE)
				} else if(user_frost_cool[id])
				{
					remove_task(id + TASK_FREEZE_COOL)
					stop_freeze_cool(id + TASK_FREEZE_COOL)
				}
				
				if(is_user_connected(user_fire_atk[id]))
				{
					ExecuteHamB(Ham_Killed, id,user_fire_atk[id], false)
					
					check_achievement(user_fire_atk[id],ACH_BIGBANG,0)
				} else {
					ExecuteHamB(Ham_Killed, id,id, false)
				}
			}
		}
	}
	
	ExecuteForward(fwd_user_burn_post,fwd_return,id)
	
	if(user_fire_dur[id] > 0)
	{
		set_task(get_pcvar_float(cvar_nade_fire_dmgstep),"start_burn",id + TASK_BURN)
	} else {
		ExecuteForward(fwd_user_remove_burn,fwd_return,id)
		
		message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
		write_byte(TE_SMOKE)
		write_coord(origin[0])
		write_coord(origin[1])
		write_coord(origin[2])
		write_short(spr_smoke)
		write_byte(7)
		write_byte(30)
		message_end()
	}
}

public attach_scan(ent)
{
	if(!is_valid_ent(ent)) return
	
	static ent2
	ent2 = create_entity("info_target")
	if(ent2)
	{
		entity_set_string(ent2,EV_SZ_classname,"info_scanner")
		
		entity_set_int(ent2,EV_INT_solid,SOLID_NOT)
		entity_set_int(ent2,EV_INT_movetype,MOVETYPE_FOLLOW)
		
		entity_set_edict(ent2,EV_ENT_aiment,ent)
		
		static Float:origin[3]
		entity_get_vector(ent,EV_VEC_origin,origin)
		
		entity_set_origin(ent2,origin)
		
		entity_set_float(ent2,EV_FL_nextthink,get_gametime() + get_pcvar_float(cvar_nade_scan_step))
	}
}

public scan_think(ent)
{
	if(!is_valid_ent(ent)) return
	
	static Float:origin[3],origin2[3], id, i, origin4[3]
	id = -1
	
	entity_get_vector(ent,EV_VEC_origin,origin)
	FVecIVec(origin,origin2)
	
	while((id = find_ent_in_sphere(id,origin,float(get_pcvar_num(cvar_nade_scan_radius)))) != 0)
	{
		if(!is_user_connected(id) || !is_user_alive(id) || user_race[id] != 1) continue
		
		for(i=1;i<=maxplayers;i++)
		{
			if(!is_user_connected(i) || !is_user_alive(i) || user_race[i] != 2) continue
			
			get_user_origin(id,origin4)
			
			message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,_,i)
			write_byte(TE_BEAMPOINTS)
			write_coord(origin4[0])
			write_coord(origin4[1])
			write_coord(origin4[2])
			write_coord(origin2[0])
			write_coord(origin2[1])
			write_coord(origin2[2])
			write_short(spr_trail)
			write_byte(0)
			write_byte(0)
			write_byte(2)
			write_byte(10)
			write_byte(0)
			write_byte(100)
			write_byte(255)
			write_byte(100)
			write_byte(100)
			write_byte(0)
			message_end()
		}
	}
	
	if(get_pcvar_num(cvar_nade_scan_sound)) emit_sound(ent,CHAN_AUTO,"turret/tu_ping.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM)
	
	entity_set_float(ent,EV_FL_nextthink,get_gametime() + get_pcvar_float(cvar_nade_scan_step))
}

public explode_frost(ent)
{
	if(!is_valid_ent(ent)) return
	
	static Float:origin[3],origin2[3], owner, id, count
	
	id = -1
	owner = entity_get_edict(ent,EV_ENT_owner)
	
	entity_get_vector(ent,EV_VEC_origin,origin)
	FVecIVec(origin,origin2)
	
	while((id = find_ent_in_sphere(id,origin,float(get_pcvar_num(cvar_nade_frost_radius)))) != 0)
	{
		if(!is_user_connected(id) || !is_user_alive(id) || user_race[owner] != 2 || user_race[id] != 1) continue
		
		remove_task(id + TASK_FREEZE)
		remove_task(id + TASK_FREEZE_COOL)
		
		if(get_pcvar_num(cvar_nade_frost_cool))
		{
			static Float:origin3[3]
			entity_get_vector(id,EV_VEC_origin,origin3)
			
			if(get_distance_f(origin,origin3) <= get_pcvar_num(cvar_nade_frost_cool_radius)) user_frost_cool[id] = true
		}
		
		set_task(0.1,"start_freeze",id + TASK_FREEZE)
		
		check_achievement(owner,ACH_ICEAGE,1)
		
		count++
	}
	
	if(get_pcvar_num(cvar_nade_counter))
	{
		set_hudmessage(0, 255, 255, -1.0, 0.41, 0, 6.0, 2.0, 0.1, 0.2, -1)
		ShowSyncHudMsg(owner,sync4, "Frozen players: %i",count)
	}
	
	count = 0
	
	user_ach_progress[owner][ACH_ICEAGE] = 0
	
	emit_sound(ent,CHAN_AUTO,"debris/beamstart8.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM)
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2] + get_pcvar_num(cvar_nade_frost_radius))
	write_short(spr_trail)
	write_byte(0)
	write_byte(0)
	write_byte(5)
	write_byte(get_pcvar_num(cvar_nade_frost_radius))
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(255)
	write_byte(180)
	write_byte(0)
	message_end()
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BEAMCYLINDER)
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2] + floatround(get_pcvar_num(cvar_nade_frost_radius) * 0.5))
	write_short(spr_trail)
	write_byte(0)
	write_byte(0)
	write_byte(5)
	write_byte(get_pcvar_num(cvar_nade_frost_radius))
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(255)
	write_byte(180)
	write_byte(5)
	message_end()
	
	remove_entity(ent)
}

public start_freeze(id)
{
	id -= TASK_FREEZE
	
	ExecuteForward(fwd_user_freeze_pre,fwd_return,id)
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_KILLBEAM)
	write_short(id)
	message_end()
	
	message_begin(MSG_ONE_UNRELIABLE,msg_statusicon,{0,0,0},id)
	write_byte(3)
	write_string("dmg_cold")
	write_byte(0)
	write_byte(200)
	write_byte(255)
	message_end()
	
	user_frost[id] = true
	
	set_user_rendering(id,kRenderFxGlowShell, 0,200,255, kRenderNormal, 80)
	set_user_godmode(id,1)
	entity_set_int(id,EV_INT_flags,entity_get_int(id,EV_INT_flags) | FL_FROZEN)
	
	set_task(get_pcvar_float(cvar_nade_frost_dur),"stop_freeze",id + TASK_FREEZE)
	
	ExecuteForward(fwd_user_freeze_post,fwd_return,id)
}

public stop_freeze(id)
{
	id -= TASK_FREEZE
	
	if(!is_user_connected(id)) return
	
	ExecuteForward(fwd_user_unfreeze_pre,fwd_return,id)
	
	if(!user_frost_cool[id])
	{
		message_begin(MSG_ONE_UNRELIABLE,msg_statusicon,{0,0,0},id)
		write_byte(0)
		write_string("dmg_cold")
		message_end()
		
		user_frost[id] = false
		
		set_user_rendering(id,kRenderFxGlowShell, 0,0,0, kRenderTransAlpha, (255 - (get_pcvar_num(cvar_upgrade[user_race[id]][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][user_race[id]][UPGRADE_INVISIBILITY])) < 0 ? 0 : 255 - (get_pcvar_num(cvar_upgrade[user_race[id]][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][user_race[id]][UPGRADE_INVISIBILITY]))
	} else {
		ExecuteForward(fwd_user_freeze_cool_pre,fwd_return,id)
		
		message_begin(MSG_ONE_UNRELIABLE,msg_statusicon,{0,0,0},id)
		write_byte(2)
		write_string("dmg_cold")
		write_byte(0)
		write_byte(200)
		write_byte(255)
		message_end()
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_BEAMFOLLOW)
		write_short(id)
		write_short(spr_trail)
		write_byte(20)
		write_byte(5)
		write_byte(0)
		write_byte(200)
		write_byte(255)
		write_byte(130)
		message_end()
		
		set_task(get_pcvar_float(cvar_nade_frost_cool_dur),"stop_freeze_cool",id + TASK_FREEZE_COOL)
		
		ExecuteForward(fwd_user_freeze_cool_post,fwd_return,id)
	}
	
	set_user_godmode(id,0)
	entity_set_int(id,EV_INT_flags,entity_get_int(id,EV_INT_flags) & ~FL_FROZEN)
	
	static origin[3]
	get_user_origin(id,origin)
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_SMOKE)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(spr_smoke)
	write_byte(7)
	write_byte(30)
	message_end()
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_BREAKMODEL)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2] + 24)
	write_coord(16)
	write_coord(16)
	write_coord(16)
	write_coord(random_num(-50,50))
	write_coord(random_num(-50,50))
	write_coord(25)
	write_byte(10)
	write_short(mdl_glassgibs)
	write_byte(14)
	write_byte(30)
	write_byte(0x01)
	message_end()
	
	ExecuteForward(fwd_user_unfreeze_post,fwd_return,id)
}

public stop_freeze_cool(id)
{
	id -= TASK_FREEZE_COOL
	
	if(!is_user_connected(id)) return
	
	ExecuteForward(fwd_user_unfreeze_cool_pre,fwd_return,id)
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(TE_KILLBEAM)
	write_short(id)
	message_end()
	
	message_begin(MSG_ONE_UNRELIABLE,msg_statusicon,{0,0,0},id)
	write_byte(0)
	write_string("dmg_cold")
	message_end()
		
	user_frost_cool[id] = false
	
	set_user_rendering(id,kRenderFxGlowShell, 0,0,0, kRenderTransAlpha, (255 - (get_pcvar_num(cvar_upgrade[1][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][1][UPGRADE_INVISIBILITY])) < 0 ? 0 : 255 - (get_pcvar_num(cvar_upgrade[1][UPGRADE_INVISIBILITY]) * user_upgrade_level[id][1][UPGRADE_INVISIBILITY]))
	
	ExecuteForward(fwd_user_unfreeze_cool_post,fwd_return,id)
}

public grab_block(id)
{
	if((!access(id,ADMIN_BLOCK_MOVE_BATTLE) && !user_build_battle[id] && !can_build) || (!access(id,ADMIN_BLOCK_MOVE_BATTLE) && user_race[id] == 1) || is_banned[id] || (!access(id,ADMIN_BLOCK_MOVE_BATTLE) && !is_user_alive(id)) || freezetime) return PLUGIN_HANDLED
	
	if(is_valid_ent(user_blockent[id]) || freezetime) release_block(id)
	
	static ent,body
	get_user_aiming(id,ent,body)
	
	if(!is_valid_ent(ent) || ent == get_barrierent || ent <= maxplayers) return PLUGIN_HANDLED
	
	static ent_trgname[7],ent_classname[10]
	
	entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
	entity_get_string(ent,EV_SZ_classname,ent_classname,9)
	
	if(equal(ent_trgname,"ignore") || !equal(ent_classname,"func_wall")) return PLUGIN_HANDLED
	
	if(entity_get_int(ent,EV_INT_iuser1))
	{
		ColorChat(id,GREEN,"[VZBB]^x01 This block is locked from moving by an admin.")
		return PLUGIN_HANDLED
	}
	
	if(entity_get_int(ent,EV_INT_iuser2)) return PLUGIN_HANDLED
	
	if(entity_get_float(ent,EV_FL_fuser3) == float(BLOCKS_BLACK))
	{
		ColorChat(id,GREEN,"[VZBB]^x01 Black Blocks can't be moved.")
		return PLUGIN_HANDLED
	}
	
	if(!access(id,ADMIN_BLOCK_MOVE_BATTLE) && get_pcvar_num(cvar_block_claim) && entity_get_int(ent,EV_INT_iuser3) && entity_get_int(ent,EV_INT_iuser3) != id) return PLUGIN_HANDLED
	
	ExecuteForward(fwd_grab_block_pre,fwd_return,id)
	
	if(fwd_return >= FORWARD_CONTINUE) return PLUGIN_HANDLED
	
	new Float:fOrigin[3], iAiming[3], Float:fAiming[3]
	
	get_user_origin(id, iAiming, 3);
	IVecFVec(iAiming, fAiming);
	entity_get_vector(ent, EV_VEC_origin, fOrigin);

	g_fOffset1[id] = fOrigin[0] - fAiming[0];
	g_fOffset2[id] = fOrigin[1] - fAiming[1];
	g_fOffset3[id] = fOrigin[2] - fAiming[2];
	
	user_block_dist[id] = get_user_aiming(id, ent, body);
	
	//client_print(id, print_center, "%f", user_block_dist[id]);
	
	if(user_block_dist[id] < get_pcvar_float(cvar_move_min_dist)) 
		user_block_dist[id] = 64.0;//get_pcvar_float(cvar_move_min_dist)
	
	if(user_block_dist[id] > get_pcvar_float(cvar_move_max_dist)) 
		return PLUGIN_HANDLED
	
	entity_set_int(ent,EV_INT_rendermode,1)
	entity_set_float(ent,EV_FL_renderamt,get_pcvar_float(cvar_block_select_alpha))
	
	if(user_block_color[id][0] != -1.0 && user_block_color[id][1] != -1.0 && user_block_color[id][2] != -1.0)
	{
		entity_set_vector(ent,EV_VEC_rendercolor,user_block_color[id])
	} else {
		static Float:color[3]
	
		color[0] = random_float(0.0,255.0)
		color[1] = random_float(0.0,255.0)
		color[2] = random_float(0.0,255.0)
		
		entity_set_vector(ent,EV_VEC_rendercolor,color)
	}
	
	entity_set_int(ent,EV_INT_iuser2,true)
	
	if(get_pcvar_num(cvar_block_claim))
	{
		if(!entity_get_int(ent,EV_INT_iuser3) && user_block_claims[id] < get_pcvar_num(cvar_block_maxclaims))
		{
			entity_set_int(ent,EV_INT_iuser3,id)
			user_block_claims[id]++
		}
	}
	
	user_blockent[id] = ent
	
	ExecuteForward(fwd_grab_block_post,fwd_return,id)
	
	return PLUGIN_HANDLED
}

public release_block(id)
{
	static ent
	ent = user_blockent[id]
	
	ExecuteForward(fwd_release_block_pre,fwd_return,id)
	
	if(fwd_return >= FORWARD_CONTINUE) return PLUGIN_HANDLED
	
	entity_set_int(ent,EV_INT_iuser2,false)
	
	if(entity_get_float(ent,EV_FL_fuser3))
	{
		entity_set_int(ent,EV_INT_rendermode,1)
		entity_set_float(ent,EV_FL_renderamt,255.0)
	} else {
		entity_set_int(ent,EV_INT_rendermode,floatround(entity_get_float(ent,EV_FL_fuser1)))
		entity_set_float(ent,EV_FL_renderamt,entity_get_float(ent,EV_FL_fuser2))
	}
	
	entity_set_vector(ent,EV_VEC_rendercolor,fun_blocks_colors[floatround(entity_get_float(ent,EV_FL_fuser3))])
	user_blockent[id] = 0
	
	if(entity_get_int(ent,EV_INT_iuser4) != id) check_achievement(id,ACH_BASEBUILDER,0)
	
	entity_set_int(ent,EV_INT_iuser4,id)
	
	ExecuteForward(fwd_release_block_post,fwd_return,id)
	
	return PLUGIN_HANDLED
}

public client_PreThink(id)
{
	if(!is_valid_ent(user_blockent[id]) || (!access(id,ADMIN_BLOCK_MOVE_BATTLE) && !user_build_battle[id] && !can_build && is_user_alive(id))) return
	
	static user_button, ent
	user_button = entity_get_int(id,EV_INT_button)
	ent = user_blockent[id]
	
	if(user_button & IN_ATTACK)
	{
		if(entity_get_float(ent,EV_FL_fuser3) != float(BLOCKS_YELLOW))
		{
			user_block_dist[id] += get_pcvar_float(cvar_move_pull_push_speed)
		} else {
			user_block_dist[id] += (get_pcvar_float(cvar_move_pull_push_speed) * 2)
		}
		
		ExecuteForward(fwd_block_pull_push,fwd_return,id,2)
		
		if(fwd_return >= FORWARD_CONTINUE) return
		
		//user_block_dist[id] += get_pcvar_float(cvar_move_pull_push_speed)
		
		if(user_block_dist[id] > get_pcvar_float(cvar_move_max_dist)) 
		{
			user_block_dist[id] = get_pcvar_float(cvar_move_max_dist)
			client_print(id, print_center, "MAX !!!")
		}
		else
			client_print(id,print_center,"Pushing...")
	} 
	else if(user_button & IN_ATTACK2)
	{
		if(entity_get_float(ent,EV_FL_fuser3) != float(BLOCKS_YELLOW))
		{
			user_block_dist[id] -= get_pcvar_float(cvar_move_pull_push_speed)
		} else {
			user_block_dist[id] -= (get_pcvar_float(cvar_move_pull_push_speed) * 2)
		}
		
		ExecuteForward(fwd_block_pull_push,fwd_return,id,1)
		
		if(fwd_return >= FORWARD_CONTINUE) return
		
		//user_block_dist[id] -= get_pcvar_float(cvar_move_pull_push_speed)
		
		if(user_block_dist[id] < get_pcvar_float(cvar_move_min_dist)) 
		{
			user_block_dist[id] = get_pcvar_float(cvar_move_min_dist)
			client_print(id, print_center, "MIN !!!")
		}
		else
			client_print(id,print_center,"Pulling...")
	}
	
	if(freezetime || ent <= maxplayers || !is_valid_ent(ent) || !is_user_connected(id))
	{
		release_block(id)
		return
	}
	
	new iOrigin[3], iLook[3], Float:fOrigin[3], Float:fLook[3], Float:vMoveTo[3], Float:fLength

	get_user_origin(id, iOrigin, 1);
	IVecFVec(iOrigin, fOrigin);
	get_user_origin(id, iLook, 3);
	IVecFVec(iLook, fLook);

	fLength = get_distance_f(fLook, fOrigin);
	if (fLength == 0.0) fLength = 1.0;

	vMoveTo[0] = (fOrigin[0] + (fLook[0] - fOrigin[0]) * user_block_dist[id] / fLength) + g_fOffset1[id];
	vMoveTo[1] = (fOrigin[1] + (fLook[1] - fOrigin[1]) * user_block_dist[id] / fLength) + g_fOffset2[id];
	vMoveTo[2] = (fOrigin[2] + (fLook[2] - fOrigin[2]) * user_block_dist[id] / fLength) + g_fOffset3[id];
	vMoveTo[2] = float(floatround(vMoveTo[2], floatround_floor));

	entity_set_origin(ent, vMoveTo);
}

public player_item_pre_frame(id)
{
	if(freezetime || !get_user_speed[id] || !is_user_alive(id)) return
	
	static Float:multi
	
	multi = (user_block_frost[id] ? 0.25 : (user_frost_cool[id] ? 0.75 : 1.0))
	
	set_user_maxspeed(id,get_user_speed[id] * multi)
}

public block_teamchange(id)
{
	if(!is_user_connected(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED) return PLUGIN_CONTINUE
	
	return PLUGIN_HANDLED
}

public hook_say(id)
{
	new args[129], arg_cmd[11], arg2[32],arg3[32],arg4[32]
	read_args(args,128)
	remove_quotes(args)
	
	parse(args, arg_cmd,10, arg2,31, arg3,31, arg4,31)
	
	if(get_pcvar_num(cvar_block_user_select_color))
	{
		if(equali(arg_cmd,"/color"))
		{
			if(equal(arg2,""))
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You must enter a valid^x04 RGB^x01 color. Example:^x04 /color 255 255 0^x01 for yellow color.")
			} else if(equal(arg2,"random"))
			{
				user_block_color[id][0] = -1.0
				user_block_color[id][1] = -1.0
				user_block_color[id][2] = -1.0
				
				ColorChat(id,GREEN,"[VZBB]^x01 You have changed your block select color to^x04 Random Color^x01.")
				
				if(user_blockent[id] && is_valid_ent(user_blockent[id]))
				{
					static Float:color[3]
					
					color[0] = random_float(0.0,255.0)
					color[1] = random_float(0.0,255.0)
					color[2] = random_float(0.0,255.0)
					
					entity_set_vector(user_blockent[id],EV_VEC_rendercolor,color)
				}
			} else {
				user_block_color[id][0] = str_to_float(arg2)
				user_block_color[id][1] = str_to_float(arg3)
				user_block_color[id][2] = str_to_float(arg4)
				
				ColorChat(id,GREEN,"[VZBB]^x01 You have changed your block select color to^x04 R G B^x01 -^x04 %i %i %i^x01.",floatround(user_block_color[id][0]),floatround(user_block_color[id][1]),floatround(user_block_color[id][2]))
				
				if(user_blockent[id] && is_valid_ent(user_blockent[id])) entity_set_vector(user_blockent[id],EV_VEC_rendercolor,user_block_color[id])
			}
			
			return
		}
	}
	
	if(!get_pcvar_num(cvar_zclass_nr_select))
	{
		if(equali(arg_cmd,"/class"))
		{
			must_change_zclass[id] = true
			ColorChat(id,GREEN,"[VZBB]^x01 You will change your zombie class in the next round.")
			
			return
		}
	}
	
	if(total_shop_items)
	{
		if(equali(arg_cmd,"/shop") || equali(arg_cmd,"/market") || equali(arg_cmd,"/items"))
		{
			if(is_user_alive(id))
			{
				show_item_menu(id)
			} else {
				ColorChat(id,GREEN,"[VZBB]^x01 You must be alive to use this command.")
			}
			
			return
		}
	}
	
	if(equali(arg_cmd,"/credits"))
	{
		ColorChat(id,GREEN,"[VZBB]^x01 You have^x04 %i^x01 credits.",user_credits[id])
		
		return
	}
	
	if(get_pcvar_num(cvar_ach))
	{
		if(equali(arg_cmd,"/ach") || equali(arg_cmd,"/mystats"))
		{
			show_ach_menu(id)
			
			return
		}
	}
	
	if(equali(arg_cmd,"/unlock"))
	{
		show_unlock_menu(id)
		
		return
	}
	
	if(equali(arg_cmd,"/upgrade"))
	{
		show_upgrade_menu(id)
		
		return
	}
	
	if(get_pcvar_num(maxrounds))
	{
		if(equali(arg_cmd,"/round"))
		{
			ColorChat(0,GREEN,"[VZBB] Round:^x04 %i^x01 of^x04 %i^x01.",total_rounds,get_pcvar_num(maxrounds))
			
			return
		}
	}
	
	if(equali(arg_cmd,"/lock"))
	{
		if(access(id,ADMIN_BLOCK_LOCK) && is_user_alive(id))
		{
			static name[32], ip[16], steamid[32]
			
			get_user_name(id,name,31)
			get_user_ip(id,ip,15,1)
			get_user_authid(id,steamid,31)
			
			static ent,body
			get_user_aiming(id,ent,body)
			
			if(ent == get_barrierent || ent <= maxplayers || !is_valid_ent(ent)) return
			
			static ent_trgname[7],ent_classname[10]
			
			entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
			entity_get_string(ent,EV_SZ_classname,ent_classname,9)
			
			if(equal(ent_trgname,"ignore") || !equal(ent_classname,"func_wall")) return
			
			if(entity_get_int(ent,EV_INT_iuser2)) return
			
			if(!entity_get_int(ent,EV_INT_iuser1))
			{
				user_block_claims[entity_get_int(ent,EV_INT_iuser3)]--
				
				entity_set_int(ent,EV_INT_rendermode,1)
				entity_set_float(ent,EV_FL_renderamt,255.0)
				entity_set_vector(ent,EV_VEC_rendercolor,Float:{255.0,0.0,0.0})
				
				entity_set_int(ent,EV_INT_iuser1,true)
				entity_set_int(ent,EV_INT_iuser2,false)
				entity_set_int(ent,EV_INT_iuser3,0)
				entity_set_int(ent,EV_INT_iuser4,0)
				
				entity_set_float(ent,EV_FL_fuser3,0.0)
			} else {
				entity_set_int(ent,EV_INT_rendermode,floatround(entity_get_float(ent,EV_FL_fuser1)))
				entity_set_float(ent,EV_FL_renderamt,entity_get_float(ent,EV_FL_fuser2))
				entity_set_vector(ent,EV_VEC_rendercolor,Float:{0.0,0.0,0.0})
				
				entity_set_int(ent,EV_INT_iuser1,false)
				entity_set_int(ent,EV_INT_iuser2,false)
				entity_set_int(ent,EV_INT_iuser3,0)
				entity_set_int(ent,EV_INT_iuser4,0)
				
				entity_set_float(ent,EV_FL_fuser3,0.0)
			}
			
			log_to_file(log_file,"%s [IP: %s][STEAMID: %s] locked a block",name,ip,steamid)
		}
		
		return
	}
	
	if(equali(arg_cmd,"/unclaim"))
	{
		if(access(id,ADMIN_BLOCK_UNCLAIM) && is_user_alive(id))
		{
			static name[32], ip[16], steamid[32]
			
			get_user_name(id,name,31)
			get_user_ip(id,ip,15,1)
			get_user_authid(id,steamid,31)
			
			static ent,body
			get_user_aiming(id,ent,body)
			
			if(ent == get_barrierent || ent <= maxplayers || !is_valid_ent(ent)) return
			
			static ent_trgname[7],ent_classname[10]
			
			entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
			entity_get_string(ent,EV_SZ_classname,ent_classname,9)
			
			if(equal(ent_trgname,"ignore") || !equal(ent_classname,"func_wall")) return
			
			if(entity_get_int(ent,EV_INT_iuser2)) return
			
			if(entity_get_int(ent,EV_INT_iuser3))
			{
				user_block_claims[entity_get_int(ent,EV_INT_iuser3)]--
				
				entity_set_int(ent,EV_INT_iuser3,0)
				entity_set_int(ent,EV_INT_iuser4,0)
			}
			
			log_to_file(log_file,"%s [IP: %s][STEAMID: %s] unclaimed a block",name,ip,steamid)
		}
		
		return
	}
	
	if(equali(arg_cmd,"/claim"))
	{
		if(access(id,ADMIN_BLOCK_CLAIM) && is_user_alive(id))
		{
			static name[32], ip[16], steamid[32]
			
			get_user_name(id,name,31)
			get_user_ip(id,ip,15,1)
			get_user_authid(id,steamid,31)
			
			static ent,body
			get_user_aiming(id,ent,body)
			
			if(ent == get_barrierent || ent <= maxplayers || !is_valid_ent(ent)) return
			
			static ent_trgname[7],ent_classname[10]
			
			entity_get_string(ent,EV_SZ_targetname,ent_trgname,6)
			entity_get_string(ent,EV_SZ_classname,ent_classname,9)
			
			if(equal(ent_trgname,"ignore") || !equal(ent_classname,"func_wall")) return
			
			if(entity_get_int(ent,EV_INT_iuser2) || entity_get_int(ent,EV_INT_iuser3)) return
			
			entity_set_int(ent,EV_INT_iuser3,id)
			
			log_to_file(log_file,"%s [IP: %s][STEAMID: %s] claimed a block",name,ip,steamid)
		}
		
		return
	}
	
	if(equali(arg_cmd,"/start"))
	{
		if(access(id,ADMIN_START))
		{
			static name[32], ip[16], steamid[32]
			
			get_user_name(id,name,31)
			get_user_ip(id,ip,15,1)
			get_user_authid(id,steamid,31)
			
			count_build_time = 0
			
			ExecuteForward(fwd_battle_phase_begin_adm,fwd_return,id)
			
			log_to_file(log_file,"%s [IP: %s][STEAMID: %s] started the round",name,ip,steamid)
		}
		
		return
	}
	
	if(get_pcvar_num(cvar_credit_give))
	{
		if(equali(arg_cmd,"/give"))
		{
			new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
			target, num_cred = str_to_num(arg3)
			
			get_user_name(id,name,31)
			get_user_ip(id,ip,15,1)
			get_user_authid(id,steamid,31)
			
			target = cmd_target(id,arg2,0)
			
			get_user_name(target,target_name,31)
			get_user_ip(target,target_ip,15,1)
			get_user_authid(target,target_steamid,31)
			
			if(equal(arg2,""))
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You must enter a name.")
				return
			}
			
			if(!target)
			{
				ColorChat(id,GREEN,"[VZBB]^x01 I can't find player with the name ^x04%s^x01.",arg2)
				return
			}
			
			if(id == target)
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You can't give credits to yourself.")
				return
			}
			
			if(user_credits[id] < num_cred)
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You don't have enough credits.")
				return
			}
			
			if(num_cred <= 0)
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You can give only positive credits.")
				return
			}
			
			user_credits[id] -= num_cred
			user_credits[target] += num_cred
			
			ColorChat(id,GREEN,"[VZBB]^x01 You successfully gave ^x04%i^x01 credits to ^x04%s^x01.",num_cred,target_name)
			ColorChat(target,GREEN,"[VZBB] %s^x01 gave you ^x04%i^x01 credits.",name,num_cred)
			
			ColorChat(0,GREEN,"[VZBB] %s^x01 gave ^x04%i^x01 credits to ^x04%s^x01.",name,num_cred,target_name)
			
			log_to_file(log_file,"%s [IP: %s][STEAMID: %s] gave [%i] credits to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_cred, target_name,target_ip,target_steamid)
			
			return
		}
	}
	
	if(get_pcvar_num(cvar_credit_look))
	{
		if(equali(arg_cmd,"/credit"))
		{
			new target_name[32],target
			target = cmd_target(id,arg2,0)
			get_user_name(target,target_name,31)
			
			if(equal(arg2,""))
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You must enter a name.")
				return
			}
			
			if(!target)
			{
				ColorChat(id,GREEN,"[VZBB]^x01 I can't find player with the name ^x04%s^x01.",arg2)
				return
			}
			
			if(id == target)
			{
				ColorChat(id,GREEN,"[VZBB]^x01 Try the^x04 /ap^x01 command to see your credits.")
				return
			}
			
			ColorChat(id,GREEN,"[VZBB] %s^x01 has ^x04%i^x01 credits.",target_name,user_credits[target])
			
			return
		}
	}
	
	if((equali(arg_cmd,"/respawn") || equali(arg_cmd,"/chance") || equali(arg_cmd,"/revive") || equali(arg_cmd,"/fixspawn")) && is_user_connected(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR && cs_get_user_team(id) != CS_TEAM_UNASSIGNED)
	{
		if(user_race[id] != 2)
		{
			if(!can_build && is_user_alive(id))
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You must be death to use this command.")
				return
			}
			
			ExecuteHamB(Ham_CS_RoundRespawn,id)
		} else {
			if(can_build)
			{
				ExecuteHamB(Ham_CS_RoundRespawn,id)
				return
			}
			
			if(is_user_alive(id))
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You must be death to use this command.")
				return
			}
			
			if(user_credits[id] < get_pcvar_num(cvar_respawn_bchance_cost))
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You don't have enough credits to use this command.")
				return
			}
			
			if(!can_bc_respawn[id])
			{
				ColorChat(id,GREEN,"[VZBB]^x01 You can't use this command now, please wait...")
				return
			}
			
			if(random_num(1,get_pcvar_num(cvar_respawn_bchance)) == get_pcvar_num(cvar_respawn_bchance))
			{
				ExecuteHamB(Ham_CS_RoundRespawn,id)
				check_achievement(id,ACH_UNDEAD,0)
			} else {
				ColorChat(id,GREEN,"[VZBB]^x01 Sorry, you didn't respawn this time. Try again after^x04 %.0f^x01 seconds...",get_pcvar_float(cvar_respawn_bchance_reuse_time))
			}
			
			user_credits[id] -= get_pcvar_num(cvar_respawn_bchance_cost)
			
			can_bc_respawn[id] = false
			set_task(get_pcvar_float(cvar_respawn_bchance_reuse_time),"bc_respawn_reuse",id + TASK_BRESPAWN_REUSE)
		}
		
		return
	}
	
	if(equali(arg_cmd,"/guns"))
	{
		if(user_race[id] != 2)
		{
			ColorChat(id,GREEN,"[VZBB]^x01 Only humans can use this command.")
			return
		}
		
		if(can_build)
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You can use this command only in the^x04 Battle Phase^x01.")
			return
		}
		
		if(selected_weapons[id])
		{
			ColorChat(id,GREEN,"[VZBB]^x01 You have already selected your weapons.")
		} else {
			show_weapon_menu(id)
			
			ColorChat(id,GREEN,"[VZBB]^x01 You weapon menu has been re-enabled successfully.")
		}
		
		return
	}
	
	if(total_shop_items && get_pcvar_num(cvar_round_deal) && round_deal_items)
	{
		if(equali(arg_cmd,"/deal"))
		{
			if(is_user_alive(id))
			{
				show_deal_menu(id)
			} else {
				ColorChat(id,GREEN,"[VZBB]^x01 You must be alive to use this command.")
			}
			
			return
		}
	}
}

public admin_give_credits(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	static arg_name[32],arg_cred[10]
	
	read_argv(1,arg_name,31)
	read_argv(2,arg_cred,9)
	
	static num_cred
	num_cred = str_to_num(arg_cred)
	
	if(num_cred <= 0)
	{
		console_print(id,"[VZBB] You can give only positive credits.")
		return PLUGIN_HANDLED
	}
	
	static type
	type = -1
	
	static target, target_name[32],target_ip[16],target_steamid[32]
	
	if(arg_name[0] != '@')
	{
		target = cmd_target(id,arg_name,0)
		
		if(!target)
		{
			console_print(id,"[VZBB] Invalid player.")
			return PLUGIN_HANDLED
		}
		
		get_user_name(target,target_name,31)
		get_user_ip(target,target_ip,15,1)
		get_user_authid(target,target_steamid,31)
		
		user_credits[target] += num_cred
	} else {
		static i
		for(i=0;i<sizeof short_team_names;i++)
		{
			if(arg_name[1] == short_team_names[i][0])
			{
				type = i
				
				break
			}
		}
		
		if(type == -1)
		{
			console_print(id,"[VZBB] Invalid ^"@^" flag.")
			return PLUGIN_HANDLED
		}
		
		for(i=1;i<=maxplayers;i++)
		{
			if(!is_user_connected(i) || (type && user_race[i] != type)) continue
			
			user_credits[i] += num_cred
		}
	}
	
	static name[32],ip[16],steamid[32]
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	switch(get_pcvar_num(pointer_activity))
	{
		case 1:
		{
			if(type == -1)
			{
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN gave ^x04%s^x01 credits to ^x04%s^x01.",arg_cred,target_name)
			} else {
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN gave ^x04%s^x01 credits to all %s.",arg_cred,long_team_names[type])
			}
		}
		case 2:
		{
			if(type == -1)
			{
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 credits to ^x04%s^x01.",name,arg_cred,target_name)
			} else {
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 credits to all %s.",name,arg_cred,long_team_names[type])
			}
		}
	}
	
	if(type == -1)
	{
		log_to_file(log_file,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] credits to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_cred, target_name,target_ip,target_steamid)
	} else {
		log_to_file(log_file,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] credits to all %s.",name,ip,steamid,num_cred,long_team_names[type])
	}
	
	return PLUGIN_HANDLED
}

public admin_take_credits(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	static arg_name[32],arg_cred[10]
	
	read_argv(1,arg_name,31)
	read_argv(2,arg_cred,9)
	
	static num_cred
	num_cred = str_to_num(arg_cred)
	
	if(num_cred <= 0)
	{
		console_print(id,"[VZBB] You can take only positive credits.")
		return PLUGIN_HANDLED
	}
	
	static type
	type = -1
	
	static target, target_name[32],target_ip[16],target_steamid[32]
	
	if(arg_name[0] != '@')
	{
		target = cmd_target(id,arg_name,0)
		
		if(!target)
		{
			console_print(id,"[VZBB] Invalid player.")
			return PLUGIN_HANDLED
		}
		
		get_user_name(target,target_name,31)
		get_user_ip(target,target_ip,15,1)
		get_user_authid(target,target_steamid,31)
		
		user_credits[target] = max(user_credits[target] - num_cred,0)
	} else {
		static i
		for(i=0;i<sizeof short_team_names;i++)
		{
			if(arg_name[1] == short_team_names[i][0])
			{
				type = i
				
				break
			}
		}
		
		if(type == -1)
		{
			console_print(id,"[VZBB] Invalid ^"@^" flag.")
			return PLUGIN_HANDLED
		}
		
		for(i=1;i<=maxplayers;i++)
		{
			if(!is_user_connected(i) || (type && user_race[i] != type)) continue
			
			user_credits[i] = max(user_credits[i] - num_cred,0)
		}
	}
	
	static name[32],ip[16],steamid[32]
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	switch(get_pcvar_num(pointer_activity))
	{
		case 1:
		{
			if(type == -1)
			{
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN took ^x04%s^x01 credits from ^x04%s^x01.",arg_cred,target_name)
			} else {
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN took ^x04%s^x01 credits from all %s.",arg_cred,long_team_names[type])
			}
		}
		case 2:
		{
			if(type == -1)
			{
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 credits from ^x04%s^x01.",name,arg_cred,target_name)
			} else {
				ColorChat(0,GREEN,"[VZBB]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 credits from all %s.",name,arg_cred,long_team_names[type])
			}
		}
	}
	
	if(type == -1)
	{
		log_to_file(log_file,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] credits from %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_cred, target_name,target_ip,target_steamid)
	} else {
		log_to_file(log_file,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] credits from all %s.",name,ip,steamid,num_cred,long_team_names[type])
	}
	
	return PLUGIN_HANDLED
}

public admin_ban_user(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	new arg_name[32],arg_reason[128]
	
	read_argv(1,arg_name,31)
	read_argv(2,arg_reason,127)
	
	if(equal(arg_name,""))
	{
		console_print(id,"[VZBB] You should enter valid name / #userid.")
		return PLUGIN_HANDLED
	}
	
	static name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32], target
	target = cmd_target(id,arg_name)
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	get_user_name(target,target_name,31)
	get_user_ip(target,target_ip,15,1)
	get_user_authid(target,target_steamid,31)
	
	if(!target)
	{
		console_print(id,"[VZBB] Invalid player.")
		return PLUGIN_HANDLED
	}
	
	if(is_banned[target])
	{
		console_print(id,"[VZBB] This player is already banned.")
		return PLUGIN_HANDLED
	}
	
	is_banned[target] = true
	
	formatex(user_banreason[target],128,"%s",arg_reason)
	
	log_to_file(log_file,"ADMIN %s [IP: %s][STEAMID: %s] banned %s [IP: %s][STEAMID: %s] [REASON: %s].",name,ip,steamid, target_name,target_ip,target_steamid, arg_reason)
	
	switch(get_pcvar_num(pointer_activity))
	{
		case 1: ColorChat(0,GREEN,"[VZBB]^x01 ADMIN banned ^x04%s^x01's block moving (reason:^x04 %s^x01).",target_name,arg_reason)
		case 2: ColorChat(0,GREEN,"[VZBB]^x01 ADMIN^x04 %s^x01 banned ^x04%s^x01's block moving (reason:^x04 %s^x01).",name,target_name,arg_reason)
	}
	
	return PLUGIN_HANDLED
}

public admin_unban_user(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	new arg_name[32]
	
	read_argv(1,arg_name,31)
	
	if(equal(arg_name,""))
	{
		console_print(id,"[VZBB] You should enter valid name / #userid.")
		return PLUGIN_HANDLED
	}
	
	static name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32], target
	target = cmd_target(id,arg_name)
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	get_user_name(target,target_name,31)
	get_user_ip(target,target_ip,15,1)
	get_user_authid(target,target_steamid,31)
	
	if(!target)
	{
		console_print(id,"[VZBB] Invalid player.")
		return PLUGIN_HANDLED
	}
	
	if(!is_banned[target])
	{
		console_print(id,"[VZBB] This player is not banned.")
		return PLUGIN_HANDLED
	}
	
	is_banned[target] = false
	formatex(user_banreason[target],128,"")
	
	log_to_file(log_file,"ADMIN %s [IP: %s][STEAMID: %s] unbanned %s [IP: %s][STEAMID: %s].",name,ip,steamid, target_name,target_ip,target_steamid)
	
	switch(get_pcvar_num(pointer_activity))
	{
		case 1: ColorChat(0,GREEN,"[VZBB]^x01 ADMIN unbanned ^x04%s^x01's block moving.",target_name)
		case 2: ColorChat(0,GREEN,"[VZBB]^x01 ADMIN^x04 %s^x01 unbanned ^x04%s^x01's block moving.",name,target_name)
	}
	
	return PLUGIN_HANDLED
}

public admin_mrs_addent(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	if(get_barrierent)
	{
		console_print(id,"[VZBB] VZBB Map Repair System: This map have already has a barrier!")
		return PLUGIN_HANDLED
	}
	
	static ent,body
	get_user_aiming(id,ent,body)
	
	if(!is_valid_ent(ent)) return PLUGIN_HANDLED
	
	static file
	file = fopen(mrs_file,"at")
	
	if(!file) return PLUGIN_HANDLED
	
	static current_map[64]
	get_mapname(current_map,63)
	
	fprintf(file,"^"%s^" ^"%i^"^n",current_map,ent)
	fclose(file)
	
	get_barrierent = ent
	
	console_print(id,"[VZBB] VZBB Map Repair System: Entity successfully added! This will take effect on the next round.")
	
	return PLUGIN_HANDLED
}

public bc_respawn_reuse(id)
{
	id -= TASK_BRESPAWN_REUSE
	
	if(!is_user_connected(id)) return
	
	can_bc_respawn[id] = true
}

public client_putinserver(id)
{
	set_task(0.1,"load_user_data",id)
	set_task(5.0,"respawn_check",id)
	
	if(is_user_bot(id) && !bots_reg && bots_cvar)
	{
		set_task(0.2,"load_bot_data",id)
	} else {
		set_task(8.0,"show_adv_message",id)
	}
}

public respawn_check(id)
{
	if(!is_user_connected(id)) return
	
	if(!is_user_alive(id))
	{
		if(cs_get_user_team(id) == CS_TEAM_T || cs_get_user_team(id) == CS_TEAM_CT) set_task(get_pcvar_float(cvar_respawn_time),"respawn",id)
	} else {
		set_task(5.0,"respawn_check",id)
	}
}
    
public load_bot_data(id)
{
	if(!is_user_connected(id) || !get_pcvar_num(bots_cvar) || bots_reg) return
	
	RegisterHamFromEntity(Ham_Spawn,id,"player_spawn",1)
	RegisterHamFromEntity(Ham_TakeDamage,id,"player_take_damage")
	
	bots_reg = true
	if(is_user_alive(id)) player_spawn(id)
}

public show_adv_message(id)
{
	if(!is_user_connected(id)) return
	
	ColorChat(id,GREEN,"[VZBB]^x01 Welcome to^x04 <VeCo>'s Zombie BaseBuilder Mod^x01 v^x04 4.3^x01. Mod by^x04 <VeCo>^x01. Have fun!.")
}

public load_user_data(id)
{
	if(!is_user_connected(id)) return
	
	formatex(user_banreason[id],127,"")
	
	user_credits[id] = get_pcvar_num(cvar_credit_start)
	
	static i
	for(i=1;i<sizeof name_weapons;i++) if(get_pcvar_num(cvar_unlock[i])) user_unlock[id][i] = 1
	
	user_race[id] = 0
	user_class[id] = -1
	can_select_zclass[id] = true
	must_change_zclass[id] = true
	selected_weapons[id] = false
	
	user_block_color[id][0] = float(cvar_get_select_color[0])
	user_block_color[id][1] = float(cvar_get_select_color[1])
	user_block_color[id][2] = float(cvar_get_select_color[2])
	
	set_user_info(id,"model",human_models[random(sizeof human_models)])
	
	get_data(id)
}

public get_data(id)
{
#if !defined SQL
	static user_data[32], vault_key[41],vault_data[4096], vault_timestamp,
	str_credits[10],str_banned[2],str_unlock[50],str_upgrades_z[4096],str_upgrades_h[4096],
	str_ach_prog[4096],str_ach_level[4096]
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1:
		{
			get_user_authid(id,user_data,31)
			formatex(vault_key,40,"[authid]%s",user_data)
		}
		case 2:
		{
			get_user_ip(id,user_data,15,1)
			formatex(vault_key,40,"[ip]%s",user_data)
		}
		default:
		{
			get_user_name(id,user_data,31)
			formatex(vault_key,40,"[name]%s",user_data)
		}
	}
	
	if(!nvault_lookup(vault, vault_key,vault_data,255, vault_timestamp))
	{
		must_save[id] = true
		return
	}
	
	nvault_get(vault, vault_key,vault_data,4095)
	replace_all(vault_data,4095,"#"," ")
	
	parse(vault_data, str_credits,10, str_banned,1, str_unlock,49, str_upgrades_z,4095, str_upgrades_h,4095, str_ach_prog,4095, str_ach_level,4095)
	
	user_credits[id] = str_to_num(str_credits)
	is_banned[id] = str_to_num(str_banned)
	
	static i, str_data[4096]
	
	i = 1
	
	while(str_unlock[0] && strtok(str_unlock, str_data,4095, str_unlock,49, ','))
	{
		trim(str_data)
		
		user_unlock[id][i] = str_to_num(str_data)
		
		i++
		
		if(i == sizeof name_weapons) break
	}
	
	i = 0
	
	while(str_upgrades_z[0] && strtok(str_upgrades_z, str_data,4095, str_upgrades_z,4095, ','))
	{
		trim(str_data)
		
		user_upgrade_level[id][1][i] = str_to_num(str_data)
		
		i++
		
		if(i == MAX_UPGRADES) break
	}
	
	i = 0
	
	while(str_upgrades_h[0] && strtok(str_upgrades_h, str_data,4095, str_upgrades_h,4095, ','))
	{
		trim(str_data)
		
		user_upgrade_level[id][2][i] = str_to_num(str_data)
		
		i++
		
		if(i == MAX_UPGRADES) break
	}
	
	i = 0
	
	while(str_ach_prog[0] && strtok(str_ach_prog, str_data,4095, str_ach_prog,4095, ','))
	{
		trim(str_data)
		
		user_ach_progress[id][i] = str_to_num(str_data)
		
		i++
		
		if(i == MAX_ACH) break
	}
	
	i = 0
	
	while(str_ach_level[0] && strtok(str_ach_level, str_data,4095, str_ach_level,4095, ','))
	{
		trim(str_data)
		
		user_ach_level[id][i] = str_to_num(str_data)
		
		i++
		
		if(i == MAX_ACH) break
	}
	
	must_save[id] = true
#else
	new user_data[64], str_query[512], data[1]
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1: get_user_authid(id,user_data,63)
		case 2: get_user_ip(id,user_data,15,1)
		default:
		{
			get_user_name(id,user_data,63)
			
#if !defined NEW_CHAR_ESCAPE
			replace_all(user_data,31,"^"^^^"","6")
			replace_all(user_data,31,"*","8")
			replace_all(user_data,31,":","0")
			replace_all(user_data,31,"-","4")
			replace_all(user_data,31,"=","5")
			replace_all(user_data,31,">","7")
			replace_all(user_data,31,"<","1")
			replace_all(user_data,31,"?","3")
			replace_all(user_data,31,"'","2")
#else
			replace_all(user_data,63,"'","\'")
#endif
		}
	}
	
	data[0] = id
	
	formatex(str_query,511,"SELECT * FROM `vzbb_mod_userdata` WHERE (`vzbb_mod_userdata`.`userdata` = '%s')",user_data)
	SQL_ThreadQuery(mysql_tuple,"mysql_edit_table",str_query, data,1)
#endif
}

#if defined SQL
public mysql_edit_table(failstate,Handle:query,error[],errcode,data[],datasize)
{
	switch(failstate)
	{
		case TQUERY_CONNECT_FAILED: log_amx("Connection to database failed! Error: %i : %s",errcode,error)
		case TQUERY_QUERY_FAILED: log_amx("Loading query failed! Error: %i : %s",errcode,error)
	}
	
	static id
	id = data[0]
	
	if(SQL_NumResults(query) < 1)
	{
		static user_data[64], str_query[4096], precache_str[4096],cache_str[4096]
		
		switch(get_pcvar_num(cvar_data_save_type))
		{
			case 1: get_user_authid(id,user_data,63)
			case 2: get_user_ip(id,user_data,15,1)
			default:
			{
				get_user_name(id,user_data,63)
				
#if !defined NEW_CHAR_ESCAPE
				replace_all(user_data,31,"^"^^^"","6")
				replace_all(user_data,31,"*","8")
				replace_all(user_data,31,":","0")
				replace_all(user_data,31,"-","4")
				replace_all(user_data,31,"=","5")
				replace_all(user_data,31,">","7")
				replace_all(user_data,31,"<","1")
				replace_all(user_data,31,"?","3")
				replace_all(user_data,31,"'","2")
#else
				replace_all(user_data,63,"'","\'")
#endif
			}
		}
		
		static i
		for(i=1;i<sizeof name_weapons;i++)
		{
			formatex(precache_str,4095,"%i%s",get_pcvar_num(cvar_unlock[i]),i != (sizeof name_weapons - 1) ? "," : "")
			add(cache_str,4095,precache_str)
		}
		
		formatex(str_query,4095,"INSERT INTO `vzbb_mod_userdata` (`userdata`,`credits`,`isbanned`,`banreason`,`unlocks`,`upgrades_z`,`upgrades_h`,`ach_prog`,`ach_level`) VALUES ('%s','%i','0','','%s','0,0,0,0,0,0,0','0,0,0,0,0,0,0','0,0,0,0,0,0,0,0,0,0,0,0','0,0,0,0,0,0,0,0,0,0,0,0');",user_data,get_pcvar_num(cvar_credit_start),cache_str)
		SQL_ThreadQuery(mysql_tuple,"mysql_ignore",str_query)
	} else {
		user_credits[id] = SQL_ReadResult(query,1)
		is_banned[id] = SQL_ReadResult(query,2)
		
		static i, str_data[4096],
		str_unlock[50],str_upgrades_z[4096],str_upgrades_h[4096],str_ach_prog[4096],str_ach_level[4096]
		
		i = 1
		
		SQL_ReadResult(query,4, str_unlock,49)
		SQL_ReadResult(query,5, str_upgrades_z,4095)
		SQL_ReadResult(query,6, str_upgrades_h,4095)
		SQL_ReadResult(query,7, str_ach_prog,4095)
		SQL_ReadResult(query,8, str_ach_level,4095)
		
		while(str_unlock[0] && strtok(str_unlock, str_data,4095, str_unlock,49, ','))
		{
			trim(str_data)
			
			user_unlock[id][i] = str_to_num(str_data)
			
			i++
			
			if(i == sizeof name_weapons) break
		}
		
		i = 0
		
		while(str_upgrades_z[0] && strtok(str_upgrades_z, str_data,4095, str_upgrades_z,4095, ','))
		{
			trim(str_data)
			
			user_upgrade_level[id][1][i] = str_to_num(str_data)
			
			i++
			
			if(i == MAX_UPGRADES) break
		}
		
		i = 0
		
		while(str_upgrades_h[0] && strtok(str_upgrades_h, str_data,4095, str_upgrades_h,4095, ','))
		{
			trim(str_data)
			
			user_upgrade_level[id][2][i] = str_to_num(str_data)
			
			i++
			
			if(i == MAX_UPGRADES) break
		}
		
		i = 0
		
		while(str_ach_prog[0] && strtok(str_ach_prog, str_data,4095, str_ach_prog,4095, ','))
		{
			trim(str_data)
			
			user_ach_progress[id][i] = str_to_num(str_data)
			
			i++
			
			if(i == MAX_ACH) break
		}
		
		i = 0
		
		while(str_ach_level[0] && strtok(str_ach_level, str_data,4095, str_ach_level,4095, ','))
		{
			trim(str_data)
			
			user_ach_level[id][i] = str_to_num(str_data)
			
			i++
			
			if(i == MAX_ACH) break
		}
	}
	
	must_save[id] = true
}

public mysql_ignore(failstate,Handle:query,error[],errcode,data[],datasize)
{
	SQL_FreeHandle(query)
	return PLUGIN_HANDLED
}
#endif

public set_data(id)
{
#if !defined SQL
	static user_data[32], vault_key[41],vault_data[4096], cache_str[4096]
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1:
		{
			get_user_authid(id,user_data,31)
			formatex(vault_key,40,"[authid]%s",user_data)
		}
		case 2:
		{
			get_user_ip(id,user_data,15,1)
			formatex(vault_key,40,"[ip]%s",user_data)
		}
		default:
		{
			get_user_name(id,user_data,31)
			formatex(vault_key,40,"[name]%s",user_data)
		}
	}
	
	if(get_pcvar_num(cvar_credit_limit)) user_credits[id] = min(user_credits[id],get_pcvar_num(cvar_credit_limit))
	formatex(vault_data,4095,"%i#%i#",user_credits[id],is_banned[id])
	
	static i
	for(i=1;i<sizeof name_weapons;i++)
	{
		formatex(cache_str,4095,"%i%s",user_unlock[id][i],i != (sizeof name_weapons - 1) ? "," : "")
		add(vault_data,4095,cache_str)
	}
	
	add(vault_data,255,"#")
	
	for(i=0;i<MAX_UPGRADES;i++)
	{
		formatex(cache_str,4095,"%i%s",user_upgrade_level[id][1][i],i != (MAX_UPGRADES - 1) ? "," : "")
		add(vault_data,4095,cache_str)
	}
	
	add(vault_data,255,"#")
	
	for(i=0;i<MAX_UPGRADES;i++)
	{
		formatex(cache_str,4095,"%i%s",user_upgrade_level[id][2][i],i != (MAX_UPGRADES - 1) ? "," : "")
		add(vault_data,4095,cache_str)
	}
	
	add(vault_data,255,"#")
	
	for(i=0;i<MAX_ACH;i++)
	{
		formatex(cache_str,4095,"%i%s",user_ach_progress[id][i],i != (MAX_ACH - 1) ? "," : "")
		add(vault_data,4095,cache_str)
	}
	
	add(vault_data,255,"#")
	
	for(i=0;i<MAX_ACH;i++)
	{
		formatex(cache_str,4095,"%i%s",user_ach_level[id][i],i != (MAX_ACH - 1) ? "," : "")
		add(vault_data,4095,cache_str)
	}
	
	add(vault_data,255,"#")
	
	nvault_set(vault, vault_key,vault_data)
#else
	static user_data[64], str_query[4096], precache_str[4096],cache_str[5][4096], ii
	
	for(ii=0;ii<5;ii++) formatex(cache_str[ii],4095,"")
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1: get_user_authid(id,user_data,63)
		case 2: get_user_ip(id,user_data,15,1)
		default:
		{
			get_user_name(id,user_data,63)
			
#if !defined NEW_CHAR_ESCAPE
			replace_all(user_data,31,"^"^^^"","6")
			replace_all(user_data,31,"*","8")
			replace_all(user_data,31,":","0")
			replace_all(user_data,31,"-","4")
			replace_all(user_data,31,"=","5")
			replace_all(user_data,31,">","7")
			replace_all(user_data,31,"<","1")
			replace_all(user_data,31,"?","3")
			replace_all(user_data,31,"'","2")
#else
			replace_all(user_data,63,"'","\'")
#endif
		}
	}
	
	static i
	for(i=1;i<sizeof name_weapons;i++)
	{
		formatex(precache_str,4095,"%i%s",user_unlock[id][i],i != (sizeof name_weapons - 1) ? "," : "")
		add(cache_str[0],4095,precache_str)
	}
	
	for(i=0;i<MAX_UPGRADES;i++)
	{
		formatex(precache_str,4095,"%i%s",user_upgrade_level[id][1][i],i != (MAX_UPGRADES - 1) ? "," : "")
		add(cache_str[1],4095,precache_str)
		
		formatex(precache_str,4095,"%i%s",user_upgrade_level[id][2][i],i != (MAX_UPGRADES - 1) ? "," : "")
		add(cache_str[2],4095,precache_str)
	}
	
	for(i=0;i<MAX_ACH;i++)
	{
		formatex(precache_str,4095,"%i%s",user_ach_progress[id][i],i != (MAX_ACH - 1) ? "," : "")
		add(cache_str[3],4095,precache_str)
		
		formatex(precache_str,4095,"%i%s",user_ach_level[id][i],i != (MAX_ACH - 1) ? "," : "")
		add(cache_str[4],4095,precache_str)
	}
	
	if(get_pcvar_num(cvar_credit_limit)) user_credits[id] = min(user_credits[id],get_pcvar_num(cvar_credit_limit))
	
	formatex(str_query,4095,"UPDATE `vzbb_mod_userdata` SET `credits` = '%i',`isbanned` = '%i',`banreason` = '%s',`unlocks` = '%s',`upgrades_z` = '%s',`upgrades_h` = '%s',`ach_prog` = '%s',`ach_level` = '%s' WHERE `vzbb_mod_userdata`.`userdata` = '%s';",user_credits[id],is_banned[id],user_banreason[id], cache_str[0],cache_str[1],cache_str[2],cache_str[3],cache_str[4], user_data)
	SQL_ThreadQuery(mysql_tuple,"mysql_ignore",str_query)
#endif
}

public client_disconnected(id)
{
	if(must_save[id])
	{
		set_data(id)
		must_save[id] = false
	}
	
	if(is_valid_ent(user_blockent[id])) release_block(id)
	
	was_zombie[id] = false
	
	is_banned[id] = 0
	formatex(user_banreason[id],127,"")
	
	can_bc_respawn[id] = 0
	user_race[id] = 0
	user_credits[id] = 0
	
	static i
	for(i=1;i<sizeof name_weapons;i++) user_unlock[id][i] = 0
	
	for(i=0;i<MAX_UPGRADES;i++)
	{
		user_upgrade_level[id][1][i] = 0
		user_upgrade_level[id][2][i] = 0
	}
	
	user_upgrade_last_race[id] = 0
	user_buy_last_race[id] = 0
	
	user_race[id] = 0
	user_class[id] = -1
	can_select_zclass[id] = false
	must_change_zclass[id] = false
	selected_weapons[id] = false
	
	for(i=0;i<3;i++) user_block_color[id][i] = 0.0
	
	user_blockent[id] = 0
	user_block_dist[id] = 0.0
	user_block_claims[id] = 0
	user_build_battle[id] = false
	user_fire_atk[id] = 0
	user_played_seconds[id] = 0
	
	for(i=0;i<MAX_ACH;i++)
	{
		user_ach_progress[id][i] = 0
		user_ach_level[id][i] = 0
	}
}

public plugin_cfg()
{
	new cfgfile[44]
	
	formatex(cfgfile,43,"addons/amxmodx/configs/vzbb_mod_general.cfg")
	
	if(file_exists(cfgfile))
	{
		server_cmd("exec %s", cfgfile)
	} else {
		log_amx("[VZBB] ERROR: File configs/vzbb_mod_general doesn't exist!")
		log_amx("[VZBB] Default CVAR values will be loaded instead.")
	}
	
	formatex(cfgfile,43,"addons/amxmodx/configs/vzbb_mod_weapons.cfg",sv_backslash_str,sv_backslash_str,sv_backslash_str)
	
	if(file_exists(cfgfile))
	{
		server_cmd("exec %s", cfgfile)
	} else {
		log_amx("[VZBB] ERROR: File configs/vzbb_mod_weapons doesn't exist!")
		log_amx("[VZBB] Default CVAR values will be loaded instead.")
	}
	
	formatex(cfgfile,43,"addons/amxmodx/configs/vzbb_mod_achieve.cfg",sv_backslash_str,sv_backslash_str,sv_backslash_str)
	
	if(file_exists(cfgfile))
	{
		server_cmd("exec %s", cfgfile)
	} else {
		log_amx("[VZBB] ERROR: File configs/vzbb_mod_achieve doesn't exist!")
		log_amx("[VZBB] Default CVAR values will be loaded instead.")
	}
	
	formatex(cfgfile,43,"addons/amxmodx/configs/vzbb_mod_unlock.cfg",sv_backslash_str,sv_backslash_str,sv_backslash_str)
	
	if(file_exists(cfgfile))
	{
		server_cmd("exec %s", cfgfile)
	} else {
		log_amx("[VZBB] ERROR: File configs/vzbb_mod_unlock doesn't exist!")
		log_amx("[VZBB] Default CVAR values will be loaded instead.")
	}
	
	formatex(cfgfile,43,"addons/amxmodx/configs/vzbb_mod_upgrade.cfg",sv_backslash_str,sv_backslash_str,sv_backslash_str)
	
	if(file_exists(cfgfile))
	{
		server_cmd("exec %s", cfgfile)
	} else {
		log_amx("[VZBB] ERROR: File configs/vzbb_mod_upgrade doesn't exist!")
		log_amx("[VZBB] Default CVAR values will be loaded instead.")
	}
	
	formatex(cfgfile,43,"addons/amxmodx/configs/vzbb_mod_items.cfg",sv_backslash_str,sv_backslash_str,sv_backslash_str)
	
	if(file_exists(cfgfile))
	{
		server_cmd("exec %s", cfgfile)
	} else {
		log_amx("[VZBB] ERROR: File configs/vzbb_mod_items doesn't exist!")
		log_amx("[VZBB] Default CVAR values will be loaded instead.")
	}
}

public check_achievement(id,ach_id,ignore_reset)
{
	if(!get_pcvar_num(cvar_ach) || user_ach_level[id][ach_id] == ACH_LEVEL_RED) return
	
	user_ach_progress[id][ach_id]++
	
	if(user_ach_progress[id][ach_id] == get_pcvar_num(cvar_ach_get[ach_id][user_ach_level[id][ach_id] + 1]))
	{
		if(!ignore_reset) user_ach_progress[id][ach_id] = 0
		user_ach_level[id][ach_id]++
		
		user_credits[id] += get_pcvar_num(cvar_ach_price[user_ach_level[id][ach_id]])
		
		static name[32]
		get_user_name(id,name,31)
		
		switch(user_ach_level[id][ach_id])
		{
			case 1: ColorChat(0,GREY,"^x04[VZBB] %s^x01 has achieved^x03 %s^x01 !",name,ach_name[ach_id])
			case 2: ColorChat(0,GREEN,"[VZBB] %s^x01 has achieved %s !",name,ach_name[ach_id])
			case 3: ColorChat(0,RED,"^x04[VZBB] %s^x01 has achieved^x03 %s^x01 !",name,ach_name[ach_id])
		}
	}
}

/*START - From colorchat.inc by Numb */
ColorChat(id, Color:type, const msg[], {Float, Sql, Result,_}:...) {
	new message[256]

	switch(type) {
		case NORMAL: message[0] = 0x01
		case GREEN: message[0] = 0x04
		default: message[0] = 0x03
	}

	vformat(message[1], 251, msg, 4)

	message[192] = '^0'

	new team, ColorChange, index, MSG_Type

	if(id) {
		MSG_Type = MSG_ONE
		index = id
	} else {
		index = FindPlayer()
		MSG_Type = MSG_ALL
	}

	team = get_user_team(index)
	ColorChange = ColorSelection(index, MSG_Type, type)

	ShowColorMessage(index, MSG_Type, message)

	if(ColorChange)
		Team_Info(index, MSG_Type, TeamName[team])
}

ShowColorMessage(id, type, message[]) {
	static bool:saytext_used
	static get_user_msgid_saytext

	if(!saytext_used) {
		get_user_msgid_saytext = get_user_msgid("SayText")
		saytext_used = true
	}

	message_begin(type, get_user_msgid_saytext, _, id)
	write_byte(id)
	write_string(message)
	message_end()
}

Team_Info(id, type, team[]) {
	static bool:teaminfo_used
	static get_user_msgid_teaminfo

	if(!teaminfo_used) {
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo")
		teaminfo_used = true
	}

	message_begin(type, get_user_msgid_teaminfo, _, id)
	write_byte(id)
	write_string(team)
	message_end()

	return 1
}

ColorSelection(index, type, Color:Type) {
	switch(Type) {
		case RED: return Team_Info(index, type, TeamName[1])
		case BLUE: return Team_Info(index, type, TeamName[2])
		case GREY: return Team_Info(index, type, TeamName[0])
	}

	return 0
}

FindPlayer() {
	static i
	i = -1

	while(i <= get_maxplayers()) {
		if(is_user_connected(++i))
			return i
	}

	return -1
}

// Credits OciXCrom
precache_player_model(szModel[])
{
    static szFile[128]
    formatex(szFile, charsmax(szFile), "models/player/%s/%s.mdl", szModel, szModel)
    precache_model(szFile)
    replace(szFile, charsmax(szFile), ".mdl", "T.mdl")
    
    if(file_exists(szFile))
        precache_model(szFile)
}

Потребителски аватар

Автор на темата
EMKA POWER
Потребител
Потребител
Мнения: 57
Регистриран: 12 мар 2018, 22:31
Се отблагодари: 2 пъти

Заявки за vip модел на мод BaseBuilder

Мнение от EMKA POWER » 11 сеп 2018, 22:58

Добре всичко поставено,компирирано,сложено на съответните места ,рестартиране на сървъра, даже сменянане на мапа пак нищо ако можете да използваме team wiver друго не ми остава. ;(
EMKA POWER

Потребителски аватар

Huehue 2MF4TH;
Модератор
Модератор
Мнения: 97
Регистриран: 16 яну 2017, 23:42
Се отблагодари: 2 пъти
Получена благодарност: 7 пъти

Заявки за vip модел на мод BaseBuilder

Мнение от Huehue 2MF4TH; » 14 сеп 2018, 10:37

Обновил съм кода в горното си мнение, тествай го него.

Отговори

Върни се в “Заявки за плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Няма регистрирани потребители и 4 госта