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 |
|
getEntity |
|
|
getPlayerResource |
|
|
getIndexByUserID |
|
|
getHighestEntityIndex |
nothing |
|
Helpers
Methods
Method |
Arguments |
Return |
---|---|---|
worldToScreen |
|
|
calculateColor |
|
|
calculateColor |
|
|
getWeaponIcon |
|
icon string |
hash |
|
|
notify |
|
display cheats notification |
hudMsg |
|
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 |
|
rect |
|
rectFilled |
|
rectShadow |
|
rectGradient |
|
triangle |
|
triangleFilled |
|
circle |
|
circleFilled |
|
circleShadow |
|
text |
|
blurFullscreen |
|
monochromeFullscreen |
|
chromaticAberrationFullscreen |
|
Gui
Method |
Arguments |
Return |
---|---|---|
beginWindow |
|
|
text |
|
|
textColored |
|
|
button |
|
|
button |
|
|
slider |
|
|
input |
|
|
input |
|
|
sameLine |
||
newLine |
||
indent |
|
|
unindent |
|
|
separator |
||
getRegionAvail |
|
|
checkbox |
|
|
setNextWindowPos |
|
|
setNextWindowSize |
|
|
setNextWindowBgAlpha |
|
|
setWindowFontScale |
|
|
pushID |
|
|
popID |
||
beginFrame |
|
|
endFrame |
||
endWindow |
||
openPopup |
|
|
beginPopup |
|
|
beginPopupModal |
|
|
endPopup |
||
closeCurrentPopup |