12.03.2014, 18:56
Use the callbacks such as "OnPlayerGiveDamage" and "OnPlayerTakeDamage" to do that. And if you want to lower the damage being done than default damage, I suggest you to set player's team and then manage the damage. While using these callbacks, use GetPlayerDistanceFromPoint function to determine how meters you're away from the player.
For 3z:
Use OnPlayerWeaponShot. And here's an example:
The same can be done on with "OnPlayerGiveDamage" or "OnPlayerTakeDamage" in case if it's not for 3x or for 3z versions with lagcompmode Off.
For 3z:
Use OnPlayerWeaponShot. And here's an example:
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == HIT_TYPE_PLAYER)
{
new
Float:X, Float:Y, Float:Z;
GetPlayerPos(hitid, X, Y, Z);
if(GetPlayerDistanceFromPoint(playerid, X, Y, Z) < 4.0)
{
//More damage?
}
else
{
//If more than 3m.
}
}
return 1;
}