public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(GetPlayerWeapon(playerid) == 34)
{
new Float:Alma;
GetPlayerHealth(playerid,health);
SetPlayerHealth(damageid,Alma - 100);
}
return 1;
}
Try
![]() PHP код:
|
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(GetPlayerWeapon(playerid) == 34)
{
SetPlayerHealth(damageid,0);
}
return 1;
}
Utilize o OnPlayerWeaponShot. Nгo recomendo nunca o OnPlayerGiveDamage para isso, se nгo vocк estaria desconsiderando qualquer tipo de lag. Depois, basta verificar a posiзгo do player: se estiver prуximo, talvez uns 300.0 de distвncia, pode setar a vida. Caso contrбrio, return false.
|
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) {
if(hittype == 1) {
if(weaponid == 34) {
SetPlayerHealth(hitid, 0);
}
}
return 1;
}
PHP код:
|
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == 1)
{
if(weaponid == 34)
{
new Float:armour,Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
GetPlayerArmour(hitid, armour);
//20.0 й a distancia
if(IsPlayerInRangeOfPoint(hitid, 20.0, x, y, z))
{
SetPlayerHealth(hitid, 0);
}
else
{
if(armour >= 1)
{
SetPlayerArmour(hitid, 0);
}
else
{
SetPlayerHealth(hitid, 0);
}
}
}
}
return 1;
}