> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectx.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Commands

> Admin and development commands for House Robbery V2

## Development Commands

<AccordionGroup>
  <Accordion title="getoffset" icon="ruler">
    **Usage**: `/getoffset [x] [y] [z]`

    **Permission**: Admin (configurable)

    **Description**: Gets the offset coordinates for positioning items inside a shell. This is essential when creating custom presets.

    **Parameters**:

    * `x, y, z` (optional) - World coordinates to convert to offset
    * If no parameters are provided, uses your current character position

    **Returns**: Offset coordinates that can be used in preset configurations

    **Use Case**: Use this command while inside a shell to get the correct offset coordinates for:

    * Lootable spots positions
    * Prop placements
    * Cash locations
    * Safe positions
    * Painting coordinates
    * Display case positions
    * High value item locations
    * Tenant spawn points
    * Pet spawn points
    * Laser system positions
    * Alarm box positions

    **Example Workflow**:

    1. Enter a shell interior
    2. Stand at the location where you want to place an item
    3. Run `/getoffset`
    4. Paste the returned coordinates into your preset configuration

    **Example Output**:

    ```lua theme={null}
    -- If you run /getoffset while standing at a location
    -- The command returns: vector3(-771.69, 335.96, 195.94)
    -- Use this in your preset like:
    ["Coords"] = vector3(-771.69, 335.96, 195.94)
    ```

    <Info>
      This command is crucial for creating accurate presets. See the [Presets Guide](/resources/house-robbery-v2/guides/presets) for detailed information on using these coordinates.
    </Info>
  </Accordion>

  <Accordion title="polycreate" icon="draw-polygon">
    **Usage**: `/polycreate`

    **Permission**: Admin (configurable)

    **Requirements**: `Config.PolyTool` must be set to `true` in the main config

    **Description**: Creates detection zones around tenants (NPCs) inside houses. This defines the area where tenants can detect players during robberies.

    **Returns**: Polyzone coordinates that can be used in tenant detection configuration

    **Use Case**: Use this command to create detection zones for tenants in your preset:

    1. Enable `Config.PolyTool = true` in config
    2. Place a tenant NPC in the house
    3. Run `/polycreate` near the tenant
    4. Walk around the area to define the detection boundaries
    5. Complete the zone creation (follow on-screen instructions)
    6. Paste the returned coordinates into your preset

    **Example Output**:

    ```lua theme={null}
    -- The command returns coordinates like:
    vec(-773.58, 313.86, 195.89),
    vec(-773.48, 323.12, 195.89),
    vec(-780.63, 322.83, 195.89),
    vec(-780.67, 313.86, 195.89)

    -- Use these in your tenant configuration:
    ["Tenants"] = {
        {
            ["Coords"] = vector4(-774.9, 318.97, 195.89, 91.18),
            ["Model"] = "s_m_m_strpreach_01",
            ["Animation"] = {Dict = "timetable@ron@ig_3_couch", Anim = "base"},
            ["Detection"] = {
                ["Enable"] = true,
                ["ZoneCoords"] = {
                    vec(-773.58, 313.86, 195.89),
                    vec(-773.48, 323.12, 195.89),
                    vec(-780.63, 322.83, 195.89),
                    vec(-780.67, 313.86, 195.89)
                },
                ["ZoneHeight"] = 4.0
            }
        }
    }
    ```

    <Warning>
      Remember to set `Config.PolyTool = false` in production to prevent players from accessing this command.
    </Warning>

    <Info>
      See the [Presets Guide](/resources/house-robbery-v2/guides/presets#tenants) for more information on tenant detection zones.
    </Info>
  </Accordion>
</AccordionGroup>

## Administration Commands

<AccordionGroup>
  <Accordion title="lockhouse" icon="lock">
    **Usage**: `/lockhouse`

    **Permission**: Admin by default (can be configured for police)

    **Description**: Resets and re-locks the closest house to your character. This is useful for testing or when a robbery needs to be manually reset.

    **Requirements**: Must be standing outside near a house door

    **What it does**:

    * Finds the closest house to your position
    * Resets the house's robbery state
    * Locks the house doors
    * Respawns all lootable items
    * Resets all security systems (alarms, lasers)
    * Removes any active tenants/pets
    * Clears the house cooldown

    **Use Cases**:

    * Testing house configurations after changes
    * Manually resetting a bugged house
    * Clearing a house after a failed robbery
    * Admin intervention during police scenarios
    * Resetting houses for events or testing

    **Configuration**:
    By default, this command is set up for admins only. You can configure it to allow police officers to use it by modifying the permission check in the script.

    **Example Scenario**:

    1. A robbery gets stuck or bugged
    2. Admin goes to the house entrance
    3. Runs `/lockhouse`
    4. House is reset and ready for another robbery

    <Info>
      This command is essential for server administration and testing. Make sure only trusted users have access to it.
    </Info>
  </Accordion>
</AccordionGroup>

## Configuration

All commands respect your server's permission system. By default:

* **Development Commands** (`getoffset`, `polycreate`): Admin only
* **Administration Commands** (`lockhouse`): Admin only (configurable for police)

You can modify command permissions in your server's admin/permissions system or by editing the script's permission checks.

## Tips for Using Commands

### Creating Presets

1. **Use getoffset extensively**: When creating a new preset, use `/getoffset` for every single item, spot, and prop position
2. **Test as you go**: After adding each item to your preset, restart the resource and test it in-game
3. **Document your work**: Keep notes of what each coordinate represents while building presets

### Setting Up Detection Zones

1. **Enable PolyTool first**: Set `Config.PolyTool = true` before using `/polycreate`
2. **Walk the area**: Create detection zones by walking the boundaries you want
3. **Test detection**: After setting up zones, test them by entering as a player
4. **Adjust height**: Set appropriate `ZoneHeight` values based on the room's ceiling height
5. **Disable in production**: Always set `Config.PolyTool = false` before going live

### Testing Houses

1. **Use lockhouse for quick resets**: Instead of waiting for cooldowns, use `/lockhouse` to instantly reset
2. **Test all security features**: After using `/lockhouse`, verify alarms, lasers, and detection zones work
3. **Check loot spawning**: Ensure all props, spots, and items respawn correctly after reset

## Troubleshooting

<AccordionGroup>
  <Accordion title="getoffset not working" icon="circle-xmark">
    **Possible causes**:

    * Not inside a shell interior
    * Incorrect admin permissions
    * Command not registered properly

    **Solutions**:

    * Verify you're inside a shell (not IPL)
    * Check your admin permissions level
    * Restart the resource
    * Check server console for errors
  </Accordion>

  <Accordion title="polycreate not available" icon="circle-xmark">
    **Possible causes**:

    * `Config.PolyTool` is set to `false`
    * Incorrect admin permissions
    * ox\_lib not properly installed

    **Solutions**:

    * Set `Config.PolyTool = true` in config/main.lua
    * Verify admin permissions
    * Ensure ox\_lib is started before the resource
    * Restart the resource after config changes
  </Accordion>

  <Accordion title="lockhouse doesn't find the house" icon="circle-xmark">
    **Possible causes**:

    * Standing too far from the house door
    * House not properly configured
    * Wrong coordinates in house config

    **Solutions**:

    * Stand directly at the door location
    * Verify house exists in config/houses.lua
    * Check door coordinates are correct
    * Try moving closer to the entrance
  </Accordion>

  <Accordion title="Coordinates are offset incorrectly" icon="circle-xmark">
    **Possible causes**:

    * Using world coordinates instead of offset coordinates
    * Wrong interior type (Shell vs IPL)
    * Preset doesn't match the shell being used

    **Solutions**:

    * Always use `/getoffset` inside the shell, never world coordinates
    * Verify the shell name matches your preset name
    * Double-check you're using the correct shell model
    * Test coordinates immediately after getting them
  </Accordion>
</AccordionGroup>
