Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
3.0 kB
2
Indexable
Never
public fw_PlayerTakeDamage(Victim, Inflictor, Attacker, Float:Damage, DamageBits)
{
	if(!g_GameStart || g_RoundEnd || g_WarmupRound)
		return HAM_IGNORED
	
	if(g_CurrentMode == MODE_FFA || g_CurrentMode == MODE_WAD)
	{
		if(Victim != Attacker && (1 <= Attacker <= g_MaxPlayers) )
		{
			new vteam = fm_get_user_team(Victim)
			if( vteam == fm_get_user_team(Attacker) )
			{
				fm_set_user_team(Victim, vteam == 1 ? 2 : 1)
				ExecuteHamB(Ham_TakeDamage, Victim, Inflictor, Attacker, Damage, DamageBits)
				fm_set_user_team(Victim, vteam)
				return HAM_SUPERCEDE
			}
		}
	}
	
	if(g_CurrentMode == MODE_ZOM)
	{
		new numuc = get_teamplayersnum(_, 1, true);
		
		if(numuc < 2) 
		{
			if(cs_get_user_team(Attacker) == CS_TEAM_T && cs_get_user_team(Victim) == CS_TEAM_CT)
			{
				if(numuc < 2) 
				{
					set_user_frags(Victim, get_user_frags(Victim)+5);
					set_hudmessage(80, 230, 160, -1.0, 0.15+hud_float, 2, 0.02, 5.0, 0.03, 0.5);
					ShowSyncHudMsg(0, hud_kanal ? SyncHudObj2 : SyncHudObj3, "Wszyscy zostali zlapani!");
				}
				cs_set_user_armor(Victim, 0, CS_ARMOR_NONE);
				SetHamParamFloat(4, get_user_health(Victim)+1.0);
				return HAM_SUPERCEDE
			}
			if(cs_get_user_team(Attacker) == CS_TEAM_CT && cs_get_user_team(Victim) == CS_TEAM_T )
			{
				return HAM_HANDLED
			}
			
			if(cs_get_user_team(Attacker) == CS_TEAM_CT && cs_get_user_team(Victim) == CS_TEAM_CT )
			{
				return HAM_IGNORED
			}
		
			if(cs_get_user_team(Attacker) == CS_TEAM_T && cs_get_user_team(Victim) == CS_TEAM_T )
			{
				return HAM_IGNORED
			}
		}
		else 
		{
			if(cs_get_user_team(Attacker) == CS_TEAM_T && cs_get_user_team(Victim) == CS_TEAM_CT)
			{			
				new Float:vOrigin[3] 
				pev(Victim, pev_origin, vOrigin)
											
				gracz_gania[Victim] = 2;
				cs_set_user_team(Victim, CS_TEAM_T);
				GM_Set_PlayerModel(Victim, human_models[2])
							
				new name[48];
				get_user_name(Victim, name, charsmax(name));
				set_hudmessage(80, 230, 160, -1.0, 0.15+hud_float, 2, 0.02, 3.0, 0.02, 0.5);
				ShowSyncHudMsg(0, hud_kanal ? SyncHudObj2 : SyncHudObj3, "%s zostal zainfekowany!", name);
					
				numuc = get_teamplayersnum(_, 1, true);
											
				sprite_play_animation(vOrigin, 40.0)
				sprites_play_animation2(Victim)
										
				set_user_health(Victim, 1450);
				fm_strip_user_weapons(Victim);
										
				fm_give_item(Victim, "weapon_knife")
			
				hud_kanal = !hud_kanal;
				hud_float += 0.03;
				if(hud_float > 0.091) hud_float = 0.0;
				
				return HAM_SUPERCEDE
			}
				
			if(cs_get_user_team(Attacker) == CS_TEAM_CT && cs_get_user_team(Victim) == CS_TEAM_T )
			{
				return HAM_HANDLED
			}
			
			if(cs_get_user_team(Attacker) == CS_TEAM_CT && cs_get_user_team(Victim) == CS_TEAM_CT )
			{
				return HAM_IGNORED
			}
		
			if(cs_get_user_team(Attacker) == CS_TEAM_T && cs_get_user_team(Victim) == CS_TEAM_T )
			{
				return HAM_IGNORED
			}
		}
	}
	
	return HAM_HANDLED
}