How to disable shooting from vehicles... - 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: How to disable shooting from vehicles... (
/showthread.php?tid=556395)
How to disable shooting from vehicles... -
Fjclip99 - 10.01.2015
...well the title says it all.How can i do so they cant hit 'H' and shoot from vehicles (car windows...)
Re: How to disable shooting from vehicles... -
iReacheR - 10.01.2015
Well, I cant think of any way for stopping that from happening at all but you can use the following code
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(IsPlayerInAnyVehicle(playerid)) return 0; //This would prevent any bullets being shot from a player in a vehicle to give any damage
return 1;
}
Re: How to disable shooting from vehicles... -
VishvaJeet - 10.01.2015
pawn Код:
forward FreeWeapons();
public OnFilterScriptInt()
{
SetTimer("FreeWeapons",500,1);
}
public FreeWeapons()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
SetPlayerArmedWeapon(i, 0);
}
}
}
Try this
Re: How to disable shooting from vehicles... -
PowerPC603 - 10.01.2015
OnPlayerWeaponShot won't trigger when you fire guns from inside a vehicle, so don't bother trying that.
The best option (and probably the only one) would be setting their current weapon to fists when entering the vehicle, as ****** said already.
Re: How to disable shooting from vehicles... -
Garavel - 10.01.2015
put the following code under "OnPlayerStateChange"
Код:
if(newstate == PLAYER_STATE_PASSENGER)
{
SetPlayerArmedWeapon(playerid,0);
}
or if you want to disable driver drive-by too
Код:
if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER)
{
SetPlayerArmedWeapon(playerid,0);
}