redEngine
  • About redEngine
  • How to run redEngine
  • Feature List
  • AntiCh3at Bans
  • LUA Coding
  • Triggers
  • Error list.
  • Questions
  • Credits
Powered by GitBook
On this page
  • Teleporting
  • Health
  • Spawn an Object
  • Ask for Input
  • Draw text on screen
  • Attach Prop to Player
  • Creating Pages on your Menu

LUA Coding

PreviousAntiCh3at BansNextTriggers

Last updated 5 days ago

Explaining:

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

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

Most servers have decent anticheats, so most of this scripts will probably get you banned. This is only a base.


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

  • X, Y, Z values — positions on the map ()

hash

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

menu

  • 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

SetEntityHealth(ped, amount)

For the explaining, check the basic concepts

Example
local function Die()
    SetEntityHealth(PlayerPedId(), 0)
end

Spawn an Object

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

  • networked: If true others can see it.

Example
local function SpawnWasher()
    local model = GetHashKey("prop_washer_02")
    local pos = GetEntityCoords(PlayerPedId())
    CreateObject(model, pos, true)
end

Ask for Input

local function AskName()
    local input = KeyboardInput("What is your name?", "", 30)
    utils.log("You typed: " .. input)
end
  • "What is your name?" --> The question shown to the player

  • "" --> Default text

  • 30 --> Max number of characters allowed


Draw text on screen

DrawTxt("Your text", y, rgb, color, scale)
Example
local function ShowText()
    DrawTxt("Welcome to redEngine", 0.3, false, {255, 255, 255}, 0.5)
end

Attach Prop to Player

AttachEntityToEntity(object, ped, bone, pos, rot, ...)
Example
local function AttachFlag()
    local ped = PlayerPedId()
    local model = GetHashKey("apa_prop_flag_turkey")
    RequestModel(model)
    while not HasModelLoaded(model) do Wait(0) end
    local obj = CreateObject(model, GetEntityCoords(ped), true)
    AttachEntityToEntity(obj, ped, 11816, 0.0, -0.5, 0.0, 0, 0, 0, false, false, false, false, 2, false)
end

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

local pages = {
    ["Teleport"] = function()
        gui.button("Go to Hospital", TeleportToHospital)
    end,

    ["Trolling"] = function()
        gui.button("Suicide", Die)
        gui.button("Spawn Washer", SpawnWasher)
    end
}

Most servers have decent anticheats, so most of this scripts will probably get you banned. This is only a base.

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).

modelHash: All hashes

here
Map to find cords