SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/07/2018, 11:51 AM   #1
TroS
Little Clucker
 
Join Date: May 2018
Posts: 32
Reputation: 1
Default Damage problem.

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.
TroS is offline   Reply With Quote
Old 09/07/2018, 02:05 PM   #2
DyduShxD
Gangsta
 
DyduShxD's Avatar
 
Join Date: Jan 2013
Location: United Kingdom
Posts: 611
Reputation: 6
Default Re: Damage problem.

Check your OnPlayerGiveDamage or show me.
DyduShxD is offline   Reply With Quote
Old 09/07/2018, 02:13 PM   #3
TroS
Little Clucker
 
Join Date: May 2018
Posts: 32
Reputation: 1
Default Re: Damage problem.

Code:
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;
}
TroS is offline   Reply With Quote
Old 09/07/2018, 02:32 PM   #4
Verc
Banned
 
Join Date: Apr 2018
Location: 🇯🇵
Posts: 171
Reputation: 42
Default Re: Damage problem.

Well the last part should be the problem.
Code:
OnPlayerTakeDamage(damagedid, playerid, amount, -1, bodypart )
Verc is offline   Reply With Quote
Old 09/07/2018, 02:36 PM   #5
TroS
Little Clucker
 
Join Date: May 2018
Posts: 32
Reputation: 1
Default Re: Damage problem.

Should I remove it?
TroS is offline   Reply With Quote
Old 09/07/2018, 02:55 PM   #6
Verc
Banned
 
Join Date: Apr 2018
Location: 🇯🇵
Posts: 171
Reputation: 42
Default Re: Damage problem.

Yes.
Verc is offline   Reply With Quote
Old 09/07/2018, 05:01 PM   #7
TroS
Little Clucker
 
Join Date: May 2018
Posts: 32
Reputation: 1
Default Re: Damage problem.

That worked, thanks!
TroS is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with damage HNIC Scripting Help 8 29/01/2018 07:21 PM
Problem - Damage Petry Scripting Help 2 07/08/2015 04:53 PM
Bullet Damage problem | + rep umarmalik Scripting Help 2 19/05/2012 11:24 AM
[Problem] Vehicle Damage TiNcH010 Help Archive 3 11/04/2011 09:45 PM


All times are GMT. The time now is 05:59 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.