SA-MP Forums Archive
Lower the damage of weapons - 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: Lower the damage of weapons (/showthread.php?tid=540333)



Lower the damage of weapons - alonxx - 04.10.2014

Hi, I need to lower the weapon damage and not get as.
and I used this code:

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:HP;

    GetPlayerHealth(playerid, HP);
    if(weaponid == 25) SetPlayerHealth(playerid,HP-10.0);
    return 1;
}
But it has not worked. How could I do to lower the damage to the gun?


Re: Lower the damage of weapons - Gogeta101 - 04.10.2014

Get Amount which you damaged enemy then add some health to enemy


Respuesta: Lower the damage of weapons - alonxx - 04.10.2014

The problem with that is that the damage of the gun is not accurate, then I can add more life than they should!


Re: Lower the damage of weapons - DavidBilla - 04.10.2014

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:HP;

    GetPlayerHealth(playerid, HP);
    if(weaponid == 25)
    {
        SetPlayerHealth(playerid,HP-10.0);
        return 0;
    }
    return 1;
}
I guess this'll do what you wanted.


Re: Lower the damage of weapons - jamjamnewbie - 04.10.2014

ID 25 is a shotgun, and the damage of a shotgun depends on how many bullets hit your target.


Re: Lower the damage of weapons - Quickie - 04.10.2014

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponid)
{
    new 
Float:HP,Float:gain;
    
GetPlayerHealth(playeridHP);// ex: HP==65
    
if(weaponid == 25
    {
         
gain=amount*0.25  //25 percent ex: amount(damage teken)=35 so 35*0.25==8.75
         
SetPlayerHealth(playerid,HP+gain);//HP==65+8.75
    
}
    return 
1;
}
//overall damage dealt by shotgun==26.25 {100-73.75}regardless of original amount send by client which is 35 



Respuesta: Lower the damage of weapons - alonxx - 04.10.2014

Thank you very much for helping, but I does not work either: S

Help!


Re: Lower the damage of weapons - Pottus - 04.10.2014

You can't use OnPlayerTakeDamage() to create lower weapon damages if the player has 40hp and gets shot with a deagle they will die even if the damage is set to 1hp. There is ways to do it however you can create server side damage variables and give the player high health values or use OnPlayerGiveDamage() but if you have lagcomp on OnPlayerTakeDamage() is not the way to go.

All those other responses are from people who have absolutely no clue what they are talking about take it from me you got to do a lot more than what you are doing.