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);
if(IsPlayerInRangeOfPoint(hitid, 20.0, x, y, z))
{
if(armour >= 1) // se o colete for maior ou igual a 1 :
{
SetPlayerArmour(hitid, 0); // o colete й retirado
}
else // se nao tiver colete a vida й setada a 0 com apenas um tiro
{
SetPlayerHealth(hitid, 0);
}
}
else // se nao tiver na distancia de 20.0 o tiro vai ser normal retirando apenas metade da vida
{
}
}
}
return 1;
}
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);
if(IsPlayerInRangeOfPoint(hitid, 20.0, x, y, z))
{
if(armour > 0) // se o colete for maior ou igual a 1 :
{
SetPlayerArmour(hitid, 0); // o colete й retirado
}
else // se nao tiver colete a vida й setada a 0 com apenas um tiro
{
SetPlayerHealth(hitid, 0);
}
}
else // se nao tiver na distancia de 20.0 o tiro vai ser normal retirando apenas metade da vida
{
return 1;
}
}
}
return 1;
}
PHP код:
|
/*
Distвncia >= 20
- Colete != 0: zera o colete
- Colete == 0: zera a vida
Distвncia < 20
- Colete != 0: nгo danifica
- Colete == 0: tira 10 de vida.
*/
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == 1)
{
if(weaponid == 34)
{
static
Float:health,
Float:armour;
GetPlayerHealth(hitid, health);
GetPlayerArmour(hitid, armour);
new Float:distance = GetPlayerDistanceFromPoint(playerid, fX, fY, fZ);
if(distance >= 20.0)
{
if(armour)
{
SetPlayerArmour(hitid, 0);
}
else
{
SetPlayerHealth(hitid, 0);
}
}
else
{
if(!armour)
{
SetPlayerHealth(hitid, (health - 10));
}
}
}
}
return 1;
}
PHP код:
|
if(distance <= 10) {
return 0;
}
Retorne 0 caso a distвncia seja menor ou igual а que vocк considera prуxima.
Ex: pawn Код:
|
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
amount = amount/2;
new Float:Life, Float:Coleete, Float:Dano;
GetPlayerArmour(damagedid, Coleete);
GetPlayerHealth(damagedid, Life);
//if(weaponid == 34){amount = 100;}//sniper
if(Coleete > 0)
{
if(amount > Coleete)
{
Dano = amount - Coleete;
Life = Life - Dano;
SetPlayerArmour(damagedid, 0.0);
SetPlayerHealth(damagedid, Life);
return 1;
}
Coleete = Coleete - amount;
SetPlayerArmour(damagedid, Coleete);
}
if(Coleete < 1)
{
Life = Life - amount;
SetPlayerHealth(damagedid, Life);
}
return 1;
}