OnPlayerWeaponShot
#2

Drive-by doesn't work with OnPlayerWeaponShot.

You'll have to use key detection (KEY_LOOK_LEFT/KEY_LOOK_RIGHT + KEY_FIRE ?).

You could use GetPlayerKeys under OnPlayerTakeDamage.

pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
    if(GetPlayerState(issuerid) == 2)
    {
        new keys, updown, leftright;
        GetPlayerKeys(issuerid, keys, updown, leftright);
        if((keys & KEY_LOOK_LEFT || keys & KEY_LOOK_RIGHT) && (keys & KEY_FIRE))
        {
            // Driver drive-by
        }
    }
    return 1;
}
NOTE: Players can drive-by FORWARDS (not holding KEY_LOOK_LEFT/RIGHT) while on a motorbike. You could check for that.

EDIT: Actually, thinking about it, you only really need to check if they are a driver, as obviously if they dealt damage from inside a vehicle, it's got to be a weapon. Although the exception is if they drive in to someone, for which the reason would be 'collision'.
Reply


Messages In This Thread
OnPlayerWeaponShot - by Admigo - 15.03.2014, 08:18
Re: OnPlayerWeaponShot - by MP2 - 15.03.2014, 08:33
Re: OnPlayerWeaponShot - by Admigo - 15.03.2014, 08:58
Re: OnPlayerWeaponShot - by MP2 - 15.03.2014, 09:50

Forum Jump:


Users browsing this thread: 1 Guest(s)