Official Sakara lua documentaion

To get started with scripting for Sakara, script files are located in Documents/sakara/scripts

Note

This project is under active development.

Contents

Types

vector2

Basic container of 2 floats

Fields

Name

Type

Description

x

float

pitch

y

float

yaw

vector3

Basic container of 3 floats

Fields

Name

Type

Description

x

float

pitch

y

float

yaw

z

float

roll

length

function -> float

length2D

function -> float

squareLength

function -> float

dotProduct

function -> float

normalize

function

crossProduct

function -> float

toAngle

function

fromAngle

function

vector4

container of 4 floats

Fields

Name

Type

Description

x

float

pitch

y

float

yaw

z

float

roll

w

float

rotation

entity

Method

Description

isDormant

isAlive

isPlayer

isWeapon

isPistol

isSniperRifle

isGrenade

isVisible

isVisibleTo

isFullAuto

isInReload

isBot

isSpotted

isScoped

isDefusing

isPinPulled

isFlashed

hasDefuser

hasHelmet

getEyePosition

getEyeAngles

getAimPunch

getAimPunchAngle

getViewPunchAngle

getBonePosition

getOrigin

getAbsOrigin

getVelocity

getPlayerName

getIndex

getHealth

getArmor

getMoney

getLastPlaceName

getUserId

getSteamId

getActiveWeapon

getWeaponType

getWeaponSubType

getInaccuracy

getSpread

getShotsFired

getDefinitionIndex

playerResource

Method

Description

score

color

competitiveWins

competitiveRanking

musicID

activeCoinRank

hasC4

userCmd

Method

Description

commandNumber

tickCount

viewangles

aimdirection

forwardmove

sidemove

upmove

buttons

impulse

weaponselect

weaponsubtype

randomSeed

mousedx

mousedy

hasbeenpredicted

gameEvent

Method

Description

getName

getInt

getFloat

getString

setInt

setString

viewSetup

Method

Description

fov

origin

angles

farZ

nearViewmodelZ

farViewmodelZ

aspectRatio

Hooks

To hook a function, use hookFunction function, example:

function myFunction(cmd)

end

hookFunction(myFunction,"on_create_move")

Hooks destinations

Function

Arguments

Description

on_create_move

userCmd

runs after ClientModeShared::CreateMove

on_frame_stage_notify

number (stage)

runs after CHLClient::FrameStageNotify

on_fire_game_event

gameEvent

runs inside event listener

on_present

nothing

runs inside directx present hook

on_override_view

viewSetup

runs after ClientModeShared::OverideView

on_script_UI

nothing

called inside lua settings menu

Examples

fovOverride = 0

function scriptSettings()
fovOverride = Gui.slider("fov override", fovOverride, -20,20)
end

function fovChanger(setup)
setup.fov = setup.fov+fovOverride
end

hookFunction(fovChanger,"on_override_view")
hookFunction(scriptSettings,"on_script_UI")

Entities

Methods

Method

Arguments

Return

getLocalPlayer

nothing

entity pointer

getEntity

number (index of entity)

entity pointer

getPlayerResource

number (index of entity)

entity pointer

getIndexByUserID

number (userid)

number (index of entity)

getHighestEntityIndex

nothing

number

Helpers

Methods

Method

Arguments

Return

worldToScreen

vector3 world, vector2 screen

bool

calculateColor

vector4

number

calculateColor

number r, number g, number b, number a

number

getWeaponIcon

number weapon definition index

icon string

hash

string

number (Fowler–Noll–Vo hash)

notify

string

display cheats notification

hudMsg

string

display message on HUD chat

Input

Methods

Method

Return

getMousePos

vector2

isKeyDown

bool

isKeyReleased

bool

isKeyPressed

bool

isMouseClicked

bool

isMouseDown

bool

isMouseReleased

bool

Engine

Methods

Method

Arguments

Return

getScreenSize

nothing

vector2

getViewAngles

nothing

vector3

setViewAngles

vector3

isInGame

nothing

bool

isConnected

nothing

bool

isHLTV

nothing

bool

getLevelName

nothing

string

command

string (runs console command)

getMaxClients

nothing

number

getConvarInt

string (convar name)

number

getConvarFloat

string (convar name)

number

setConvarInt

string , number

setConvarFloat

string , number

Globals

Methods

Method

Return

getRealTime

number

getFrameCount

number

getAbsoluteFrameTime

number

getCurrentTime

number

getMaxClients

number

getTickCount

number

getIntervalPerTick

number

Draw

Methods

Method

Arguments

line

vector2 p1, vector2 p2, number color, number thickness

rect

vector2 p1, vector2 p2, number color, number rounding, number thickness

rectFilled

vector2 p1, vector2 p2, number color, number rounding

rectShadow

vector2 p1, vector2 p2, number color, number rounding, number thickness

rectGradient

vector2 p1, vector2 p2, number color1, number color2, number color3, number color4

triangle

vector2 p1, vector2 p2, vector2 p3, number col, number thickness

triangleFilled

vector2 p1, vector2 p2, vector2 p3, number col

circle

vector2 center, number radius, number col

circleFilled

vector2 center, number radius, number col

circleShadow

vector2 center, number radius, number col, number thickness

text

vector2 pos, number col, string text

blurFullscreen

number alpha

monochromeFullscreen

number amount

chromaticAberrationFullscreen

number amount

Gui

Method

Arguments

Return

beginWindow

string name

text

string text

textColored

string text, vector4 color

button

string label

bool true if clicked

button

string label, vector2 size

bool true if clicked

slider

string label, number value, number min, number max

number new value

input

string label, string value

string new value

input

string label, number value

number new value

sameLine

newLine

indent

number value

unindent

number value

separator

getRegionAvail

vector2

checkbox

string label, bool value

bool new value

setNextWindowPos

vector2 position

setNextWindowSize

vector2 size

setNextWindowBgAlpha

number value

setWindowFontScale

number value

pushID

string id

popID

beginFrame

string id, vector2 size

endFrame

endWindow

openPopup

string id

beginPopup

string id

beginPopupModal

string id

bool true if opened

endPopup

closeCurrentPopup