Skip to main content
This is designed to attempt to fix injection detections and certain native executions, NOT completely bypass native calls like CreateVehicle, etc.
Lean provides two simulation methods for injecting code into a resource context. Both aim to reduce detection risk, but differ in reliability and execution consistency/methodology.

Simulate1 (Safer, but less reliable successful injections)

Execute code within a specific resource context using method 1.
LeanAPI.Simulate1(resourceName, code)

Parameters

  • resourceName (string) – Name of the target resource, or β€œany” to target a random found injectable resource
  • code (string) – Lua code to execute inside the resource context

Returns

Nothing

Example

LeanAPI.Simulate1("lean", [[
    print("wow we injected into " .. GetCurrentResourceName() .. " using method 1")
]])

Execute code within a specific resource context using method 2.
LeanAPI.Simulate2(resourceName, code)

Parameters

  • resourceName (string) – Name of the target resource, or β€œany” to target a random found injectable resource
  • code (string) – Lua code to execute inside the resource context

Returns

Nothing

Example

LeanAPI.Simulate2("lean", [[
    print("hi " .. GetPlayerName(PlayerId()) ..  " we injected into " .. GetCurrentResourceName())
]])

Key Differences

MethodSafety LevelSuccessful Injection Reliability
Simulate1HigherLower
Simulate2HighHigher

Recommendation

  • Use Simulate1 when prioritizing maximum injection detection avoidance and safety when calling certain natives or funcs
  • Use Simulate2 when you need consistent execution and are unlikely to fail, although certain detections can occur due to this being the less safe method.