03.01.2015, 18:24
(
Последний раз редактировалось Kyance; 07.01.2015 в 14:55.
)
Thanks to one of my friends, I've found a bug which lets others kill you from a HUGE( could be infinite ) distance, which happens if you've been in a vehicle.
So, I got the max. distance for each weapon, and made a simple&short fix.
Updated, the ranges are more accurate ( Thanks to Lordzy & Vince )
So, I got the max. distance for each weapon, and made a simple&short fix.
pawn Код:
#define BULLET_HIT_TYPE_PLAYER 1
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
new
Float:tX, Float:tY, Float:tZ,
Float:distance
;
GetPlayerPos(hitid, tX, tY, tZ);
distance = GetPlayerDistanceFromPoint(playerid, tX, tY, tZ);
switch(weaponid)
{
case WEAPON_SILENCED, WEAPON_COLT45, WEAPON_DEAGLE, WEAPON_UZI, WEAPON_TEC9, WEAPON_SAWEDOFF:
{
if(distance > 35) return 0;
}
case WEAPON_SHOTGSPA, WEAPON_SHOTGUN:
{
if(distance > 40) return 0;
}
case WEAPON_MP5:
{
if(distance > 45) return 0;
}
case WEAPON_AK47:
{
if(distance > 70) return 0;
}
case WEAPON_M4:
{
if(distance > 90) return 0;
}
case WEAPON_RIFLE:
{
if(distance > 100) return 0;
}
case WEAPON_SNIPER:
{
if(distance > 300) return 0;
}
}
}
return 1;
}