/docs

Documentation of the gamesense lua api

Primary LanguageLuaMIT LicenseMIT

gamesense.pub documentation

Loading and using LUA Scripts written by other people: {% page-ref page="overview/using_lua_scripts.md" %}

Writing your own LUA Scripts:# gamesense.pub documentation

Loading and using LUA Scripts written by other people: {% page-ref page="overview/using_lua_scripts.md" %}

Writing your own LUA Scripts: {% page-ref page="development/getting_started.md" %} {% page-ref page="development/getting-started.md" %} {% page-ref page="development/getting_started" %} {% page-ref page="development/getting-started" %}

This website documents the configuration options, usage and LUA API of gamesense.pub.

{% page-ref page="https://github.com/h4xrOx/gamesense_docs/find/4f920eb67e2809c4e68dc64b0726c8ee4f6a625e" %}

site_name: docs

  • Home: {% page-ref page="./docs/docs/index..md" %}

For users:

  • Getting Started: {% page-ref page="./for_users/getting_started.md" %}
  • Features:
  • Legitbot: {% page-ref page="./for_users/features/data/legitbot.md" %}
  • Ragebot: {% page-ref page="./for_users/features/data/ragebot.md" %}
  • Antiaim: {% page-ref page="./for_users/features/data/antiaim.md" %}
  • Visuals: {% page-ref page="./for_users/features/data/visuals.md" %}
  • Misc: {% page-ref page="./for_users/features/data/misc.md" %}
  • Settings: {% page-ref page="./for_users/features/data/settings.md" %}
  • Skinchanger: {% page-ref page="./for_users/features/data/skinchanger.md" %}
  • Playerlist: {% page-ref page="./for_users/features/data/playerlist.md" %}
  • Common issues & Troubleshooting: {% page-ref page="./for_users/common_issues_and_troubleshooting.md" %}

For developers:

  • Getting Started: {% page-ref page="./for_developers/getting_started.md" %}

API:

  • About: {% page-ref page="./for_developers/api/about.md" %} #Some basic info about api
  • List: - _G: {% page-ref page="./for_developers/api/data/_G.md" %}
  • bit: {% page-ref page="./for_developers/api/data/bit.md" %}
  • client: {% page-ref page="./for_developers/api/data/client.md" %}
  • config: {% page-ref page="./for_developers/api/data/config.md" %}
  • cvar{}: {% page-ref page="./for_developers/api/data/cvar{}.md" %}
  • database: {% page-ref page="./for_developers/api/data/database.md" %}
  • entity: {% page-ref page="./for_developers/api/data/entity.md" %}
  • globals: {% page-ref page="./for_developers/api/data/globals.md" %}
  • json: {% page-ref page="./for_developers/api/data/json.md" %}
  • materialsystem: {% page-ref page="./for_developers/api/data/materialsystem.md" %}
  • materialsystem{}: {% page-ref page="./for_developers/api/data/materialsystem{}.md" %}
  • ffi: {% page-ref page="./for_developers/api/data/ffi.md" %}
  • vector{}: {% page-ref page="./for_developers/api/data/vector{}.md" %}
  • panorama: {% page-ref page="./for_developers/api/data/panorama.md" %}
  • plist: {% page-ref page="./for_developers/api/data/plist.md" %}
  • renderer: {% page-ref page="./for_developers/api/data/renderer.md" %}
  • ui: {% page-ref page="./for_developers/api/data/ui.md" %}
  • Events: - About: {% page-ref page="./for_developers/events/about.md" %} #Some basic info about events - List: - Cheat Events: {% page-ref page="./for_developers/events/data/cheat_events.md" %}
  • Source Events: {% page-ref page="./for_developers/events/data/source_events.md" %}
  • "Counter-Strike: Global Offensive Events": {% page-ref page="./for_developers/events/data/csgo_events.md" %}
  • Netprops: - About: {% page-ref page="./for_developers/netprops/about.md" %} - List: - DT_AnimTimeMustBeFirst: {% page-ref page="./for_developers/netprops/data/DT_AnimTimeMustBeFirst.md" %}
  • DT_BaseEntity: {% page-ref page="./for_developers/netprops/data/DT_BaseEntity.md" %}
  • Tips & Tricks: {% page-ref page="./for_developers/tips_and_tricks.md" %}

theme:

  • name: material
  • palette:
  • scheme: gamesense

features:

  • navigation.instant
  • navigation.tabs

extra_css:

  • stylesheets/extra.css

markdown_extensions:

  • admonition
  • pymdownx.snippets
  • pymdownx.highlight
  • pymdownx.superfences
  • pymdownx.tabbed
  • pymdownx.details

Documentation of the gamesense lua api

Table of contents

Using the cheat

Developers

description: List of events that you can listen to using client.set_event_callback

Events

List of events:

paint

Fired every time the game renders a frame while being connected to a server. Can be used to draw to the screen using the renderer.* functions

Examples:

{% code-tabs %} {% code-tabs-item %}

client.set_event_callback("paint", function()
	renderer.text(15, 15, 255, 255, 255, 255, nil, 0, "hello world")
end)

{% endcode-tabs-item %} {% endcode-tabs %}

paint_ui

Fired every time the game renders a frame, even if you're in the menu. Can be used to draw to the screen using the renderer.* functions

run_command

Fired every time the game runs a command (usually 64 times a second, equal to tickrate) while you're alive. This is the best event for processing data that only changes when the game receives an update from the server, like information about other players.

Key Description
chokedcommands Amount of commands that the client has choked
command_number Current command number

setup_command

Fired every time the game prepares a move command that's sent to the server. This is ran before cheat features like antiaim and can be used to modify user input (view angles, pressed keys, movement) how it's seen by the cheat. For example, setting in_use = 1 will disable antiaim the same way pressing use key ingame does. This is the preferred method of setting user input and should be used instead of client.exec whenever possible

Key Description
chokedcommands Amount of commands that the client has choked
command_number Current command number
pitch Pitch view angle
yaw Yaw view angle
forwardmove Forward / backward speed (-450 to 450)
sidemove Left / right speed (-450 to 450)
move_yaw Yaw angle that's used for movement. If not set, view yaw is used
allow_send_packet Set to false to make the cheat choke the current command (when possible)
in_attack IN_ATTACK Button
in_jump IN_JUMP Button
in_duck IN_DUCK Button
in_forward IN_FORWARD Button
in_back IN_BACK Button
in_use IN_USE Button
in_cancel IN_CANCEL Button
in_left IN_LEFT Button
in_right IN_RIGHT Button
in_moveleft IN_MOVELEFT Button
in_moveright IN_MOVERIGHT Button
in_attack2 IN_ATTACK2 Button
in_run IN_RUN Button
in_reload IN_RELOAD Button
in_alt1 IN_ALT1 Button
in_alt2 IN_ALT2 Button
in_score IN_SCORE Button
in_speed IN_SPEED Button
in_walk IN_WALK Button
in_zoom IN_ZOOM Button
in_weapon1 IN_WEAPON1 Button
in_weapon2 IN_WEAPON2 Button
in_bullrush IN_BULLRUSH Button
in_grenade1 IN_GRENADE1 Button
in_grenade2 IN_GRENADE2 Button
in_attack3 IN_ATTACK3 Button
weaponselect
weaponsubtype

override_view

Lets you override the camera position and angles

Key Description
x Camera X position
y Camera Y position
z Camera Z position
pitch Pitch view angle
yaw Yaw view angle
fov Field of view

console_input

Fired every time the user types something in the game console and presses enter. Return true from the event handler to make the game not process the input

Property
1 console input text

Examples:

{% code-tabs %} {% code-tabs-item %}

client.set_event_callback("console_input", function(text)
	client.log("entered: '", text, "'")
end)

{% endcode-tabs-item %} {% endcode-tabs %}

output

This event lets you override the text drawn in the top left. There can only be one callback for this event. This event callback is invoked from print, client.log, client.color_log, "Missed due to spread" message, etc.

Key Description
text Drawn text
r Drawn color: Red 0-255
g Drawn color: Green 0-255
b Drawn color: Blue 0-255
a Alpha 0-255

indicator

This event lets you lets you override how indicators are drawn. There can only be one callback for this event. This event callback is invoked from renderer.indicator and indicators like "DT".

Key Description
text Drawn text
r Drawn color: Red 0-255
g Drawn color: Green 0-255
b Drawn color: Blue 0-255
a Alpha 0-255

player_chat

Fired when a player sends a message to chat

Key Description
teamonly true if the message was sent to team chat
entity Entity index of the player sending the message
name Name of the player sending the message
text Chat message text

string_cmd

Fired before a string command (chat messages, weapon inspecting, buy commands) is sent to the server.

Property
1 string command

net_update_start

Fired before the game processes entity updates from the server. (FrameStageNotify FRAME_NET_UPDATE_START) Be careful when using this event to modify entity data, some things have to be restored manually as not even a full update will update them

net_update_end

Fired after an entity update packet is received from the server. (FrameStageNotify FRAME_NET_UPDATE_END)

predict_command

Fired when the game prediction is ran

Key Description
command_number Command number of the predicted command

pre_render

Fired before a frame is rendered

post_render

Fired after a frame is rendered

aim_fire

Fired when the rage aimbot shoots at a player

Key Description
id Shot ID, this can be used to find the corresponding aim_hit / aim_miss event
target Target player entindex
hit_chance Chance the shot will hit, depends on spread
hitgroup Targeted hit group, this is not the same thing as a hitbox
damage Predicted damage the shot will do
backtrack Amount of ticks the player was backtracked
boosted True if accuracy boost was used to increase the accuracy of the shot
high_priority True if the shot was at a high priority record, like on shot backtrack
interpolated Player was interpolated
extrapolated Player was extrapolated
teleported Target player was teleporting (breaking lag compensation)
tick Tick the shot was fired at. This can be used to draw the hitboxes using client.draw_hitboxes
x X world coordinate of the aim point
y X world coordinate of the aim point
z Z world coordinate of the aim point

Examples:

{% code-tabs %} {% code-tabs-item %}

local function time_to_ticks(t)
	return floor(0.5 + (t / globals.tickinterval()))
end

local hitgroup_names = {'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear'}

local function aim_fire(e)
	local flags = {
		e.teleported and 'T' or '',
		e.interpolated and 'I' or '',
		e.extrapolated and 'E' or '',
		e.boosted and 'B' or '',
		e.high_priority and 'H' or ''
	}
	local group = hitgroup_names[e.hitgroup + 1] or '?'
	print(string.format('Fired at %s (%s) for %d dmg (chance=%d%%, bt=%2d, flags=%s)', entity.get_player_name(e.target), group, e.damage, math.floor(e.hit_chance + 0.5), time_to_ticks(e.backtrack), table.concat(flags)))
end
client.set_event_callback('aim_fire', aim_fire)

{% endcode-tabs-item %} {% endcode-tabs %}

aim_hit

Fired when the rage aimbot hit a shot at a player

Key Description
id Shot ID, the corresponding aim_fire event has the same ID
target Target player entindex
hit_chance Actual hit chance the shot had
hitgroup Hit group that was hit. This is not the same thing as a hitbox
damage Actual damage the shot did

Examples:

{% code-tabs %} {% code-tabs-item %}

local hitgroup_names = {'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear'}

local function aim_hit(e)
	local group = hitgroup_names[e.hitgroup + 1] or '?'
	print(string.format('Hit %s in the %s for %d damage (%d health remaining)', entity.get_player_name(e.target), group, e.damage, entity.get_prop(e.target, 'm_iHealth')))
end
client.set_event_callback('aim_hit', aim_hit)

{% endcode-tabs-item %} {% endcode-tabs %}

aim_miss

Fired when the rage aimbot missed a shot at a player

Key Description
id Shot ID, the corresponding aim_fire event has the same ID
target Target player entindex
hit_chance Actual hit chance the shot had
hitgroup Hit group that was missed. This is not the same thing as a hitbox
reason Reason the shot was missed. This can be 'spread', 'prediction error', 'death' or '?' (unknown / resolver)

Examples:

{% code-tabs %} {% code-tabs-item %}

local hitgroup_names = {'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear'}

local function aim_miss(e)
	local group = hitgroup_names[e.hitgroup + 1] or '?'
	print(string.format('Missed %s (%s) due to %s', entity.get_player_name(e.target), group, e.reason))
end
client.set_event_callback('aim_miss', aim_miss)

{% endcode-tabs-item %} {% endcode-tabs %}

pre_config_load

Fired before a config will be loaded

post_config_load

Fired after a config has been loaded

pre_config_save

Fired before a config will be saved

post_config_save

Fired after a config has been saved

description: List of events that you can listen to using client.set_event_callback

Events

List of events:

paint

Fired every time the game renders a frame while being connected to a server. Can be used to draw to the screen using the renderer.* functions

Examples:

{% code-tabs %} {% code-tabs-item %}

client.set_event_callback("paint", function()
	renderer.text(15, 15, 255, 255, 255, 255, nil, 0, "hello world")
end)

{% endcode-tabs-item %} {% endcode-tabs %}

paint_ui

Fired every time the game renders a frame, even if you're in the menu. Can be used to draw to the screen using the renderer.* functions

run_command

Fired every time the game runs a command (usually 64 times a second, equal to tickrate) while you're alive. This is the best event for processing data that only changes when the game receives an update from the server, like information about other players.

Key Description
chokedcommands Amount of commands that the client has choked
command_number Current command number

setup_command

Fired every time the game prepares a move command that's sent to the server. This is ran before cheat features like antiaim and can be used to modify user input (view angles, pressed keys, movement) how it's seen by the cheat. For example, setting in_use = 1 will disable antiaim the same way pressing use key ingame does. This is the preferred method of setting user input and should be used instead of client.exec whenever possible

Key Description
chokedcommands Amount of commands that the client has choked
command_number Current command number
pitch Pitch view angle
yaw Yaw view angle
forwardmove Forward / backward speed (-450 to 450)
sidemove Left / right speed (-450 to 450)
move_yaw Yaw angle that's used for movement. If not set, view yaw is used
allow_send_packet Set to false to make the cheat choke the current command (when possible)
in_attack IN_ATTACK Button
in_jump IN_JUMP Button
in_duck IN_DUCK Button
in_forward IN_FORWARD Button
in_back IN_BACK Button
in_use IN_USE Button
in_cancel IN_CANCEL Button
in_left IN_LEFT Button
in_right IN_RIGHT Button
in_moveleft IN_MOVELEFT Button
in_moveright IN_MOVERIGHT Button
in_attack2 IN_ATTACK2 Button
in_run IN_RUN Button
in_reload IN_RELOAD Button
in_alt1 IN_ALT1 Button
in_alt2 IN_ALT2 Button
in_score IN_SCORE Button
in_speed IN_SPEED Button
in_walk IN_WALK Button
in_zoom IN_ZOOM Button
in_weapon1 IN_WEAPON1 Button
in_weapon2 IN_WEAPON2 Button
in_bullrush IN_BULLRUSH Button
in_grenade1 IN_GRENADE1 Button
in_grenade2 IN_GRENADE2 Button
in_attack3 IN_ATTACK3 Button
weaponselect
weaponsubtype

override_view

Lets you override the camera position and angles

Key Description
x Camera X position
y Camera Y position
z Camera Z position
pitch Pitch view angle
yaw Yaw view angle
fov Field of view

console_input

Fired every time the user types something in the game console and presses enter. Return true from the event handler to make the game not process the input

Property
1 console input text

Examples:

{% code-tabs %} {% code-tabs-item %}

client.set_event_callback("console_input", function(text)
	client.log("entered: '", text, "'")
end)

{% endcode-tabs-item %} {% endcode-tabs %}

output

This event lets you override the text drawn in the top left. There can only be one callback for this event. This event callback is invoked from print, client.log, client.color_log, "Missed due to spread" message, etc.

Key Description
text Drawn text
r Drawn color: Red 0-255
g Drawn color: Green 0-255
b Drawn color: Blue 0-255
a Alpha 0-255

indicator

This event lets you lets you override how indicators are drawn. There can only be one callback for this event. This event callback is invoked from renderer.indicator and indicators like "DT".

Key Description
text Drawn text
r Drawn color: Red 0-255
g Drawn color: Green 0-255
b Drawn color: Blue 0-255
a Alpha 0-255

player_chat

Fired when a player sends a message to chat

Key Description
teamonly true if the message was sent to team chat
entity Entity index of the player sending the message
name Name of the player sending the message
text Chat message text

string_cmd

Fired before a string command (chat messages, weapon inspecting, buy commands) is sent to the server.

Property
1 string command

net_update_start

Fired before the game processes entity updates from the server. (FrameStageNotify FRAME_NET_UPDATE_START) Be careful when using this event to modify entity data, some things have to be restored manually as not even a full update will update them

net_update_end

Fired after an entity update packet is received from the server. (FrameStageNotify FRAME_NET_UPDATE_END)

predict_command

Fired when the game prediction is ran

Key Description
command_number Command number of the predicted command

pre_render

Fired before a frame is rendered

post_render

Fired after a frame is rendered

aim_fire

Fired when the rage aimbot shoots at a player

Key Description
id Shot ID, this can be used to find the corresponding aim_hit / aim_miss event
target Target player entindex
hit_chance Chance the shot will hit, depends on spread
hitgroup Targeted hit group, this is not the same thing as a hitbox
damage Predicted damage the shot will do
backtrack Amount of ticks the player was backtracked
boosted True if accuracy boost was used to increase the accuracy of the shot
high_priority True if the shot was at a high priority record, like on shot backtrack
interpolated Player was interpolated
extrapolated Player was extrapolated
teleported Target player was teleporting (breaking lag compensation)
tick Tick the shot was fired at. This can be used to draw the hitboxes using client.draw_hitboxes
x X world coordinate of the aim point
y X world coordinate of the aim point
z Z world coordinate of the aim point

Examples:

{% code-tabs %} {% code-tabs-item %}

local function time_to_ticks(t)
	return floor(0.5 + (t / globals.tickinterval()))
end

local hitgroup_names = {'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear'}

local function aim_fire(e)
	local flags = {
		e.teleported and 'T' or '',
		e.interpolated and 'I' or '',
		e.extrapolated and 'E' or '',
		e.boosted and 'B' or '',
		e.high_priority and 'H' or ''
	}
	local group = hitgroup_names[e.hitgroup + 1] or '?'
	print(string.format('Fired at %s (%s) for %d dmg (chance=%d%%, bt=%2d, flags=%s)', entity.get_player_name(e.target), group, e.damage, math.floor(e.hit_chance + 0.5), time_to_ticks(e.backtrack), table.concat(flags)))
end
client.set_event_callback('aim_fire', aim_fire)

{% endcode-tabs-item %} {% endcode-tabs %}

aim_hit

Fired when the rage aimbot hit a shot at a player

Key Description
id Shot ID, the corresponding aim_fire event has the same ID
target Target player entindex
hit_chance Actual hit chance the shot had
hitgroup Hit group that was hit. This is not the same thing as a hitbox
damage Actual damage the shot did

Examples:

{% code-tabs %} {% code-tabs-item %}

local hitgroup_names = {'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear'}

local function aim_hit(e)
	local group = hitgroup_names[e.hitgroup + 1] or '?'
	print(string.format('Hit %s in the %s for %d damage (%d health remaining)', entity.get_player_name(e.target), group, e.damage, entity.get_prop(e.target, 'm_iHealth')))
end
client.set_event_callback('aim_hit', aim_hit)

{% endcode-tabs-item %} {% endcode-tabs %}

aim_miss

Fired when the rage aimbot missed a shot at a player

Key Description
id Shot ID, the corresponding aim_fire event has the same ID
target Target player entindex
hit_chance Actual hit chance the shot had
hitgroup Hit group that was missed. This is not the same thing as a hitbox
reason Reason the shot was missed. This can be 'spread', 'prediction error', 'death' or '?' (unknown / resolver)

Examples:

{% code-tabs %} {% code-tabs-item %}

local hitgroup_names = {'generic', 'head', 'chest', 'stomach', 'left arm', 'right arm', 'left leg', 'right leg', 'neck', '?', 'gear'}

local function aim_miss(e)
	local group = hitgroup_names[e.hitgroup + 1] or '?'
	print(string.format('Missed %s (%s) due to %s', entity.get_player_name(e.target), group, e.reason))
end
client.set_event_callback('aim_miss', aim_miss)

{% endcode-tabs-item %} {% endcode-tabs %}

pre_config_load

Fired before a config will be loaded

post_config_load

Fired after a config has been loaded

pre_config_save

Fired before a config will be saved

post_config_save

Fired after a config has been saved