SA-MP Forums Archive
Damage problem. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Damage problem. (/showthread.php?tid=656182)



Damage problem. - TroS - 09.07.2018

Hello, I have a training server, and its dmg is really bad.
If you shoot 1 shot, 2 registers, I mean 1 shot in normal server = 2 shots in my training server.
Example: If you use deagle and shoot one time, you will lose half armour (Not exactly), but if you use deagle on my training server, you will lose the whole armour, and same for combat and other weapons (not same dmg, but the same system).
I don't know where is the problem, I tried to install some Damage Filterscripts, but they don't work. If anyone knows how can I fix the problem, please help me.


Re: Damage problem. - DyduShxD - 09.07.2018

Check your OnPlayerGiveDamage or show me.


Re: Damage problem. - TroS - 09.07.2018

Код:
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;
}



Re: Damage problem. - Verc - 09.07.2018

Well the last part should be the problem.
Код:
OnPlayerTakeDamage(damagedid, playerid, amount, -1, bodypart )



Re: Damage problem. - TroS - 09.07.2018

Should I remove it?


Re: Damage problem. - Verc - 09.07.2018

Yes.


Re: Damage problem. - TroS - 09.07.2018

That worked, thanks!