27.10.2010, 07:05
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_FIRE)) {
if(GetPlayerWeapon(playerid) == 4) {
new
Float:X,
Float:Y,
Float:Z,
Float:hp;
GetPlayerPos(playerid, X, Y, Z);
foreach(Player, i)
{
if(GetPVarInt(playerid, "teamID") == GetPVarInt(i, "teamID")) return 1; //Change to detect your team options.
else
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, X, Y, Z))
{
GetPlayerHealth(i, hp);
SetPlayerHealth(i, hp-5.0);
}
}
}
}
}
return 1;
}
I would recommend using foreach for doing loops like this.
Also, they may be more than 1 mafia in his range so he could punch more than 1 at once and a mafia can't hit I mafia I guess?