# Events & Commands

## Housing Exports

Use this export to know if a player is inside a house or not:

```lua
exports["jpr-housingsystem"]:isInHouse()
```

\
Use this export to know if a player owns a house or apartment:

```lua
exports["jpr-housingsystem"]:PlayerHaveAnyHouse(Here put citizen id or player identifier on esx)
```

Use this export to give keys to a player:

```lua
exports["jpr-housingsystem"]:AddKeyHolder(Citizen ID or Identifier of new keyholder,House or Apartment name,Citizen ID or Identifier of owner)
```

## Radial Menu Events

Change Stash:

```lua
TriggerEvent('jpr-housingsystem:client:ChangeStashCommand')
```

Change Wardrobe:

```lua
TriggerEvent('jpr-housingsystem:client:ChangeWardrobeCommand')
```

Change Logout:

```lua
TriggerEvent('jpr-housingsystem:client:ChangeLogoutCommand')
```

## Give starter apartment

To give a start aparment you just need to have a apartment  created and know is name.

```lua
exports['jpr-housingsystem']:GiveStarterApartment("StartingApartment", vector3(260.86, -999.27, -100.01), function()
        FreezeEntityPosition(ped, false)
        RenderScriptCams(false, true, 500, true, true)
        SetCamActive(cam, false)
        DestroyCam(cam, true)
        SetCamActive(cam2, false)
        DestroyCam(cam2, true)
        SetEntityVisible(ped, true)

        Wait(500)
        TriggerEvent('qb-clothes:client:CreateFirstCharacter')
end)
```

{% hint style="info" %}
The coordinates you see after “**StartingApartment**”, are the coordinates where you want the player to be when you open the **clothing menu**, why do we do this?

Because sometimes, players appear near the door after obtaining the starting apartment, and don't have the space to use the clothing menu correctly.

So, if necessary, you can provide the coordinates where you'd like the player to use the menu (it has to be inside the shell you're using).

**If you're using the default Starting Aparment provided by the script, rest assured, you don't need to change anything, as the coords are correct.**
{% endhint %}

{% hint style="danger" %}
If you change apartment name you should have it created on main\_config.lua file, otherwise, just use our default one.
{% endhint %}


---

# 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://joaos-organization-3.gitbook.io/jpresources-documentation/installation/housing-system/events-and-commands.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.
