LUA Coding

Explaining:

  • redEngine uses LUA for things such as: Menus, Triggers, etc

  • Using LUA you can do multiple things: Teleport, spawn objects, make menus...


Basic concepts

ped

  • Refers to a player or NPC character in the game

entity

  • Anything in the map: a player, object, vehicle, or ped

coords

hash

  • A number version of a model or name (like "prop_washer_02" turned into a number)

  • A UI window that lets you pick buttons or settings

function

  • A block of code you can reuse

thread

  • A loop that runs in the background continuously

amount

  • Amount, in number, usually high numbers are detected


Teleporting

SetEntityCoords(entity, x, y, z, ...)

For the explaining, check the basic concepts

Example
local function TeleportToHospital()
    SetEntityCoords(PlayerPedId(), 299.52, -605.91, 43.40, false, false, false, true)
end

Health

For the explaining, check the basic concepts

Example

Spawn an Object

  • modelHash: All hashes here

  • position: Where to spawn it (X,Y,Z coords)

  • networked: If true others can see it.

Example

Ask for Input

  • "What is your name?" --> The question shown to the player

  • "" --> Default text

  • 30 --> Max number of characters allowed


Draw text on screen

Example

Attach Prop to Player

Example

11816

Bone ID (here: pelvis)

0.0, -0.5

Position of object on the body

apa_prop_flag_turkey

The model being attached


Creating Pages on your Menu


There are a lot more things I didn't explain, if you belive something must be added please tag me on the customer discord or/and PM me (1154081527693594634).

Last updated