Table of Contents

Class ConsoleHelper

Namespace
S1API.Console
Assembly
S1API.dll

Provides a stable, modder-friendly abstraction over the in-game console system. Use these helpers from mods instead of referencing the game's console types directly.

public static class ConsoleHelper
Inheritance
ConsoleHelper
Inherited Members

Methods

AddItemToInventory(string, int?)

Gives the player an item by code. Optionally specify a quantity.

public static void AddItemToInventory(string itemCode, int? quantity = null)

Parameters

itemCode string
quantity int?

ClearInventory()

Clears the player's inventory.

public static void ClearInventory()

ClearTrash()

Instantly removes all trash from the world.

public static void ClearTrash()

ClearWanted()

Clears the player's wanted level and crimes.

public static void ClearWanted()

DiscoverProduct(string)

Marks a product as discovered by its item code.

public static void DiscoverProduct(string productCode)

Parameters

productCode string

GiveXp(int)

Gives the player experience points.

public static void GiveXp(int amount)

Parameters

amount int

GrowPlants()

Instantly sets all plants in the world to fully grown.

public static void GrowPlants()

LowerWanted()

Lowers the player's wanted level.

public static void LowerWanted()

RaiseWanted()

Raises the player's wanted level.

public static void RaiseWanted()

RunCashCommand(int)

Executes the ChangeCash command with the given amount. Positive values add cash; negative values remove cash.

public static void RunCashCommand(int amount)

Parameters

amount int

RunOnlineBalanceCommand(int)

Changes the player's online bank balance by the specified amount.

public static void RunOnlineBalanceCommand(int amount)

Parameters

amount int

SaveGame()

Forces a save of the current game state.

public static void SaveGame()

SetLawIntensity(float)

Sets the intensity of law enforcement activity (0-10).

public static void SetLawIntensity(float intensity)

Parameters

intensity float

SetNpcRelationship(NPC, float)

Sets the relationship scalar for an NPC (0-5).

public static void SetNpcRelationship(NPC npc, float level)

Parameters

npc NPC
level float

SetNpcRelationship(string, float)

Sets the relationship scalar for an NPC by id (0-5).

public static void SetNpcRelationship(string npcId, float level)

Parameters

npcId string
level float

SetPlayerEnergyLevel(float)

Sets the player's energy to a value between 0 and 100.

public static void SetPlayerEnergyLevel(float amount)

Parameters

amount float

SetPlayerHealth(float)

Sets the player's health to the specified value.

public static void SetPlayerHealth(float amount)

Parameters

amount float

SetPlayerJumpMultiplier(float)

Sets the player's jump force multiplier. Must be non-negative.

public static void SetPlayerJumpMultiplier(float multiplier)

Parameters

multiplier float

SetPlayerMoveSpeedMultiplier(float)

Sets the player's movement speed multiplier. Must be non-negative.

public static void SetPlayerMoveSpeedMultiplier(float multiplier)

Parameters

multiplier float

SetQuality(Quality)

Sets the equipped item's quality.

public static void SetQuality(Quality quality)

Parameters

quality Quality

API quality value to set.

SetQuestState(string, QuestState)

Sets the state of a quest by name.

public static void SetQuestState(string questName, QuestState state)

Parameters

questName string
state QuestState

SetTime(string)

Sets the time of day using a 24h HHmm string (e.g., "1530").

public static void SetTime(string hhmm)

Parameters

hhmm string

SpawnVehicle(string)

Spawns a vehicle by code at the player's location.

public static void SpawnVehicle(string vehicleCode)

Parameters

vehicleCode string

Submit(IEnumerable<string>)

Submits a console command and arguments (e.g. Submit(["settime","1530"]). Works across both IL2CPP and Mono builds.

public static void Submit(IEnumerable<string> arguments)

Parameters

arguments IEnumerable<string>

Command word followed by its arguments.

Submit(string)

Submits a raw console command string (e.g. "settime 1530"). Works across both IL2CPP and Mono builds.

public static void Submit(string command)

Parameters

command string

The full command line to execute.

UnlockNpc(NPC)

Unlocks the given NPC's connection.

public static void UnlockNpc(NPC npc)

Parameters

npc NPC