Damage script. - 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: Damage script. (
/showthread.php?tid=349969)
Damage script. -
Misterflowers - 10.06.2012
Hello, I need an damage script, when you shooting at someone like with Deagle it'll damage 70 percent of his HP.
Re: Damage script. -
sniperwars - 10.06.2012
Why don't you
search before posting this thread ?
Re: Damage script. -
Elysian` - 10.06.2012
there is an include OPSP (OnPlayerShootPlayer), you can use that.
Re: Damage script. -
Randy More - 10.06.2012
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.
Re: Damage script. -
JhnzRep - 10.06.2012
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.
Re: Damage script. -
Randy More - 10.06.2012
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?
Re : Damage script. -
ricardo178 - 10.06.2012
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..
Re: Re : Damage script. -
PrawkC - 10.06.2012
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.