OnPlayerWeaponShot
#1

Hey everyone.
I need a bit of help, Here i'm detecting if team_hunter shoots team_prop's (Object) which is Prop[i]. But in-game if hunter shoots the object it dosen't kills prop :/ I have no idea what's wrong

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    foreach(new ii: Player)
    if(GetPlayerTeam(ii) == team_hunter)
    {
        if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
        {
            foreach(new i:Player)
            {
                if(GetPlayerTeam(ii) != team_prop) continue;
                if(hitid == Prop[i])
                {
                    SetPlayerHealth(i, 0);
                    SendClientMessage(i, -1, "Test");
                    break;
                }
            }
        }
    }
    return 1;
}

I've also tried this.


pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    switch (hittype)
    {
        case BULLET_HIT_TYPE_PLAYER_OBJECT:
        {
            foreach(new i:Player)
            foreach(new ii: Player)
            {
                if(GetPlayerTeam(i) == team_hunter) continue;
                if(GetPlayerTeam(ii) == team_prop) continue;
                if(hitid == Prop[ii])
                {
                    SetPlayerHealth(ii, 0);
                    SendClientMessage(ii, -1, "You have been killed");
                    break;
                }
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
OnPlayerWeaponShot - by Rudy_ - 04.10.2014, 17:57
Re: OnPlayerWeaponShot - by Stinged - 04.10.2014, 18:11
Re: OnPlayerWeaponShot - by ranme15 - 04.10.2014, 18:17
Re: OnPlayerWeaponShot - by Rudy_ - 04.10.2014, 18:19
Re: OnPlayerWeaponShot - by Eth - 04.10.2014, 18:23
Re: OnPlayerWeaponShot - by IceCube! - 04.10.2014, 18:28
Re: OnPlayerWeaponShot - by Rudy_ - 04.10.2014, 18:34
Re: OnPlayerWeaponShot - by IceCube! - 04.10.2014, 18:59
Re: OnPlayerWeaponShot - by Eth - 04.10.2014, 19:04
Re: OnPlayerWeaponShot - by Rudy_ - 05.10.2014, 09:48

Forum Jump:


Users browsing this thread: 2 Guest(s)