> For the complete documentation index, see [llms.txt](https://documentation.rcore.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.rcore.cz/paid-resources/rcore_camping/api.md).

# API

**Integrate Camping with your system**

{% hint style="danger" %}
All events are **SERVER SIDE**!
{% endhint %}

## Server Events

### Extinguish fire

**If fireplace object exists on provided coords, player is in allowed distance and fireplace is lighted, the object is deleted and replaced with `object` specified in config**

```lua
TriggerEvent('rcore_camping:extinguish', objCoords)
```

### Light fireplace

**If fireplace object exists on provided coords, player is in allowed distance and fireplace is not lighted, player needs any item specified in `Config.LightItems` (flint by default) and after successful usage of light item the item is removed and the object is deleted and replaced with `inFireObject` specified in config**

```lua
TriggerEvent('rcore_camping:fire', objCoords)
```

### Add fuel to fireplace

**If fireplace object exists on provided coords, player is in allowed distance and fireplace is lighted, player needs 'wood' item, the item is removed and fireplace duration is increased on success**

```lua
TriggerEvent('rcore_camping:addFuel', objCoords)
```

### Cook on fireplace

**If fireplace object exists on provided coords, player is in allowed distance and fireplace is lighted, player needs item specified in `Config.FireCraftable` and after some time the item is replaced with result item**

```lua
TriggerEvent('rcore_camping:canCook', objCoords, cookData)
```

### Clear campign object

**If any camping object exists on provided coords while player is in allowed distance, the object is removed and added into player's inventory (this does not apply for fireplace)**

```lua
TriggerEvent('rcore_camping:clear', objCoords)
```

### Enter a tent

**If tent object exists on provided coords, player is in allowed distance and not already in any tent, player enters the tent.**

```lua
TriggerEvent('rcore_camping:enterTent', objCoords)
```

### Take a beer from beerkeg

**If beerkeg object exists on provided coords, player is in allowed distance and beerkeg is not empty, player takes beer from beerkeg**

```lua
TriggerEvent('rcore_camping:takeBeer', objCoords, BeerType['0_5'])
TriggerEvent('rcore_camping:takeBeer', objCoords, BeerType['0_3'])
```

### Sit on chair

**If chair object exists on provided coords, player's state of sitting is updated with provided `true/false` value**

```lua
TriggerEvent('rcore_camping:sit', objCoords, true) -- is sitting
TriggerEvent('rcore_camping:sit', objCoords, false) -- is not sitting
```

### Place a camping object

**places a camping object on coords**

```lua
TriggerEvent('rcore_camping:place', objName, objCoords, objHeading)
```

### Place a camping object

**server event which places a camping object on coords**

```lua
TriggerEvent('rcore_camping:serverPlace', objName, objCoords, objHeading)
```

### Cancel placement

**cancels current placement of camping object and returns last camping item used to player's inventory**

```lua
TriggerEvent('rcore_camping:cancel')
```

### Leave a tent

**If player is in any tent, player leaves the tent**

```lua
TriggerEvent('rcore_camping:leaveTent')
```

### Camping object placed

**server event called when camping object is placed on coords**

```lua
AddEventHandler('rcore_camping:objectPlaced', function(objName, objCoords, objHeading)

end)
```

### Camping object cleared

**server event called when camping object is cleared on coords**

```lua
AddEventHandler('rcore_camping:objectCleared', function(objName, objCoords)

end)
```
