Disabling firing weapons from a vehicle if there is no driver (drive-by shooting).
#1

Hi,

I have been recently trying to figure out how to disable the drive-by shooting from a vehicle if there is no driver, I kinda made this code but it doesnt work lol. Can somebody help me? Would be appreciated(+rep)...

Код:
new allowed[MAX_PLAYERS]=0;
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
	{
	    PlayerLoop(i)
	    {
	        new numri=GetPlayerVehicleID(i);
	        if(numri == GetPlayerVehicleID(playerid))
	        {
	            if(GetPlayerVehicleSeat(i) == 0)
	            {
	                allowed[playerid]=1;
	            }
	            if(allowed[playerid]==0)
	            {
					return SendClientMessage(playerid, COLOR_LIGHTGREY, "You are not allowed to fire weapons in a vehicle without a driver."), SetPlayerArmedWeapon(playerid, 0);
				}
			}
		}
	}
        return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)