15.03.2014, 08:33
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.
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'.
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;
}
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'.