# 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kaarlos.gitbook.io/arma3-documentation/snippets-and-scripts/infinite-fuel-and-ammo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
