How to boost the value of a bullet -
StreetboyBalkan - 29.11.2013
Hi guys,
does anyone know how to boost the value of a bullet,for example i want to get a single shot takes off 60 hp.
Sorry for my bad english,i think i explained well.
Re: How to boost the value of a bullet -
Ballu Miaa - 29.11.2013
You can use
wups include called OnPlayerShootPlayer. You need put the include in your /pawn/includes folder!
Then you need to add this on the top of your script after include <a_samp>.
Then you can use the following callback.
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
new Float:health;
if(GetPlayerWeapon(Shooter) == 24)//Lets say u wanted to increase damage of Deagle which is ID 24.
{
GetPlayerHealth(Target,health);//Get the remaining health after getting shot.
SetPlayerHealth(Target, health-5);//Deduct more 5 health from the Victim. You can increase this number for more health.
return 1;
}
}
EDIT:
I just realized that i forgot about the new callbacks introduced by SAMP Team.
Thanks to iZN and Chasm.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(weaponid == 24) SetPlayerHealth(playerid, Health-5);
return 1;
}
Re: How to boost the value of a bullet -
iZN - 29.11.2013
Quote:
Originally Posted by Ballu Miaa
You can use wups include called OnPlayerShootPlayer. You need put the include in your /pawn/includes folder!
Then you need to add this on the top of your script after include <a_samp>.
Then you can use the following callback.
pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost) { new Float:health; if(GetPlayerWeapon(Shooter) == 24)//Lets say u wanted to increase damage of Deagle which is ID 24. { GetPlayerHealth(Target,health);//Get the remaining health after getting shot. SetPlayerHealth(Target, health-5);//Deduct more 5 health from the Victim. You can increase this number for more health. return 1; } }
|
That's outdated mate. SA-MP has made a callback 'OnPlayerTakeDamage'
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
// Check if the issuer (attacker) exist and using a deagle (weapon id 24)
if(issuerid != INVALID_PLAYER_ID && weaponid == 24)
{
// The 'amount' is combined health + armour.
SetPlayerHealth(playerid, amount - 5); // You have deducted -5 amount from the player (victim).
return true;
}
}
Re: How to boost the value of a bullet -
Beckett - 29.11.2013
OnPlayerTakeDamage, OnPlayerGiveDamage.
Re: How to boost the value of a bullet -
Chasm - 29.11.2013
...
This is the easiest way, probaly.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(weaponid == 24) SetPlayerHealth(playerid, Health-46);
return 1;
}
Damage stacks, Deagle normally does 46 damage. Now it does 92 damage.
Re: How to boost the value of a bullet -
StreetboyBalkan - 29.11.2013
Thank you all man.I did what Chasm told me. REP+ for you