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
Example
LeanAPI.Simulate1("lean", [[
print("wow we injected into " .. GetCurrentResourceName() .. " using method 1")
]])
Simulate2 (More reliable, recommended for stability)
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
Example
LeanAPI.Simulate2("lean", [[
print("hi " .. GetPlayerName(PlayerId()) .. " we injected into " .. GetCurrentResourceName())
]])
Key Differences
| Method | Safety Level | Successful Injection Reliability |
|---|
| Simulate1 | Higher | Lower |
| Simulate2 | High | Higher |
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.