public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
if (weaponid == 34)//We check whether the player is with a sniper ...
{
new Float:fX,Float:fY,Float:fZ;
GetPlayerPos(playerid, fX, fY, fZ);//We will store the position of the shooter.
if (IsPlayerInRangeOfPoint(damagedid, 50.0, fX, fY, fZ))//Check if the player who took the damage is within 20 meters from the shooter.
{
new Float:health;
GetPlayerHealth(damagedid, health);
SetPlayerHealth(damagedid, health - 1.0);
}
}
if (weaponid == 36)//We check whether the player is with a bazooka
{
new Float:fX,Float:fY,Float:fZ;
GetPlayerPos(playerid, fX, fY, fZ);//We will store the position of the shooter.
if (IsPlayerInRangeOfPoint(damagedid, 20.0, fX, fY, fZ))// Check if the player who took the damage is within 20 meters from the shooter.
{
new Float:health;
GetPlayerHealth(damagedid, health);
SetPlayerHealth(damagedid, health - 1.0);
}
}
return 1;
}
Try the weaponid 51.
https://sampwiki.blast.hk/wiki/Weapons |
Weapon id 36 is WEAPON_HEATSEEKER and for WEAPON_ROCKETLAUNCHER i.e. your bazoka, the weapon id is 35.
|
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { if (weaponid == 34)//We check whether the player is with a sniper ... { new Float:fX,Float:fY,Float:fZ; GetPlayerPos(playerid, fX, fY, fZ);//We will store the position of the shooter. if (IsPlayerInRangeOfPoint(damagedid, 50.0, fX, fY, fZ))//Check if the player who took the damage is within 20 meters from the shooter. { new Float:health; GetPlayerHealth(damagedid, health); SetPlayerHealth(damagedid, health - 1.0); } } if (weaponid == 35)//We check whether the player is with a bazooka { new Float:fX,Float:fY,Float:fZ; GetPlayerPos(playerid, fX, fY, fZ);//We will store the position of the shooter. if (IsPlayerInRangeOfPoint(damagedid, 20.0, fX, fY, fZ))// Check if the player who took the damage is within 20 meters from the shooter. { new Float:health; GetPlayerHealth(damagedid, health); SetPlayerHealth(damagedid, health - 1.0); } } return 1; }