# 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)
```


---

# Agent Instructions: 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://documentation.rcore.cz/paid-resources/rcore_camping/api.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.
