SA-MP Forums Archive
Weapon Damage Changed - 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: Weapon Damage Changed (/showthread.php?tid=516653)



Weapon Damage Changed - lwilson - 01.06.2014

How to changed the Damage of Weapon?? for example i want to change the damage of Deagle to 1/4 of Life Damage instead of Half How?? can you show me the Code?


Re: Weapon Damage Changed - Mihaitza97 - 01.06.2014

Maybe with OnPlayerGiveDamage?


Re: Weapon Damage Changed - SyntaxQ - 01.06.2014

I'm not sure if this will work...
pawn Код:
public OnPlayerTakeDamage( playerid, issuerid, Float:amount, weaponid )
{
    new Float:h;
    if (weaponid == 24)
    {
        if (amount >= 50)
        {
            GetPlayerHealth(playerid, h);
            SetPlayerHealth(playerid, h + 25.0);
        }
    }
    return 1;
}
This should increase the health by 25.0 whenever deagle causes more than or equal to 50 damage..


Re : Weapon Damage Changed - Sc0tt - 01.06.2014

I make this script quicly, i don't know if it works :

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponidbodypart)
{
    if(
weaponid == 24// If the weapon is a deagle
    
{
          new 
Float:health;
          
GetPlayerHealth(damagedidhealth); // Get the player's health after the shot
          
health += amount// Add the damage amount at the player's health
          
SetPlayerHealth(damagedidhealth 25); // Removed 1/4 of player's health
    
}

Sorry for my bad english and, i repeat, i don't know if this script works ^^


Re: Weapon Damage Changed - Lordzy - 01.06.2014

Set every player's team to a constant value. From then, a player cannot damage other player. However, the callbacks get called and you can do the damage accordingly.