www.pudn.com > MetaHook2.0.rar > NewZBUI_HMS.sma, change:2011-09-11,size:8853b


/* 本插件由 AMXX-Studio 中文版自动生成 */ 
/* UTF-8 func by www.DT-Club.net */ 
 
#include <amxmodx> 
#include <fakemeta> 
#include <hamsandwich> 
#include <metahook> 
#include <nst_zombie> 
#include <nst_player> 
#include <nst_wpn> 
#define PLUGIN_NAME	"ZB3NewUI" 
#define PLUGIN_VERSION	"1.0" 
#define PLUGIN_AUTHOR	"Csoldjb" 
//messgge 
new g_msgScreenFade 
new g_Empty 
const Float:accshoot_colddown=8.0        //acc shoot time 
const Float:speedup_time=12.0           //speed up time 
const Float:speedup_colddown=6.0         //slow down time 
const Float:speedup_1=400.0           //speed up speed 
const Float:speedup_2=140.0            //slow down speed 
const Float:up_time=15.0               //up time 
 
new const heart_beat[]="items/speedup_heartbeat.wav" 
new const speedup_sound[]="items/speedup.wav" 
new const speedup_breath_male[]="items/human_breath_male.wav" 
new const speedup_breath_female[]="items/human_breath_female.wav" 
new const skull_start[]="items/skullstart.wav" 
 
new g_accshoot[33] 
new g_shoot_status[33] 
new g_melee[33] 
new k_player_statue[33] 
 
new player_status[33] 
new g_speed[33] 
new sound_file[33][32] 
 
new Debug 
public plugin_natives() 
{ 
	register_native("djb_newzbui_zbu","reset_value3",1) 
} 
	 
public plugin_init() 
{ 
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); 
	 
	//ClCmd 
	register_concmd("accshoot","check_shoot") 
	register_concmd("speedup","check_speed") 
	register_concmd("meleeup","check_melee") 
	register_dictionary("nst_zombie.txt") 
	 
	//Message 
	g_msgScreenFade=get_user_msgid("ScreenFade") 
	 
	//Logevent 
	register_logevent("reset_value",2,"1=Round_Start") 
	register_event("HLTV","reset_value2","a","1=0","2=0") 
	 
	//Forward & Hamsandwich 
	register_forward(FM_TraceLine, "traceline_forward") 
	register_forward(FM_PlayerPreThink,"Speed_Setting") 
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") 
} 
//////////////////////RESET//////////////////////// 
public reset_value2() 
{ 
	new mod=nst_get_mod_runing() 
	if(mod==NST_MOD_ZB3) 
	{ 
		for(new i=1;i<=32;i++) 
		if(MH_IsMetaHookPlayer(i)) 
		{ 
			MH_NewZBUI(i,"hs_speed",1,1,1,1,99.0,1) 
			MH_NewZBUI(i,"hs_headshot",2,1,2,1,99.0,1) 
			MH_NewZBUI(i,"hs_meleeup",3,1,3,1,99.0,1) 
			MH_NewZBUI(i,"hs_meleeup",1,4,1,1,0.0,1) 
			remove_task(i+2000) 
			remove_task(i+1000) 
			remove_task(i+888) 
			remove_task(i) 
		} 
	} 
} 
public reset_value3(i) 
{ 
	g_accshoot[i]=0 
	g_shoot_status[i]=0 
	g_speed[i]=0 
	player_status[i]=0 
	g_melee[i]=0 
	k_player_statue[i]=0 
	remove_task(i+2000) 
	remove_task(i+1000) 
	remove_task(i+888) 
	remove_task(i) 
	Fade_Icon(i)			 
	set_task(1.0,"Fade_Icon",i,"",0,"a",3) 
	set_task(4.1,"Fade_Icon_End",i) 
} 
	 
public reset_value() 
{ 
	new mod=nst_get_mod_runing() 
	if(mod==NST_MOD_ZB3) 
	{ 
		for(new i=1;i<=32;i++) 
		{ 
			g_accshoot[i]=0 
			g_shoot_status[i]=0 
			g_speed[i]=0 
			player_status[i]=0 
			g_melee[i] 
			k_player_statue[i]=0 
			if(MH_IsMetaHookPlayer(i)) 
			{ 
				Fade_Icon(i)			 
				set_task(1.0,"Fade_Icon",i,"",0,"a",3) 
				set_task(4.1,"Fade_Icon_End",i) 
			} 
		} 
	} 
} 
/////////////////////////MetaHook////////////////////// 
public Fade_Icon(id) 
{ 
	MH_NewZBUI(id,"hs_speed",1,3,1,1,1.0,1) 
	MH_NewZBUI(id,"hs_headshot",2,3,2,1,1.0,1) 
	MH_NewZBUI(id,"hs_meleeup",3,3,3,1,1.0,1) 
} 
public Fade_Icon_End(id) 
{ 
	MH_NewZBUI(id,"hs_speed",1,1,1,1,99.0,1) 
	MH_NewZBUI(id,"hs_headshot",2,1,2,1,99.0,1) 
	MH_NewZBUI(id,"hs_meleeup",3,1,3,1,99.0,1) 
} 
	 
//////////////////////BIND KEY////////////////////// 
public client_putinserver(id) 
{ 
	if(Debug == 1) return 
         new classname[32] 
         pev(id,pev_classname,classname,31) 
         if(!equal(classname,"player")) 
         { 
		Debug=1 
		set_task(1.0,"_Debug",id) 
         } 
} 
/////////////////////MELEE UP////////////////////// 
public check_melee(id) 
{ 
	if(!nst_zb_get_take_damage()) 
	{ 
		client_print(id,print_center,"%L",LANG_PLAYER,"DJB_ITEM_CANNOT_USE_BEFORE_ZOMBIE_APPEAR") 
		return 
	} 
	if(g_melee[id]) client_print(id,print_center,"%L",LANG_PLAYER,"DJB_ITEM_CANNOT_USE_TWICE_MELEEUP") 
	if(k_player_statue[id]||g_melee[id]) return 
	if(nst_zb_get_user_zombie(id)) return 
	MH_NewZBUI(id,"hs_meleeup",3,2,3,1,99.0,1) 
	k_player_statue[id]=1 
	g_melee[id] = 1 
	MH_DrawRetina(id,1,7) 
	set_task(up_time,"end_melee",id) 
	emit_sound(id, CHAN_AUTO, skull_start, 1.0, ATTN_NORM, 0, PITCH_NORM) 
} 
public end_melee(id) 
{ 
	k_player_statue[id]=0 
	if(g_shoot_status[id]==0) MH_DrawRetina(id,0,7) 
} 
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) 
{ 
	if(!k_player_statue[attacker]) return HAM_IGNORED 
	if(!get_user_weapon(attacker)==CSW_KNIFE) return HAM_IGNORED 
	damage*=2.0 
	SetHamParamFloat(4,damage) 
	return HAM_IGNORED 
} 
//////////////////SPEED UP////////////// 
public check_speed(id) 
{ 
	if(!nst_zb_get_take_damage()) 
	{ 
		client_print(id,print_center,"%L",LANG_PLAYER,"DJB_ITEM_CANNOT_USE_BEFORE_ZOMBIE_APPEAR") 
		return 
	}	 
	if(g_speed[id]) client_print(id,print_center,"%L",LANG_PLAYER,"DJB_ITEM_CANNOT_USE_TWICE_SPEEDUP") 
	if(player_status[id]||g_speed[id]) return 
	if(nst_zb_get_user_zombie(id)) return 
	MH_NewZBUI(id,"hs_speed",1,2,1,1,99.0,1) 
	g_speed[id]=1 
	emit_sound(id, CHAN_AUTO, skull_start, 1.0, ATTN_NORM, 0, PITCH_NORM) 
	MH_DrawRetina(id,1,4) 
	//spr 
	speed_up1(id)	 
} 
public speed_up1(id) 
{ 
	player_status[id]=1 
	copy(sound_file[id],31,heart_beat) 
	emit_sound(id, CHAN_AUTO,heart_beat,1.0, ATTN_NORM, 0, PITCH_NORM) 
	set_task(1.0,"play_sound",id,"",0,"a",floatround(speedup_time)) 
	set_task(speedup_time,"speed_up2",id+1000) 
} 
public speed_up2(index) 
{ 
	new id=index-1000 
	player_status[id]=2 
	new sex=nst_get_user_sex(id) 
	if(sex==1) 
	{ 
		copy(sound_file[id],31,speedup_breath_male) 
	} 
	else 
	{ 
		copy(sound_file[id],31,speedup_breath_female) 
	} 
	MH_DrawRetina(id,0,4) 
	set_task(1.0,"play_sound",id,"",0,"a",floatround(speedup_colddown)) 
	set_task(speedup_colddown,"speed_up3",id+2000) 
} 
public speed_up3(index) 
{ 
	new id=index-2000 
	if(task_exists(id+888)) remove_task(id+888) 
	if(task_exists(index)) remove_task(index) 
	player_status[id]=0 
} 
public plugin_precache() 
{ 
	engfunc(EngFunc_PrecacheSound,heart_beat) 
	engfunc(EngFunc_PrecacheSound,speedup_sound) 
	engfunc(EngFunc_PrecacheSound,speedup_breath_male) 
	engfunc(EngFunc_PrecacheSound,speedup_breath_female) 
	engfunc(EngFunc_PrecacheSound,skull_start) 
} 
public play_sound(id) 
{ 
	emit_sound(id, CHAN_AUTO, sound_file[id], 1.0, ATTN_NORM, 0, PITCH_NORM) 
} 
public Speed_Setting(id) 
{ 
	//maxspeed setting 
	if(!is_user_alive(id)) return FMRES_IGNORED 
	switch(player_status[id]) 
	{ 
		case 1:engfunc(EngFunc_SetClientMaxspeed,id,speedup_1) 
		case 2:engfunc(EngFunc_SetClientMaxspeed,id,speedup_2) 
		default : return FMRES_IGNORED 
	} 
	return FMRES_IGNORED 
} 
/////////////////ACCSHOOT/////////// 
public traceline_forward(Float:start[3], Float:end[3], conditions, id, trace) 
{ 
	 
	if(id>32||id<1) return FMRES_IGNORED 
	if(!is_user_alive(id)) return FMRES_IGNORED 
	if(!g_shoot_status[id]) return FMRES_IGNORED 
	set_tr2(trace, TR_iHitgroup, HIT_HEAD)  
 
	static hit, Float:head_origin[3], Float:angles[3] 
	if(!pev_valid(hit)) return FMRES_IGNORED 
	hit = get_tr2(trace, TR_pHit) 
	engfunc(EngFunc_GetBonePosition, hit, 8, head_origin,angles)  
     
	set_tr2(trace, TR_vecEndPos, head_origin)  
     
	return FMRES_IGNORED 
} 
public check_shoot(id) 
{ 
	if(!nst_zb_get_take_damage()) 
	{ 
		client_print(id,print_center,"%L",LANG_PLAYER,"DJB_ITEM_CANNOT_USE_BEFORE_ZOMBIE_APPEAR") 
		return 
	}	 
	if(g_accshoot[id]) client_print(id,print_center,"%L",LANG_PLAYER,"DJB_ITEM_CANNOT_USE_TWICE_ACCSHOOT") 
	if(g_accshoot[id]||g_shoot_status[id]) return 
	if(nst_zb_get_user_zombie(id)) return 
	MH_NewZBUI(id,"hs_headshot",2,2,2,1,99.0,1) 
	g_shoot_status[id]=1 
	g_accshoot[id]=1 
	set_task(accshoot_colddown,"end_accshoot",id) 
	emit_sound(id, CHAN_AUTO, skull_start, 1.0, ATTN_NORM, 0, PITCH_NORM) 
	MH_DrawRetina(id,1,7) 
} 
	 
public end_accshoot(id) 
{ 
	g_shoot_status[id]=0 
	if(k_player_statue[id]==0) MH_DrawRetina(id,0,7) 
} 
//******************************STOCK*********************************** 
 
////////////////////NST  ZOMBIE//////////////////// 
public nst_zb_user_infected(id, infector) 
{ 
	g_shoot_status[id]=0 
	player_status[id]=0 
	if(task_exists(id)) remove_task(id) 
	if(task_exists(id+2000)) remove_task(id+2000) 
	if(task_exists(id+888)) remove_task(id+888) 
} 
/////////////////////////// 
public _Debug(id) 
{ 
         RegisterHamFromEntity(Ham_TakeDamage,id,"fw_TakeDamage") 
} 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE 
*{\\ rtf1\\ ansi\\ ansicpg936\\ deff0\\ deflang1033\\ deflangfe2052{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs18 \n\\ par } 
*/