Damage script.
#1

Hello, I need an damage script, when you shooting at someone like with Deagle it'll damage 70 percent of his HP.
Reply
#2

Why don't you search before posting this thread ?
Reply
#3

there is an include OPSP (OnPlayerShootPlayer), you can use that.
Reply
#4

There's an include that provides you "OnPlayerShootPlayer" callback, you can get it from here.
After you have it installed (( Adding the pastebin to a .ini file, #include 'file name' ))
Make this Callback:


pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
 
    return 1;
}
And there you go:

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    if(GetPlayerWeapon(shooter) == 24)
    {
           new float: hp;
           GetPlayerHealth(target, hp);
           SetPlayerHealth(target, hp-70);
    }
    return 1;
}
Enjoy.
Reply
#5

Quote:
Originally Posted by Randy More
Посмотреть сообщение
There's an include that provides you "OnPlayerShootPlayer" callback, you can get it from here.
After you have it installed (( Adding the pastebin to a .ini file, #include 'file name' ))
Make this Callback:


pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
 
    return 1;
}
And there you go:

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    if(GetPlayerWeapon(shooter) == 24)
    {
           new float: hp;
           GetPlayerHealth(target, hp);
           SetPlayerHealth(target, hp-70);
    }
    return 1;
}
Enjoy.
Include is not needed anymore, there are functions already included in a_samp called OnPlayerGiveDamage and OnPlayerTakeDamage.
Reply
#6

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Include is not needed anymore, there are functions already included in a_samp called OnPlayerGiveDamage and OnPlayerTakeDamage.
OPSP still exists, the include is not removed, is it?
Reply
#7

You can also use OnPlayerTakeDamage but i will tell you that i use it, and i regret using it... It's slow. I made it check when a player get shot, if player HP is lower than 90!! than it applies an anim, and sometimes the player die before the anim applies..
Reply
#8

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
You can also use OnPlayerTakeDamage but i will tell you that i use it, and i regret using it... It's slow. I made it check when a player get shot, if player HP is lower than 90!! than it applies an anim, and sometimes the player die before the anim applies..
Its not "slow" the callback is called AFTER the player takes damage.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)