PDA

View Full Version : Prevent shooting out of any car?


axi92
25/03/2015, 12:45 PM
Is there a way to prevent shooting out of cars whether the player is the driver or not?

Pottus
25/03/2015, 01:22 PM
Just set their armed weapon to 0 when they get in a car you can also check when they fire a weapon just in case.

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE &&
IsPlayerInAnyVehicle(playerid) &&
GetPlayerWeapon(playerid) != 0)
SetPlayerArmedWeapon(playerid, 0);
return 1;
}

axi92
26/03/2015, 05:04 AM
How do I handle if someone press "H" to hang out of the car?

CalvinC
26/03/2015, 05:55 AM
Use KEY_CROUCH.
http://wiki.sa-mp.com/wiki/Keys