Damage problem.
#3

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{

	if(Player[damagedid][OnGunmenu] && Player[damagedid][Playing])
        return 1;

	if(Player[damagedid][IsAFK])
	{
		return 1;
	}

	if(ToggleTargetInfo == true)
	{
	    ShowTargetInfo(playerid, damagedid);
	}

    // slit throat with a knife
    if(amount > 1800 && weaponid == 4 && GetPlayerAnimationIndex(playerid) == 747) {

        Player[damagedid][HitBy] = playerid;
		Player[damagedid][HitWith] = weaponid;

		if(!ServerAntiLag) {
		    CallLocalFunction("OnPlayerTakeDamage", "ddfdd", damagedid, playerid, amount, weaponid, bodypart);
		}

		SetHP(damagedid, 0);

		if(!ServerAntiLag) return 1;
	}

	if(ServerAntiLag == false) {
		if(Player[damagedid][AntiLag] == false) return 1;
	    if(playerid != INVALID_PLAYER_ID && Player[playerid][AntiLag] == false) return 1;
	} else {
	    if(Player[playerid][Playing] == true || Player[damagedid][Playing] == true) {
	        if(Player[damagedid][Team] == Player[playerid][Team]) return 1;
	        if(Player[playerid][Playing] == true && Player[damagedid][Playing] == false) return 1;
	        if(Player[damagedid][Team] == REFEREE) return 1;
		}
	}
	if(Player[damagedid][PauseCount] > 2) return 1;

	new Float:Health[2], Float:Damage;
	GetHP(damagedid, Health[0]);
	GetAP(damagedid, Health[1]);

	if(Health[0] > 0) {
	    if(amount > Health[0]) {
	        Damage = amount - Health[0];
	        amount = amount - Damage;
		}
	}

	Player[damagedid][HitBy] = playerid;
	Player[damagedid][HitWith] = weaponid;

    new Float:health, Float:armor;

    armor = Health[1];
    health = Health[0];

    new bool:setArmor = false;

    if( armor > 0.0) {
        armor = armor - amount;
        setArmor = true;
    }

    if( amount > health && !setArmor ) {
        health = 0.0;
    } else if( !setArmor ) {
        health = health - amount;
    } else if( armor < 0.0 ) {
        health = health + armor;
        armor = 0.0;
    }

    SetAP(damagedid, armor);
    SetHP(damagedid, health);

    OnPlayerTakeDamage(damagedid, playerid, amount, -1, bodypart );

	return 1;
}
Reply


Messages In This Thread
Damage problem. - by TroS - 09.07.2018, 11:51
Re: Damage problem. - by DyduShxD - 09.07.2018, 14:05
Re: Damage problem. - by TroS - 09.07.2018, 14:13
Re: Damage problem. - by Verc - 09.07.2018, 14:32
Re: Damage problem. - by TroS - 09.07.2018, 14:36
Re: Damage problem. - by Verc - 09.07.2018, 14:55
Re: Damage problem. - by TroS - 09.07.2018, 17:01

Forum Jump:


Users browsing this thread: 1 Guest(s)