πŸ”„Exports

🏠 Farm Ownership

DoesPlayerOwnFarm

Check if a player owns any farm.

Parameters:

  • source (number) - Player server ID

Returns:

  • boolean - True if player owns a farm, false otherwise

Example:

local ownsFarm = exports['m-FarmingSimulator']:DoesPlayerOwnFarm(source)
if ownsFarm then
    print("Player owns a farm!")
end

GetPlayerFarm

Get complete farm data for a player.

Parameters:

  • source (number) - Player server ID

Returns:

  • table|nil - Farm data object or nil if no farm owned

Return Structure:

Example:


GetFarmOwner

Get the owner identifier of a specific farm.

Parameters:

  • farmId (number) - Farm location ID

Returns:

  • string|nil - Owner identifier or nil if farm has no owner

Example:


HasFarmAccess

Check if a player is the owner or co-owner of a specific farm.

Parameters:

  • source (number) - Player server ID

  • farmId (number) - Farm location ID

Returns:

  • boolean - True if player has access (owner or co-owner)

Example:


πŸ“¦ Farm Inventory

GetFarmInventory

Get all items stored in player's farm inventory.

Parameters:

  • source (number) - Player server ID

Returns:

  • table - Table of items {itemName = quantity}

Example:


AddToFarmInventory

Add items to player's farm inventory.

Parameters:

  • source (number) - Player server ID

  • itemName (string) - Item name

  • amount (number) - Quantity to add

Returns:

  • boolean - Success status

Example:


RemoveFromFarmInventory

Remove items from player's farm inventory.

Parameters:

  • source (number) - Player server ID

  • itemName (string) - Item name

  • amount (number) - Quantity to remove

Returns:

  • boolean - Success status (false if insufficient quantity)

Example:


🌱 Plants Management

GetPlayerPlants

Get all plants from player's farm.

Parameters:

  • source (number) - Player server ID

Returns:

  • table - Array of plant data objects

Example:


GetPlayerPlantCount

Get the number of plants on player's farm.

Parameters:

  • source (number) - Player server ID

Returns:

  • number - Number of plants

Example:


πŸ„ Animals Management

GetPlayerAnimals

Get all animals from player's farm.

Parameters:

  • source (number) - Player server ID

Returns:

  • table - Array of animal data objects

Example:


GetPlayerAnimalCount

Get the number of animals on player's farm.

Parameters:

  • source (number) - Player server ID

Returns:

  • number - Number of animals

Example:


πŸ“Š Statistics

GetPlayerStatistics

Get player's farming statistics.

Parameters:

  • source (number) - Player server ID

Returns:

  • table|nil - Statistics object or nil if no farm

Return Structure:

Example:


AddPlayerEarnings

Add earnings to player's statistics (tracking purposes).

Parameters:

  • source (number) - Player server ID

  • amount (number) - Amount earned

Returns:

  • boolean - Success status

Example:


AddPlayerSpending

Add spending to player's statistics (tracking purposes).

Parameters:

  • source (number) - Player server ID

  • amount (number) - Amount spent

Returns:

  • boolean - Success status

Example:


πŸ† Reputation & Contracts

GetPlayerReputation

Get player's farming reputation points.

Parameters:

  • source (number) - Player server ID

Returns:

  • number - Reputation points

Example:


AddPlayerReputation

Add reputation points to player.

Parameters:

  • source (number) - Player server ID

  • amount (number) - Reputation to add (can be negative)

Returns:

  • boolean - Success status

Example:


GetPlayerActiveContracts

Get all active contracts for a player.

Parameters:

  • source (number) - Player server ID

Returns:

  • table - Array of active contract objects

Example:


πŸ› οΈ Admin Utilities

GiveFarmToPlayer

Give a farm to a player (admin function).

Parameters:

  • source (number) - Player server ID

  • farmId (number) - Farm location ID

Returns:

  • boolean - Success status

Conditions:

  • Farm must exist in Config.FarmLocations

  • Farm must not already have an owner

  • Player must not already own a farm

Example:


RemoveFarmFromPlayer

Remove farm and all related data from player (admin function).

Parameters:

  • source (number) - Player server ID

Returns:

  • boolean - Success status

Warning: This action is irreversible and removes:

  • Farm ownership

  • All plants

  • All animals

  • Farm inventory

  • All contracts

  • Decorations

Example:


πŸ’‘ Integration Examples

Custom Shop Integration

Custom Reward System

Leaderboard System


Last updated