xhookLua
Game

Common knowledge

Things every script runs into.

Folders

  • scripts\: one script per .lua file.
  • scripts\lib\: modules for require("name").
  • scripts\config\<name>.cfg: saved menu values.
  • scripts\data\<name>\: storage for files.* and db.*.

Sandbox

Lua 5.4 with the base functions, string, table, math, coroutine, utf8, time and date from os, and every xhook namespace. No io, package or debug; load runs text only.

_G is shared by every script. Keep your state in locals.

Colours

draw.* takes packed integers from draw.color(r, g, b, a), channels 0 to 255. Menu colour controls and chams.set use tables like { 255, 80, 80, 255 }.

Units

Screen positions are pixels from the top left. World positions are Vectors in game units. Angles are degrees.

Timing

on_paint runs every frame. on_create_move runs once per movement command. Only draw inside on_paint.

Each handler gets 50 ms. Split long work across frames with task.spawn and task.wait.

Reloading

Saving a file reloads that script. Undo anything you changed in on_script_unload. db.* and files.* survive game restarts.

Native tier

memory, ffi and hook exist only while Raw memory access is on in the Scripting tab. Test with if memory then ... end.

Common knowledge ยท Lua API ยท xhook