onplayerweapon shot car?
#3

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	if(hittype == 2)
        {
		new bool: isany_incar = false;

		for(new i = 0; i < MAX_PLAYERS; ++i)
		{
			if(IsPlayerInVehicle(i, hitid))
			{
				isany_incar = true;
				break;
			}
		}

		if(isany_incar != true)//You hit a vehicle with noone sitting inside.
		{
                        //the vehicle's ID you've hit is hitid
			new Float:vHealth;
			GetVehicleHealth(hitid, vHealth);
			SetVehicleHealth(hitid, vHhealth - 50);
		}
    }
    return 1;
}
I hope this helps. If you need more details or an explanation somewhere just tell me, should be clear as you read the code with the comments.
Reply


Messages In This Thread
onplayerweapon shot car? - by StR_MaRy - 14.11.2016, 14:27
Re: onplayerweapon shot car? - by IceBilizard - 14.11.2016, 15:18
Re: onplayerweapon shot car? - by Awide - 14.11.2016, 15:21
Re: onplayerweapon shot car? - by StR_MaRy - 14.11.2016, 15:33
Re: onplayerweapon shot car? - by Awide - 14.11.2016, 15:44
Re: onplayerweapon shot car? - by StR_MaRy - 14.11.2016, 15:48
Re: onplayerweapon shot car? - by Awide - 14.11.2016, 16:14
Re: onplayerweapon shot car? - by IceBilizard - 14.11.2016, 16:15
Re: onplayerweapon shot car? - by StR_MaRy - 14.11.2016, 16:24
Re: onplayerweapon shot car? - by SickAttack - 14.11.2016, 17:19

Forum Jump:


Users browsing this thread: 2 Guest(s)