03.09.2012, 14:35
This may work.
pawn Код:
new bool:works[MAX_PLAYERS],_i = 0,_e,Float:_D[3];
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) == 24) // checking if has a deagle
{
_e = GetMaxPlayers();
GetPlayerPos(playerid,_D[0],_D[1],_D[2]);//player pos.
for(; _i < _e; ++_i) // loop.
{
if(IsPlayerInRangeOfPoint(_i,1.0,_D[0],_D[1],_D[2])) // checking if there's players near to him.
{
works[playerid] = true; // setting the bool.
}
}
}
works[playerid] = false; // not near.
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
if(works[playerid]) // if true, it means, he has the wep in his hand's, so it doesn't matter if he punch's or not.
{
SetPlayerHealth(playerid, HP-50); // setting his health -50 while is being punched or not.
}
return 1;
}