Infection
#7

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?
Reply


Messages In This Thread
Infection - by Kitten - 27.10.2010, 06:37
Re: Infection - by iggy1 - 27.10.2010, 06:41
Re: Infection - by Kitten - 27.10.2010, 06:44
Re: Infection - by Celson - 27.10.2010, 06:51
Re: Infection - by iggy1 - 27.10.2010, 06:53
Re: Infection - by Kitten - 27.10.2010, 06:55
Re: Infection - by Retardedwolf - 27.10.2010, 07:05
Re: Infection - by Kitten - 27.10.2010, 07:12

Forum Jump:


Users browsing this thread: 1 Guest(s)