RE:CORD
REC_Farm

Installation

Installation, configuration, and usage for REC_Farm.
Added
Updated

Download the dependencies

Docs - REC_Library

Follow the installation

Docs - REC_Utils

Follow the installation

Docs - REC_PlayerManager

Follow the installation

GitHub - oxmysql

Download from here!!

Download main resource

Cfx Portal - REC_Farm

Download from your granted assets.

Place the REC_Farm folder from your distribution inside the server’s resources directory.

Import the SQL files

Apply the SQL below to your server database before starting the resource.

rec_farm.sql
CREATE TABLE IF NOT EXISTS `rec_farm_farms` (
    `id`              BIGINT(8)    NOT NULL AUTO_INCREMENT,
    `siteId`          VARCHAR(64)  NOT NULL,
    `name`            VARCHAR(64)  NOT NULL,
    `ownerCitizenId`  VARCHAR(64)  NOT NULL,
    `simTime`         BIGINT       NOT NULL DEFAULT 0,
    `settings`        JSON         NULL,
    `createdAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updatedAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `siteId` (`siteId`),
    INDEX `idx_rec_farm_farms_owner` (`ownerCitizenId`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `rec_farm_members` (
    `farmId`          BIGINT(8)    NOT NULL,
    `citizenId`       VARCHAR(64)  NOT NULL,
    `role`            VARCHAR(16)  NOT NULL,
    `name`            VARCHAR(64)  NULL,
    `createdAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`farmId`, `citizenId`),
    INDEX `idx_rec_farm_members_citizen` (`citizenId`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `rec_farm_plots` (
    `farmId`          BIGINT(8)    NOT NULL,
    `plotId`          VARCHAR(32)  NOT NULL,
    `seed`            INT          NOT NULL,
    `obstacles`       JSON         NOT NULL,
    `createdAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updatedAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`farmId`, `plotId`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `rec_farm_cells` (
    `farmId`          BIGINT(8)    NOT NULL,
    `cellKey`         VARCHAR(32)  NOT NULL,
    `data`            JSON         NOT NULL,
    `updatedAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`farmId`, `cellKey`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `rec_farm_structures` (
    `id`              BIGINT(8)    NOT NULL AUTO_INCREMENT,
    `farmId`          BIGINT(8)    NOT NULL,
    `kind`            VARCHAR(64)  NOT NULL,
    `data`            JSON         NOT NULL,
    `createdAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updatedAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    INDEX `idx_rec_farm_structures_farm` (`farmId`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `rec_farm_animals` (
    `id`              BIGINT(8)    NOT NULL AUTO_INCREMENT,
    `farmId`          BIGINT(8)    NOT NULL,
    `species`         VARCHAR(64)  NOT NULL,
    `data`            JSON         NOT NULL,
    `createdAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updatedAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    INDEX `idx_rec_farm_animals_farm` (`farmId`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `rec_farm_shipments` (
    `id`              BIGINT(8)    NOT NULL AUTO_INCREMENT,
    `farmId`          BIGINT(8)    NOT NULL,
    `data`            JSON         NOT NULL,
    `createdAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updatedAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    INDEX `idx_rec_farm_shipments_farm` (`farmId`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `rec_farm_players` (
    `citizenId`       VARCHAR(64)  NOT NULL,
    `skills`          JSON         NOT NULL,
    `tutorialDone`    TINYINT(4)   NOT NULL DEFAULT 0,
    `createdAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updatedAt`       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`citizenId`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

-- every JSON column holds the same table the server keeps in memory, the rows are rewritten
-- whole from the dirty flag sweep (config.persistence.saveInterval) and on resource stop

Register the items

_install/ox_inventory_items.lua builds and returns ordinary items and all one-to-five-star products. Merge the resulting entries into the table returned by ox_inventory/data/items.lua. The whole module, including local, loops and return, cannot be pasted inside a table.

To make the hoe usable from inventory, add server = { export = "REC_Farm.useHoe" } and consume = 0. Seeds use REC_Farm.useSeed; repair kits use REC_Farm.useRepairKit.

_install/ox_inventory_items.lua
--[[
    Definitions to append to ox_inventory/data/items.lua
    (keep the names in sync with config/data/*.lua)

    Graded products exist once per star: <item>_1star ... <item>_5star.
    The generator at the bottom writes them all, copy its output into items.lua.
]]

local items = {

    -- tools (durability is the wear, a repair kit restores it)
    ['rec_farm_hoe'] = { label = 'Hoe', weight = 1500, stack = false, close = true, durability = true, },
    ['rec_farm_axe'] = { label = 'Axe', weight = 2000, stack = false, close = true, durability = true, },
    ['rec_farm_pickaxe'] = { label = 'Pickaxe', weight = 2500, stack = false, close = true, durability = true, },
    ['rec_farm_scythe'] = { label = 'Scythe', weight = 1800, stack = false, close = true, durability = true, },
    ['rec_farm_shovel'] = { label = 'Shovel', weight = 1800, stack = false, close = true, durability = true, },
    ['rec_farm_basket'] = { label = 'Harvest basket', weight = 800, stack = false, close = true, durability = true, },
    ['rec_farm_brush'] = { label = 'Animal brush', weight = 300, stack = false, close = true, durability = true, },
    ['rec_farm_shears'] = { label = 'Shears', weight = 600, stack = false, close = true, durability = true, },
    ['rec_farm_bucket'] = { label = 'Milk bucket', weight = 900, stack = false, close = true, durability = true, },
    ['rec_farm_watering_can'] = { label = 'Watering can', weight = 800, stack = false, close = true, durability = true, description = 'The durability is the water level.', },
    ['rec_farm_repair_kit'] = { label = 'Tool repair kit', weight = 500, stack = true, close = true, consume = 0, server = { export = 'REC_Farm.useRepairKit', }, },

    -- soil
    ['rec_farm_fertilizer'] = { label = 'Fertilizer', weight = 300, stack = true, close = true, },
    ['rec_farm_compost'] = { label = 'Compost', weight = 400, stack = true, close = true, },
    ['rec_farm_manure'] = { label = 'Manure', weight = 500, stack = true, close = true, },
    ['rec_farm_stone'] = { label = 'Stone', weight = 800, stack = true, close = true, },
    ['rec_farm_wood'] = { label = 'Wood', weight = 600, stack = true, close = true, },

    -- seeds (usable, the export starts planting at the cell the player looks at)
    ['rec_farm_tomato_seed'] = { label = 'Tomato seeds', weight = 10, stack = true, close = true, consume = 0, server = { export = 'REC_Farm.useSeed', }, },
    ['rec_farm_wheat_seed'] = { label = 'Wheat seeds', weight = 10, stack = true, close = true, consume = 0, server = { export = 'REC_Farm.useSeed', }, },
    ['rec_farm_corn_seed'] = { label = 'Corn seeds', weight = 10, stack = true, close = true, consume = 0, server = { export = 'REC_Farm.useSeed', }, },
    ['rec_farm_potato_seed'] = { label = 'Seed potatoes', weight = 20, stack = true, close = true, consume = 0, server = { export = 'REC_Farm.useSeed', }, },
    ['rec_farm_pumpkin_seed'] = { label = 'Pumpkin seeds', weight = 10, stack = true, close = true, consume = 0, server = { export = 'REC_Farm.useSeed', }, },

    -- crop / animal medicine
    ['rec_farm_fungicide'] = { label = 'Fungicide', weight = 200, stack = true, close = true, },
    ['rec_farm_pesticide'] = { label = 'Pesticide', weight = 200, stack = true, close = true, },
    ['rec_farm_medicine_cold'] = { label = 'Cold medicine', weight = 150, stack = true, close = true, },
    ['rec_farm_medicine_parasite'] = { label = 'Dewormer', weight = 150, stack = true, close = true, },
    ['rec_farm_medicine_hoof'] = { label = 'Hoof ointment', weight = 150, stack = true, close = true, },

    -- feed
    ['rec_farm_feed_hay'] = { label = 'Hay', weight = 100, stack = true, close = true, },
    ['rec_farm_feed_grain'] = { label = 'Grain feed', weight = 100, stack = true, close = true, },
    ['rec_farm_salt'] = { label = 'Salt', weight = 50, stack = true, close = true, },
}

-- graded products: base item -> label, one entry per star is generated below
local graded = {
    rec_farm_tomato = 'Tomato',
    rec_farm_wheat = 'Wheat',
    rec_farm_corn = 'Corn',
    rec_farm_potato = 'Potato',
    rec_farm_pumpkin = 'Pumpkin',
    rec_farm_milk = 'Milk',
    rec_farm_goat_milk = 'Goat milk',
    rec_farm_egg = 'Egg',
    rec_farm_wool = 'Wool',
    rec_farm_beef = 'Beef',
    rec_farm_pork = 'Pork',
    rec_farm_mutton = 'Mutton',
    rec_farm_goat_meat = 'Goat meat',
    rec_farm_chicken_meat = 'Chicken',
    rec_farm_flour = 'Flour',
    rec_farm_dough = 'Dough',
    rec_farm_milk_pasteurized = 'Pasteurized milk',
    rec_farm_cream = 'Cream',
    rec_farm_butter = 'Butter',
    rec_farm_cheese = 'Cheese',
    rec_farm_beef_smoked = 'Smoked beef',
    rec_farm_sausage = 'Sausage',
}

for base, label in pairs(graded) do
    for stars = 1, 5 do
        items[('%s_%dstar'):format(base, stars)] = {
            label = ('%s %s'):format(label, ('★'):rep(stars)),
            weight = 150,
            stack = true,
            close = true,
        }
    end
end

return items

Copy and paste this on your server.cfg

  ensure REC_Farm

Start the dependencies before this resource.

Done

enjoy it !

Updating an older farm

The current SQL stores farms, members, plots, cells, structures, animals, shipments and players. Some table names are shared with older versions but have different schemas. CREATE TABLE IF NOT EXISTS does not migrate those existing tables. Back up existing data and compare/migrate the schemas before starting the new implementation.

©2026 RE:CORD Development Group. All rights reserved.