How to disable shooting from vehicles...
#1

...well the title says it all.How can i do so they cant hit 'H' and shoot from vehicles (car windows...)
Reply
#2

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;
}
Reply
#3

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
Reply
#4

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.
Reply
#5

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);
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)