- #include <amxmodx> 
- #include <fakemeta> 
- #include <fakemeta_util> 
- #include <hamsandwich> 
- #include <cstrike> 
-   
- //#define USE_FOR_ZOMBIE  
- //Ha Zombie Plague módhoz szeretnéd használni akkor töröld a "//" jelet a "#define" elejéröl 
-   
- #if defined USE_FOR_ZOMBIE 
- #include <zp50_items> 
- #include <zp50_class_survivor> 
- #endif  
-   
- #define PLUGIN "[CSO] Weapon: JANUS-3" 
- #define VERSION "1.0" 
- #define AUTHOR "Dias Pendragon" 
- #define MODIFIED/FIXED "Dooz" 
-   
- #define V_MODEL "models/v_janus3.mdl" 
- #define P_MODEL "models/p_janus3.mdl" 
- #define W_MODEL "models/w_janus3.mdl" 
-   
- #define TASK_CHANGE 42343 
- #define TASK_CHANGELIMITTIME 54364 
- #define TASK_USETIME 34647 
-   
- new const Janus3_Sounds[10][] =  
- { 
- 	"weapons/janus3_shoot1.wav", 
- 	"weapons/janus3_shoot2.wav", 
- 	"weapons/change1_ready.wav", 
- 	"weapons/janus3_draw.wav", 
- 	"weapons/janus3_clipout.wav", 
- 	"weapons/janus3_clipin.wav", 
- 	"weapons/janus3_change2.wav", 
- 	"weapons/janus3_change1.wav", 
- 	"weapons/janus3_boltpull1.wav", 
- 	"weapons/janus3_boltpull2.wav" 
- } 
-   
- new const Janus3_Resources[4][] =  
- { 
- 	"sprites/weapon_janus3.txt", 
- 	"sprites/640hud7_2.spr", 
- 	"sprites/640hud12_2.spr", 
- 	"sprites/640hud109_2.spr" 
- } 
-   
- enum 
- { 
- 	J3_ANIM_IDLE = 0, 
- 	J3_ANIM_RELOAD, 
- 	J3_ANIM_DRAW, 
- 	J3_ANIM_SHOOT1, 
- 	J3_ANIM_SHOOT1_ACTIVE, 
- 	J3_ANIM_CHANGE_TO_JANUS, 
- 	J3_ANIM_IDLE_JANUS, 
- 	J3_ANIM_DRAW_JANUS, 
- 	J3_ANIM_SHOOT1_JANUS, 
- 	J3_ANIM_SHOOT2_JANUS, 
- 	J3_ANIM_SHOOT3_JANUS, 
- 	J3_ANIM_CHANGE_TO_BACK, 
- 	J3_ANIM_IDLE_ACTIVE, 
- 	J3_ANIM_RELOAD_ACTIVE, 
- 	J3_ANIM_DRAW_ACTIVE 
- } 
-   
- enum 
- { 
- 	JANUS3_NORMAL = 0, 
- 	JANUS3_ACTIVE, 
- 	JANUS3_JANUS 
- } 
-   
- #define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31))) 
- #define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31)) 
- #define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31)) 
-   
- new g_Cvars[9], g_HasGun, g_Janus3_Mode[33], g_Janus3_Clip[33], g_BulletCount[33], g_ChangingMode, Float:g_Recoil[33][3] 
- new g_Event_Janus3, g_SmokePuff_SprId, g_RifleShell_Id 
-   
- #if defined USE_FOR_ZOMBIE 
- new g_Item; 
- #define Item_Price 20 
- #endif  
-   
- public plugin_init() 
- { 
- 	register_plugin(PLUGIN, VERSION, AUTHOR) 
-   
- 	#if defined USE_FOR_ZOMBIE 
- 		g_Item = zp_items_register("Janus-3", Item_Price); 
- 	#else 
- 		register_clcmd("say /get_janus3", "Get_Janus3") 
- 	#endif  
- 	register_clcmd("weapon_janus3", "Hook_Weapon") 
-   
- 	g_Cvars[0] = register_cvar("jn3_damage", "35"); 
- 	g_Cvars[1] = register_cvar("jn3_damage_charged", "70"); 
- 	g_Cvars[2] = register_cvar("jn3_charge_ammo", "20"); 
- 	g_Cvars[3] = register_cvar("jn3_charge_limittime", "7"); 
- 	g_Cvars[4] = register_cvar("jn3_charge_time", "7"); 
- 	g_Cvars[5] = register_cvar("jn3_clip", "50"); 
- 	g_Cvars[6] = register_cvar("jn3_bpammo", "250"); 
- 	g_Cvars[7] = register_cvar("jn3_change_time", "2.0"); 
- 	g_Cvars[8] = register_cvar("jn3_chargeshoot_recoil", "0.25"); 
-   
- 	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1") 
-   
- 	register_forward(FM_UpdateClientData,"fw_UpdateClientData_Post", 1)	 
- 	register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")	 
- 	register_forward(FM_SetModel, "fw_SetModel")	 
- 	register_forward(FM_CmdStart, "fw_CmdStart") 
-   
- 	RegisterHam(Ham_Weapon_WeaponIdle, "weapon_ump45", "fw_Weapon_WeaponIdle_Post", 1) 
- 	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "fw_Weapon_PrimaryAttack") 
- 	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "fw_Weapon_PrimaryAttack_Post", 1)	 
- 	RegisterHam(Ham_Item_Deploy, "weapon_ump45", "fw_Item_Deploy_Post", 1)	 
- 	RegisterHam(Ham_Item_AddToPlayer, "weapon_ump45", "fw_Item_AddToPlayer_Post", 1) 
- 	RegisterHam(Ham_Item_PostFrame, "weapon_ump45", "fw_Item_PostFrame")	 
- 	RegisterHam(Ham_Weapon_Reload, "weapon_ump45", "fw_Weapon_Reload") 
- 	RegisterHam(Ham_Weapon_Reload, "weapon_ump45", "fw_Weapon_Reload_Post", 1)	 
-   
- 	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1) 
-   
- 	RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack_World") 
- 	RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack_Player")	 
-   
- 	register_message(get_user_msgid("DeathMsg"), "message_DeathMsg"); 
- } 
-   
- public plugin_precache() 
- { 
- 	engfunc(EngFunc_PrecacheModel, V_MODEL) 
- 	engfunc(EngFunc_PrecacheModel, P_MODEL) 
- 	engfunc(EngFunc_PrecacheModel, W_MODEL) 
-   
- 	new i 
- 	for(i = 0; i < sizeof(Janus3_Sounds); i++) 
- 		engfunc(EngFunc_PrecacheSound, Janus3_Sounds[i]) 
-   
- 	for(i = 0; i < sizeof(Janus3_Resources); i++) 
- 	{ 
- 		if(i == 0) engfunc(EngFunc_PrecacheGeneric, Janus3_Resources[i]) 
- 		else engfunc(EngFunc_PrecacheModel, Janus3_Resources[i]) 
- 	} 
-   
- 	g_RifleShell_Id = engfunc(EngFunc_PrecacheModel, "models/rshell.mdl") 
- 	g_SmokePuff_SprId = engfunc(EngFunc_PrecacheModel, "sprites/wall_puff1.spr") 
-   
- 	register_forward(FM_PrecacheEvent, "fw_PrecacheEvent_Post", 1) 
- } 
-   
- public fwHamPlayerSpawnPost(id) { 
- 	if (!is_user_alive(id) && !Get_BitVar(g_HasGun, id)) 
- 		return; 
-   
- 	if(get_user_weapon(id) == CSW_UMP45) 
- 		set_weapon_anim(id, J3_ANIM_IDLE)	 
-   
- 	remove_task(id+TASK_CHANGE) 
- 	remove_task(id+TASK_CHANGELIMITTIME) 
- 	remove_task(id+TASK_USETIME) 
-   
- 	g_Janus3_Mode[id] = JANUS3_NORMAL 
- 	g_BulletCount[id] = 0 
-   
- 	UnSet_BitVar(g_ChangingMode, id) 
-   
- 	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_UMP45) 
- 	if(!pev_valid(Ent)) return 
-   
- 	new Clip = get_pcvar_num(g_Cvars[5]), BPAmmo = get_pcvar_num(g_Cvars[6]) 
-   
- 	cs_set_weapon_ammo(Ent, Clip) 
- 	cs_set_user_bpammo(id, CSW_UMP45, BPAmmo) 
-   
- 	Update_AmmoHud(id, CSW_UMP45, Clip, BPAmmo) 
- }  
-   
- public Hook_Weapon(id) 
- { 
- 	engclient_cmd(id, "weapon_ump45") 
- 	return PLUGIN_HANDLED 
- } 
-   
- public fw_PrecacheEvent_Post(type, const name[]) 
- { 
- 	if(equal("events/ump45.sc", name)) g_Event_Janus3 = get_orig_retval()		 
- } 
-   
- public client_putinserver(id) 
- { 
- 	UnSet_BitVar(g_HasGun, id); 
- 	UnSet_BitVar(g_ChangingMode, id); 
- 	g_Janus3_Mode[id] = JANUS3_NORMAL; 
- 	g_BulletCount[id] = 0; 
- } 
-   
- #if defined USE_FOR_ZOMBIE 
- public zp_fw_items_select_pre(id, itemid, ignorecost){ 
-   
-     if(itemid == g_Item){ 
-         if(zp_core_is_zombie(id) || zp_class_survivor_get(id)) 
-             return ZP_ITEM_DONT_SHOW; 
-     } 
-   
-     return ZP_ITEM_AVAILABLE; 
- }   
-   
- public zp_fw_items_select_post(id, itemid, ignorecost){ 
-   
-     if (itemid == g_Item) 
- 		Get_Janus3(id) 
-   
-     return ZP_ITEM_AVAILABLE; 
- } 
- #endif 
-   
- public Get_Janus3(id) 
- { 
- 	if(!is_user_alive(id)) 
- 		return 
-   
- 	Drop_Weapon(id, 1) 
-   
- 	g_Janus3_Mode[id] = JANUS3_NORMAL 
- 	g_BulletCount[id] = 0 
-   
- 	Set_BitVar(g_HasGun, id) 
- 	UnSet_BitVar(g_ChangingMode, id) 
- 	fm_give_item(id, "weapon_ump45") 
-   
- 	// Set Weapon 
- 	engclient_cmd(id, "weapon_ump45") 
-   
- 	set_pev(id, pev_viewmodel2, V_MODEL) 
- 	set_pev(id, pev_weaponmodel2, P_MODEL) 
-   
- 	// Set Weapon Base 
- 	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_UMP45) 
- 	if(!pev_valid(Ent)) return 
-   
- 	new Clip = get_pcvar_num(g_Cvars[5]), BPAmmo = get_pcvar_num(g_Cvars[6]) 
-   
- 	cs_set_weapon_ammo(Ent, Clip) 
- 	cs_set_user_bpammo(id, CSW_UMP45, BPAmmo) 
-   
- 	Update_AmmoHud(id, CSW_UMP45, Clip, BPAmmo) 
- } 
-   
- public Update_AmmoHud(id, CSWID, Ammo, BpAmmo) 
- { 
- 	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), _, id) 
- 	write_byte(1) 
- 	write_byte(CSWID) 
- 	write_byte(Ammo) 
- 	message_end() 
-   
- 	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id) 
- 	write_byte(10) 
- 	write_byte(BpAmmo) 
- 	message_end() 
- } 
-   
- public Remove_Janus3(id) 
- { 
- 	g_Janus3_Mode[id] = JANUS3_NORMAL 
- 	g_BulletCount[id] = 0 
-   
- 	UnSet_BitVar(g_HasGun, id) 
- 	UnSet_BitVar(g_ChangingMode, id) 
-   
- 	remove_task(id+TASK_CHANGE) 
- 	remove_task(id+TASK_CHANGELIMITTIME) 
- 	remove_task(id+TASK_USETIME) 
- } 
-   
- public Event_CurWeapon(id) 
- { 
- 	if(!Get_BitVar(g_HasGun, id))	 
- 		return 
- 	if(g_Janus3_Mode[id] != JANUS3_JANUS) 
- 		return 
-   
- 	static Float:Delay, Float:Delay2 
- 	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_UMP45) 
- 	if(!pev_valid(Ent)) return 
-   
- 	Delay = get_pdata_float(Ent, 46, 4) * 0.75 
- 	Delay2 = get_pdata_float(Ent, 47, 4) * 0.75 
-   
- 	if(Delay > 0.0) 
- 	{ 
- 		set_pdata_float(Ent, 46, Delay, 4) 
- 		set_pdata_float(Ent, 47, Delay2, 4) 
- 	} 
- } 
-   
- public fw_UpdateClientData_Post(id, sendweapons, cd_handle) 
- { 
- 	if(!is_user_alive(id) || !is_user_connected(id)) 
- 		return FMRES_IGNORED	 
- 	if(get_user_weapon(id) == CSW_UMP45 && Get_BitVar(g_HasGun, id)) 
- 		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)  
-   
- 	return FMRES_HANDLED 
- } 
-   
- public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) 
- { 
- 	if (!is_user_connected(invoker)) 
- 		return FMRES_IGNORED	 
- 	if(get_user_weapon(invoker) != CSW_UMP45 || !Get_BitVar(g_HasGun, invoker)) 
- 		return FMRES_IGNORED 
- 	if(eventid != g_Event_Janus3) 
- 		return FMRES_IGNORED 
-   
- 	engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2) 
-   
- 	if(g_Janus3_Mode[invoker] == JANUS3_NORMAL) set_weapon_anim(invoker, J3_ANIM_SHOOT1) 
- 	else if(g_Janus3_Mode[invoker] == JANUS3_ACTIVE) set_weapon_anim(invoker, J3_ANIM_SHOOT1_ACTIVE) 
- 	else if(g_Janus3_Mode[invoker] == JANUS3_JANUS) set_weapon_anim(invoker, random_num(J3_ANIM_SHOOT1_JANUS, J3_ANIM_SHOOT3_JANUS)) 
-   
- 	emit_sound(invoker, CHAN_WEAPON, g_Janus3_Mode[invoker] == JANUS3_JANUS ? Janus3_Sounds[1] : Janus3_Sounds[0], 1.0, ATTN_NORM, 0, PITCH_NORM) 
- 	Eject_Shell(invoker, g_RifleShell_Id, 0.01) 
-   
- 	static Ent; Ent = fm_find_ent_by_owner(-1, "weapon_ump45", invoker) 
- 	if(pev_valid(Ent) && g_Janus3_Mode[invoker] == JANUS3_JANUS) cs_set_weapon_ammo(Ent, cs_get_weapon_ammo(Ent) + 1) 
-   
- 	return FMRES_IGNORED 
- } 
-   
- public fw_SetModel(entity, model[]) 
- { 
- 	if(!pev_valid(entity)) 
- 		return FMRES_IGNORED 
-   
- 	static Classname[32] 
- 	pev(entity, pev_classname, Classname, sizeof(Classname)) 
-   
- 	if(!equal(Classname, "weaponbox")) 
- 		return FMRES_IGNORED 
-   
- 	static iOwner 
- 	iOwner = pev(entity, pev_owner) 
-   
- 	if(equal(model, "models/w_ump45.mdl")) 
- 	{ 
- 		static weapon; weapon = fm_find_ent_by_owner(-1, "weapon_ump45", entity) 
-   
- 		if(!pev_valid(weapon)) 
- 			return FMRES_IGNORED; 
-   
- 		if(Get_BitVar(g_HasGun, iOwner)) 
- 		{ 
- 			Remove_Janus3(iOwner) 
-   
- 			set_pev(weapon, pev_impulse, 31122013) 
- 			engfunc(EngFunc_SetModel, entity, W_MODEL) 
-   
- 			return FMRES_SUPERCEDE 
- 		} 
- 	} 
-   
- 	return FMRES_IGNORED; 
- } 
-   
- public fw_CmdStart(id, uc_handle, seed) 
- { 
- 	if(!is_user_alive(id)) 
- 		return FMRES_IGNORED	 
-   
- 	if(!Get_BitVar(g_HasGun, id) || get_user_weapon(id) != CSW_UMP45)	 
- 		return FMRES_IGNORED 
-   
- 	static PressButton; PressButton = get_uc(uc_handle, UC_Buttons) 
-   
- 	if((PressButton & IN_RELOAD) && g_Janus3_Mode[id] == JANUS3_JANUS) 
- 		return FMRES_SUPERCEDE 
-   
- 	if((PressButton & IN_ATTACK2)) 
- 	{ 
- 		PressButton &= ~IN_ATTACK2 
- 		set_uc(uc_handle, UC_Buttons, PressButton) 
-   
- 		if((pev(id, pev_oldbuttons) & IN_ATTACK2)) 
- 			return FMRES_IGNORED 
- 		if(g_Janus3_Mode[id] != JANUS3_ACTIVE) 
- 			return FMRES_IGNORED 
- 		if(get_pdata_float(id, 83, 5) > 0.0) 
- 			return FMRES_IGNORED 
-   
- 		remove_task(id+TASK_CHANGELIMITTIME) 
-   
- 		Set_BitVar(g_ChangingMode, id) 
- 		Set_Player_NextAttack(id, CSW_UMP45, get_pcvar_float(g_Cvars[7])) 
-   
- 		set_weapon_anim(id, J3_ANIM_CHANGE_TO_JANUS) 
- 		set_task(get_pcvar_float(g_Cvars[7]), "ChangeTo_JanusTransform", id+TASK_CHANGE) 
- 	} 
-   
- 	return FMRES_IGNORED 
- } 
-   
- public ChangeTo_JanusTransform(id) 
- { 
- 	id -= TASK_CHANGE 
-   
- 	if(!is_user_alive(id)) 
- 		return 
-   
- 	if(get_user_weapon(id) != CSW_UMP45 || !Get_BitVar(g_HasGun, id))	 
- 		return 
-   
- 	if(!Get_BitVar(g_ChangingMode, id)) 
- 		return 
-   
- 	UnSet_BitVar(g_ChangingMode, id) 
- 	g_Janus3_Mode[id] = JANUS3_JANUS 
-   
- 	set_weapon_anim(id, J3_ANIM_IDLE_JANUS) 
-   
- 	remove_task(id+TASK_USETIME) 
- 	set_task(float(get_pcvar_num(g_Cvars[4])), "TurnOff_JTS2", id+TASK_USETIME) 
- } 
-   
- public TurnOff_JTS2(id) 
- { 
- 	id -= TASK_USETIME 
-   
- 	if(!is_user_alive(id)) 
- 		return 
-   
- 	if(get_user_weapon(id) != CSW_UMP45 || !Get_BitVar(g_HasGun, id))	 
- 		return 
-   
- 	if(g_Janus3_Mode[id] != JANUS3_JANUS) 
- 		return 
-   
- 	Set_BitVar(g_ChangingMode, id) 
- 	Set_Player_NextAttack(id, CSW_UMP45, get_pcvar_num(g_Cvars[7]) - 1.0) 
-   
- 	set_weapon_anim(id, J3_ANIM_CHANGE_TO_BACK) 
-   
- 	set_task(get_pcvar_num(g_Cvars[7]) - 1.0, "ChangeTo_Back", id+TASK_CHANGE) 
- } 
-   
- public ChangeTo_Back(id) 
- { 
- 	id -= TASK_CHANGE 
-   
- 	if(!is_user_alive(id)) 
- 		return 
-   
- 	if(get_user_weapon(id) != CSW_UMP45 || !Get_BitVar(g_HasGun, id))	 
- 		return 
-   
- 	if(g_Janus3_Mode[id] != JANUS3_JANUS) 
- 		return 
-   
- 	g_Janus3_Mode[id] = JANUS3_NORMAL 
- } 
-   
- public fw_Weapon_PrimaryAttack(Ent) 
- { 
- 	static id; id = pev(Ent, pev_owner) 
- 	pev(id, pev_punchangle, g_Recoil[id]) 
-   
- 	return HAM_IGNORED 
- } 
-   
- public fw_Weapon_PrimaryAttack_Post(Ent) 
- { 
- 	static id; id = pev(Ent, pev_owner) 
-   
- 	if(Get_BitVar(g_HasGun, id) && g_Janus3_Mode[id] == JANUS3_JANUS) 
- 	{ 
- 		static Float:Push[3] 
- 		pev(id, pev_punchangle, Push) 
- 		xs_vec_sub(Push, g_Recoil[id], Push) 
-   
- 		xs_vec_mul_scalar(Push, get_pcvar_float(g_Cvars[8]), Push) 
- 		xs_vec_add(Push, g_Recoil[id], Push) 
- 		set_pev(id, pev_punchangle, Push) 
-   
- 		Event_CurWeapon(id) 
- 	} 
- } 
-   
- public fw_Weapon_WeaponIdle_Post(Ent) 
- { 
- 	if(pev_valid(Ent) != 2) 
- 		return HAM_IGNORED	 
- 	static Id; Id = get_pdata_cbase(Ent, 41, 4) 
- 	if(get_pdata_cbase(Id, 373) != Ent) 
- 		return HAM_IGNORED	 
- 	if(!Get_BitVar(g_HasGun, Id)) 
- 		return HAM_IGNORED	 
-   
- 	if(get_pdata_float(Ent, 48, 4) <= 0.1)  
- 	{ 
- 		if(g_Janus3_Mode[Id] == JANUS3_NORMAL) set_weapon_anim(Id, J3_ANIM_IDLE) 
- 		else if(g_Janus3_Mode[Id] == JANUS3_ACTIVE) set_weapon_anim(Id, J3_ANIM_IDLE_ACTIVE) 
- 		else if(g_Janus3_Mode[Id] == JANUS3_JANUS) set_weapon_anim(Id, J3_ANIM_IDLE_JANUS) 
-   
- 		set_pdata_float(Ent, 48, 20.0, 4) 
- 		set_pdata_string(Id, (492) * 4, "carbine", -1 , 20) 
- 	} 
-   
- 	return HAM_IGNORED	 
- } 
-   
- public fw_Item_Deploy_Post(Ent) 
- { 
- 	if(pev_valid(Ent) != 2) 
- 		return 
- 	static Id; Id = get_pdata_cbase(Ent, 41, 4) 
- 	if(get_pdata_cbase(Id, 373) != Ent) 
- 		return 
- 	if(!Get_BitVar(g_HasGun, Id)) 
- 		return 
-   
- 	set_pev(Id, pev_viewmodel2, V_MODEL) 
- 	set_pev(Id, pev_weaponmodel2, P_MODEL) 
-   
- 	if(g_Janus3_Mode[Id] == JANUS3_NORMAL) set_weapon_anim(Id, J3_ANIM_DRAW) 
- 	else if(g_Janus3_Mode[Id] == JANUS3_ACTIVE) set_weapon_anim(Id, J3_ANIM_DRAW_ACTIVE) 
- 	else if(g_Janus3_Mode[Id] == JANUS3_JANUS) set_weapon_anim(Id, J3_ANIM_DRAW_JANUS) 
- } 
-   
- public fw_Item_AddToPlayer_Post(Ent, id) 
- { 
- 	if(!pev_valid(Ent)) 
- 		return HAM_IGNORED 
-   
- 	if(pev(Ent, pev_impulse) == 31122013) 
- 	{ 
- 		Set_BitVar(g_HasGun, id) 
- 		set_pev(Ent, pev_impulse, 0) 
- 	}		 
-   
- 	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), .player = id) 
- 	write_string(Get_BitVar(g_HasGun, id) ? "weapon_janus3" : "weapon_ump45") 
- 	write_byte(6) // PrimaryAmmoID 
- 	write_byte(100) // PrimaryAmmoMaxAmount 
- 	write_byte(-1) // SecondaryAmmoID 
- 	write_byte(-1) // SecondaryAmmoMaxAmount 
- 	write_byte(0) // SlotID (0...N) 
- 	write_byte(15) // NumberInSlot (1...N) 
- 	write_byte(CSW_UMP45) // WeaponID 
- 	write_byte(0) // Flags 
- 	message_end() 
-   
- 	return HAM_HANDLED	 
- } 
-   
- public fw_Item_PostFrame(ent) 
- { 
- 	static id; id = pev(ent, pev_owner) 
- 	if(!is_user_alive(id)) 
- 		return HAM_IGNORED 
- 	if(!Get_BitVar(g_HasGun, id)) 
- 		return HAM_IGNORED	 
-   
- 	static Float:flNextAttack; flNextAttack = get_pdata_float(id, 83, 5) 
- 	static bpammo; bpammo = cs_get_user_bpammo(id, CSW_UMP45) 
-   
- 	static iClip; iClip = get_pdata_int(ent, 51, 4) 
- 	static fInReload; fInReload = get_pdata_int(ent, 54, 4) 
-   
- 	if(fInReload && flNextAttack <= 0.0) 
- 	{ 
- 		static temp1 
- 		temp1 = min(get_pcvar_num(g_Cvars[5]) - iClip, bpammo) 
-   
- 		set_pdata_int(ent, 51, iClip + temp1, 4) 
- 		cs_set_user_bpammo(id, CSW_UMP45, bpammo - temp1)		 
-   
- 		set_pdata_int(ent, 54, 0, 4) 
-   
- 		fInReload = 0 
- 	}		 
-   
- 	return HAM_IGNORED 
- } 
-   
- public fw_Weapon_Reload(ent) 
- { 
- 	static id; id = pev(ent, pev_owner) 
-   
- 	if(!is_user_alive(id)) 
- 		return HAM_IGNORED 
-   
- 	if(!Get_BitVar(g_HasGun, id)) 
- 		return HAM_IGNORED	 
-   
- 	if(g_Janus3_Mode[id] == JANUS3_JANUS) 
- 		return HAM_SUPERCEDE 
-   
- 	g_Janus3_Clip[id] = -1 
-   
- 	static BPAmmo; BPAmmo = cs_get_user_bpammo(id, CSW_UMP45) 
- 	static iClip; iClip = get_pdata_int(ent, 51, 4) 
-   
- 	if(BPAmmo <= 0) 
- 		return HAM_SUPERCEDE 
- 	if(iClip >= get_pcvar_num(g_Cvars[5])) 
- 		return HAM_SUPERCEDE		 
-   
- 	g_Janus3_Clip[id] = iClip	 
-   
- 	return HAM_HANDLED 
- } 
-   
- public fw_Weapon_Reload_Post(ent) 
- { 
- 	static id; id = pev(ent, pev_owner) 
- 	if(!is_user_alive(id)) 
- 		return HAM_IGNORED 
- 	if(!Get_BitVar(g_HasGun, id)) 
- 		return HAM_IGNORED	 
-   
- 	if(g_Janus3_Mode[id] == JANUS3_JANUS) 
- 		return HAM_SUPERCEDE 
-   
- 	if((get_pdata_int(ent, 54, 4) == 1)) 
- 	{ 
- 		if(g_Janus3_Clip[id] == -1) 
- 			return HAM_IGNORED 
-   
- 		set_pdata_int(ent, 51, g_Janus3_Clip[id], 4) 
-   
- 		if(g_Janus3_Mode[id] == JANUS3_NORMAL) set_weapon_anim(id, J3_ANIM_RELOAD) 
- 		else if(g_Janus3_Mode[id] == JANUS3_ACTIVE) set_weapon_anim(id, J3_ANIM_RELOAD_ACTIVE) 
-   
- 	} 
-   
- 	return HAM_HANDLED 
- } 
-   
- public fw_TraceAttack_World(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits) 
- { 
- 	if(!is_user_connected(Attacker)) 
- 		return HAM_IGNORED	 
- 	if(get_user_weapon(Attacker) != CSW_UMP45 || !Get_BitVar(g_HasGun, Attacker)) 
- 		return HAM_IGNORED 
-   
- 	static Float:flEnd[3], Float:vecPlane[3] 
-   
- 	get_tr2(Ptr, TR_vecEndPos, flEnd) 
- 	get_tr2(Ptr, TR_vecPlaneNormal, vecPlane)		 
-   
- 	Make_BulletHole(Attacker, flEnd, Damage) 
- 	Make_BulletSmoke(Attacker, Ptr) 
-   
- 	SetHamParamFloat(3, g_Janus3_Mode[Attacker] == JANUS3_JANUS ? float(get_pcvar_num(g_Cvars[1])) : float(get_pcvar_num(g_Cvars[0]))) 
-   
- 	if(g_Janus3_Mode[Attacker] == JANUS3_NORMAL) 
- 	{ 
- 		g_BulletCount[Attacker]++ 
- 		CheckCharge(Attacker) 
- 	} 
-   
- 	return HAM_IGNORED 
- } 
-   
- public fw_TraceAttack_Player(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits) 
- { 
- 	if(!is_user_connected(Attacker)) 
- 		return HAM_IGNORED	 
- 	if(get_user_weapon(Attacker) != CSW_UMP45 || !Get_BitVar(g_HasGun, Attacker)) 
- 		return HAM_IGNORED 
-   
- 	SetHamParamFloat(3, g_Janus3_Mode[Attacker] == JANUS3_JANUS ? float(get_pcvar_num(g_Cvars[1])) : float(get_pcvar_num(g_Cvars[0]))) 
- 	if(cs_get_user_team(Attacker) != cs_get_user_team(Victim) && g_Janus3_Mode[Attacker] == JANUS3_NORMAL)  
- 	{ 
- 		g_BulletCount[Attacker]++ 
- 		CheckCharge(Attacker) 
- 	} 
-   
- 	return HAM_IGNORED 
- } 
-   
- public CheckCharge(id) 
- { 
- 	if(g_BulletCount[id] >= get_pcvar_num(g_Cvars[2])) 
- 	{ 
- 		g_Janus3_Mode[id] = JANUS3_ACTIVE 
-   
- 		set_weapon_anim(id, J3_ANIM_IDLE_ACTIVE) 
-   
- 		emit_sound(id, CHAN_VOICE, Janus3_Sounds[2], 1.0, ATTN_NORM, 0, PITCH_NORM) 
-   
- 		g_BulletCount[id] = 0 
-   
- 		remove_task(id+TASK_CHANGELIMITTIME) 
- 		set_task(float(get_pcvar_num(g_Cvars[3])), "TurnOff_JTS", id+TASK_CHANGELIMITTIME) 
- 	} 
- } 
-   
- public TurnOff_JTS(id) 
- { 
- 	id -= TASK_CHANGELIMITTIME 
- 	if(!is_user_alive(id)) 
- 		return 
-   
- 	g_Janus3_Mode[id] = JANUS3_NORMAL 
- 	g_BulletCount[id] = 0 
-   
- 	set_weapon_anim(id, J3_ANIM_IDLE) 
- } 
-   
- public message_DeathMsg(msg_id, msg_dest, id) 
- { 
- 	static szTruncatedWeapon[33], iAttacker, iVictim; 
- 	get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon)) 
-   
- 	iAttacker = get_msg_arg_int(1); 
- 	iVictim = get_msg_arg_int(2); 
-   
- 	if(!is_user_connected(iAttacker) || iAttacker == iVictim) 
- 		return PLUGIN_CONTINUE; 
-   
- 	if(equal(szTruncatedWeapon, "ump45") && get_user_weapon(iAttacker) == CSW_UMP45) 
- 		if(Get_BitVar(g_HasGun, iAttacker)) 
- 			set_msg_arg_string(4, "Janus-3"); 
-   
- 	return PLUGIN_CONTINUE; 
- } 
-   
- stock Eject_Shell(id, Shell_ModelIndex, Float:Time) // By Dias 
- { 
- 	static Ent; Ent = get_pdata_cbase(id, 373, 5) 
- 	if(!pev_valid(Ent)) 
- 		return 
-   
-         set_pdata_int(Ent, 57, Shell_ModelIndex, 4) 
-         set_pdata_float(id, 111, get_gametime() + Time) 
- } 
-   
- stock Drop_Weapon(id, slot) 
- { 
- 	if(!(1 <= slot <= 2)) 
- 		return 0; 
-   
- 	static iCount; iCount = 0; 
- 	static iEntity; iEntity = get_pdata_cbase(id, (367 + slot), 5); 
-   
- 	if(iEntity > 0) 
- 	{ 
- 		static iNext; 
- 		static szWeaponName[32]; 
-   
- 		do { 
- 			iNext = get_pdata_cbase(iEntity, 42, 4); 
-   
- 			if(get_weaponname(cs_get_weapon_id(iEntity), szWeaponName, charsmax(szWeaponName))) 
- 			{   
- 				engclient_cmd(id, "drop", szWeaponName); 
- 				iCount++; 
- 			} 
- 		} 
-   
- 		while(( iEntity = iNext) > 0); 
- 	} 
-   
- 	return iCount; 
- } 
-   
- stock set_weapon_anim(id, anim) 
- { 
- 	set_pev(id, pev_weaponanim, anim) 
-   
- 	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id) 
- 	write_byte(anim) 
- 	write_byte(pev(id, pev_body)) 
- 	message_end() 
- } 
-   
- stock Make_BulletHole(id, Float:Origin[3], Float:Damage) 
- { 
- 	// Find target 
- 	static Decal; Decal = random_num(41, 45) 
- 	static LoopTime;  
-   
- 	if(Damage > 100.0) LoopTime = 2 
- 	else LoopTime = 1 
-   
- 	for(new i = 0; i < LoopTime; i++) 
- 	{ 
- 		// Put decal on "world" (a wall) 
- 		message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
- 		write_byte(TE_WORLDDECAL) 
- 		engfunc(EngFunc_WriteCoord, Origin[0]) 
- 		engfunc(EngFunc_WriteCoord, Origin[1]) 
- 		engfunc(EngFunc_WriteCoord, Origin[2]) 
- 		write_byte(Decal) 
- 		message_end() 
-   
- 		// Show sparcles 
- 		message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
- 		write_byte(TE_GUNSHOTDECAL) 
- 		engfunc(EngFunc_WriteCoord, Origin[0]) 
- 		engfunc(EngFunc_WriteCoord, Origin[1]) 
- 		engfunc(EngFunc_WriteCoord, Origin[2]) 
- 		write_short(id) 
- 		write_byte(Decal) 
- 		message_end() 
- 	} 
- } 
-   
- stock Make_BulletSmoke(id, TrResult) 
- { 
- 	static Float:vecSrc[3], Float:vecEnd[3], TE_FLAG 
-   
- 	get_weapon_attachment(id, vecSrc) 
- 	global_get(glb_v_forward, vecEnd) 
-   
- 	xs_vec_mul_scalar(vecEnd, 8192.0, vecEnd) 
- 	xs_vec_add(vecSrc, vecEnd, vecEnd) 
-   
- 	get_tr2(TrResult, TR_vecEndPos, vecSrc) 
- 	get_tr2(TrResult, TR_vecPlaneNormal, vecEnd) 
-   
- 	xs_vec_mul_scalar(vecEnd, 2.5, vecEnd) 
- 	xs_vec_add(vecSrc, vecEnd, vecEnd) 
-   
- 	TE_FLAG |= TE_EXPLFLAG_NODLIGHTS 
- 	TE_FLAG |= TE_EXPLFLAG_NOSOUND 
- 	TE_FLAG |= TE_EXPLFLAG_NOPARTICLES 
-   
- 	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, vecEnd, 0) 
- 	write_byte(TE_EXPLOSION) 
- 	engfunc(EngFunc_WriteCoord, vecEnd[0]) 
- 	engfunc(EngFunc_WriteCoord, vecEnd[1]) 
- 	engfunc(EngFunc_WriteCoord, vecEnd[2] - 10.0) 
- 	write_short(g_SmokePuff_SprId) 
- 	write_byte(2) 
- 	write_byte(50) 
- 	write_byte(TE_FLAG) 
- 	message_end() 
- } 
-   
- stock get_weapon_attachment(id, Float:output[3], Float:fDis = 40.0) 
- {  
- 	static Float:vfEnd[3], viEnd[3]  
- 	get_user_origin(id, viEnd, 3)   
- 	IVecFVec(viEnd, vfEnd)  
-   
- 	static Float:fOrigin[3], Float:fAngle[3] 
-   
- 	pev(id, pev_origin, fOrigin)  
- 	pev(id, pev_view_ofs, fAngle) 
-   
- 	xs_vec_add(fOrigin, fAngle, fOrigin)  
-   
- 	static Float:fAttack[3] 
-   
- 	xs_vec_sub(vfEnd, fOrigin, fAttack) 
- 	xs_vec_sub(vfEnd, fOrigin, fAttack)  
-   
- 	static Float:fRate 
-   
- 	fRate = fDis / vector_length(fAttack) 
- 	xs_vec_mul_scalar(fAttack, fRate, fAttack) 
-   
- 	xs_vec_add(fOrigin, fAttack, output) 
- } 
-   
- stock Set_Player_NextAttack(id, CSWID, Float:NextTime) 
- { 
- 	static Ent; Ent = fm_get_user_weapon_entity(id, CSWID) 
- 	if(!pev_valid(Ent)) return 
-   
- 	set_pdata_float(id, 83, NextTime, 5) 
-   
- 	set_pdata_float(Ent, 46 , NextTime, 4) 
- 	set_pdata_float(Ent, 47, NextTime, 4) 
- 	set_pdata_float(Ent, 48, NextTime, 4) 
- } 
-