# Infinite Fuel & Ammo

## Ammo

{% tabs %}
{% tab title="Infinite Ammo" %}
Choose a vehicle and place it down. Then double-click on it and insert this code into the init field:

{% code overflow="wrap" %}

```sqf
this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}]
```

{% endcode %}
{% endtab %}

{% tab title="Infinite Ammo On Respawn" %}
Put this in the init field of the vehicle:

{% code overflow="wrap" %}

```sqf
this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}]
```

{% endcode %}

And put this in the Expression field of the Vehicle Respawn module:

{% code overflow="wrap" %}

```sqf
params ["_newVehicle","_oldVehicle"]; _newVehicle addEventHandler ["fired", {(_this select 0) setVehicleAmmo 1}];
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Fuel

{% tabs %}
{% tab title="Infinite Fuel" %}
Choose a vehicle and place it down. Then double-click on it and insert this code into the init field:

***

### Code 1

{% code overflow="wrap" %}

```sqf
this spawn {while {alive _this} do {uisleep 300; _this setFuel 1}};
```

{% endcode %}

***

### Code 2

<pre class="language-sqf" data-overflow="wrap"><code class="lang-sqf"><strong>this addEventHandler ["Fuel", {(_this select 0) setFuel 1}];
</strong></code></pre>

{% endtab %}

{% tab title="Infinite Fuel on Respawn" %}

### Code 1

Put this in the init field of the vehicle:

```sqf
this spawn {while {alive _this} do {uisleep 300; _this setFuel 1}};
```

And put this in the Expression field of the Vehicle Respawn module:

{% code overflow="wrap" %}

```sqf
params ["_newVehicle","_oldVehicle"]; _newVehicle spawn {while {alive _this} do {uisleep 300; _this setFuel 1}};
```

{% endcode %}

***

### Code 2

Put this in the init field of the vehicle:

{% code overflow="wrap" %}

```sqf
this addEventHandler ["Fuel", {(_this select 0) setFuel 1}];
```

{% endcode %}

And put this in the Expression field of the Vehicle Respawn module:

{% code overflow="wrap" %}

```sqf
_newVehicle addEventHandler ["Fuel", {(_this select 0) setFuel 1}];
```

{% endcode %}
{% endtab %}
{% endtabs %}
