Lower the damage of weapons
#1

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?
Reply
#2

Get Amount which you damaged enemy then add some health to enemy
Reply
#3

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

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.
Reply
#5

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

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 
Reply
#7

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

Help!
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)