SA-MP Forums Archive
Prevent shooting out of any car? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Prevent shooting out of any car? (/showthread.php?tid=568804)



Prevent shooting out of any car? - axi92 - 25.03.2015

Is there a way to prevent shooting out of cars whether the player is the driver or not?


Re: Prevent shooting out of any car? - Pottus - 25.03.2015

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.

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



AW: Prevent shooting out of any car? - axi92 - 26.03.2015

How do I handle if someone press "H" to hang out of the car?


Re: Prevent shooting out of any car? - CalvinC - 26.03.2015

Use KEY_CROUCH.
https://sampwiki.blast.hk/wiki/Keys