Skip to content

Commit 2299b7f

Browse files
bakatamegitbook-bot
authored andcommitted
GitBook: [#36] No subject
1 parent 3cb3e64 commit 2299b7f

14 files changed

+300
-232
lines changed

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ For information on how to get started with lua scripting, check out the link bel
3232
* String
3333
* Utf8
3434
* Bit32
35+
* Table
36+
* Package
3537
{% endtab %}
3638
{% endtabs %}
3739

Diff for: SUMMARY.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* [🤷♀ c\_base\_combat\_weapon](documentation/class/c\_base\_combat\_weapon.md)
3030
* [🖥 c\_material](documentation/class/c\_material.md)
3131
* [☺ c\_material\_var](documentation/class/c\_material\_var.md)
32+
* [⏲ c\_lua\_menu\_item](documentation/class/c\_lua\_menu\_item.md)
3233
* [🚑 c\_client\_entity](documentation/class/c\_client\_entity.md)
3334
* [Enumerations](documentation/enumerations/README.md)
3435
* [🤿 manual\_direction](documentation/enumerations/manual\_direction.md)
@@ -42,6 +43,9 @@
4243
* [🎭 trace\_mask](documentation/enumerations/trace\_mask.md)
4344
* [😚 hitbox](documentation/enumerations/hitbox.md)
4445
* [👀 path\_flags](documentation/enumerations/path\_flags.md)
46+
* [🖼 textures](documentation/enumerations/textures.md)
47+
* [✏ fonts](documentation/enumerations/fonts.md)
48+
* [🏁 font\_ranges](documentation/enumerations/font\_ranges.md)
4549
* [📜 font\_flags](documentation/enumerations/font\_flags.md)
4650
* [Variables](documentation/variables/README.md)
4751
* [❄ general](documentation/variables/general.md)

Diff for: documentation/class/c_cs_player.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ local weapon = local_player:get_active_weapon()
1212
| Name | function parameter | Return type | Description |
1313
| ---------------------- | -------------------------------------------------------------- | ------------------------------------------- | ----------- |
1414
| is\_enemy | | bool | |
15+
| is\_alive | | bool | |
1516
| get\_abs\_origin | | [c\_vector3d](c\_vector3d.md) | |
1617
| get\_abs\_angles | | [c\_vector3d](c\_vector3d.md) | |
1718
| get\_active\_weapon | | [c\_client\_entity\*](c\_client\_entity.md) | |

Diff for: documentation/class/c_lua_menu_item.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ⏲ c\_lua\_menu\_item
2+
3+
4+
5+
| | Function Parameter | Return Type | Description |
6+
| --------------------------- | --------------------- | ----------- | ----------- |
7+
| get\_name | | std::string | |
8+
| set\_name | std::string new\_name | void | |
9+
| get\_bool | | bool | |
10+
| set\_bool | bool value | void | |
11+
| get\_float | | float | |
12+
| set\_float | float value | void | |
13+
| set\_slider\_min | float value | void | |
14+
| set\_slider\_max | float value | void | |
15+
| get\_int | | float value | |
16+
| set\_int | int value | void | |
17+
| get\_color | | c\_color | |
18+
| set\_color | float(r, g, b, a) | void | |
19+
| get\_c\_color | c\_color color | void | |
20+
| get\_multiselection\_item | int slot | bool | |
21+
| set\_multiselection\_item | int slot, bool value | void | |
22+
| is\_keybind\_active | | bool | |
23+
| get\_keybind\_button | | int | |
24+
| get\_keybind\_mode | | int | |
25+
| set\_keybind\_button | int button | void | |
26+
| set\_keybind\_mode | int mode | void | |
27+
| is\_flex\_checkbox\_active | | bool | |
28+
| get\_flex\_checkbox\_button | | int | |
29+
| get\_flex\_checkbox\_mode | | int | |
30+
| set\_flex\_checkbox\_button | int button | void | |
31+
| set\_flex\_checkbox\_mode | int mode | void | |
32+
| toggle\_visibility | | void | |
33+
| set\_visible | | void | |
34+
| set\_invisible | | void | |
35+
| trigger\_button\_callback | | void | |

Diff for: documentation/enumerations/font_flags.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# 📜 e\_font\_flags
1+
# 📜 font\_flags
22

33
{% tabs %}
44
{% tab title="Functions:" %}
55
`centered_x`
66

77
`centered_y`
88

9+
`centered`
10+
911
`right_aligned`
1012

1113
`drop_shadow`

Diff for: documentation/enumerations/font_ranges.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 🏁 font\_ranges
2+
3+
{% tabs %}
4+
{% tab title="Functions:" %}
5+
`max`
6+
7+
`default`
8+
9+
`korean`
10+
11+
`chinese_full`
12+
13+
`chinese_sc`
14+
15+
`japanese`
16+
17+
`cyrillic`
18+
19+
`thai`
20+
21+
`vietnamese`
22+
{% endtab %}
23+
{% endtabs %}

Diff for: documentation/enumerations/fonts.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ✏ fonts
2+
3+
{% tabs %}
4+
{% tab title="Functions:" %}
5+
`default`
6+
7+
`tahoma_12_bold`
8+
9+
`tahoma_11_bold`
10+
11+
`profont_12_bold`
12+
13+
`profont_13_bold`
14+
15+
`profont_12`
16+
17+
`profont_13`
18+
19+
`profont_15`
20+
{% endtab %}
21+
{% endtabs %}

Diff for: documentation/enumerations/textures.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 🖼 textures
2+
3+
{% tabs %}
4+
{% tab title="Functions:" %}
5+
`ct_icon_16x16`
6+
7+
`ct_icon_32x32`
8+
9+
`t_icon_16x16`
10+
11+
`t_icon_32x32`
12+
13+
`logo logo200x200`
14+
15+
`scumbucket`
16+
{% endtab %}
17+
{% endtabs %}

Diff for: documentation/events.md

+86-53
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,87 @@
22

33
## Function:
44

5-
### on\_lua\_unload
5+
### add\_callback
66

7-
**`hooks.on_lua_unload(function)`** <mark style="color:purple;">`:Void`</mark>
7+
**`hooks.add_callback(hook_name, protected_function)`** <mark style="color:purple;">`:Void`</mark>
88

9-
| | Type | Description |
10-
| ------------ | -------------- | --------------------------- |
11-
| **function** | **`function`** | Functions to trigger unload |
9+
| | Type | Description |
10+
| ----------------------- | -------------- | --------------------------- |
11+
| **`hook_name`** | **`string`** | event name |
12+
| **`protected`function** | **`function`** | Functions to trigger unload |
1213

13-
<pre class="language-lua"><code class="lang-lua"><strong>//Example #1
14-
</strong><strong>
15-
</strong><strong>function Unload()
16-
</strong><strong> menu_antiaim.set_pitch(0)
17-
</strong><strong>end
18-
</strong><strong>
19-
</strong><strong>hooks.on_lua_unload(Unload)
20-
</strong><strong>
21-
</strong>//Example #2
14+
```lua
15+
-- Source: https://rifk7.com/index.php?threads/events.294/
16+
-- events always get verified before the lua callback runs.
2217

23-
hooks.on_lua_unload(function()
24-
menu_antiaim.set_pitch(0)
25-
end)</code></pre>
18+
//Example #1
19+
function test(event)
20+
print(event:get_name());
21+
end
2622

27-
### add\_hook
23+
hooks.add_callback("on_event", test);
2824

29-
**`hooks.add_hook(event name, function)`** <mark style="color:purple;">`:Void`</mark>
25+
//Example #2
26+
27+
hooks.add_callback("on_event", function()
28+
print(event:get_name());
29+
end);
30+
```
31+
32+
### add\_lua\_unload\_callback
33+
34+
**`hooks.add_lua_unload_callback(function)`** <mark style="color:purple;">`:Void`</mark>
3035

3136
| | Type | Description |
3237
| -------------- | -------------- | --------------------------- |
33-
| **event name** | **`string`** | Name of the trigger event |
34-
| **function** | **`function`** | Functions to trigger events |
38+
| **`function`** | **`function`** | Functions to trigger events |
3539

3640
```lua
3741
//Example #1
3842

3943
function test()
40-
if (engine.is_ingame() and engine.is_connected()) then
41-
renderer.draw_text(renderer.get_center().x, renderer.get_center().y + 15, "choke me daddy", 255, 255, 255, 255, font_flags.centered_x);
42-
end
44+
print("Unload lua")
4345
end
4446

45-
hooks.add_hook("on_draw", test)
47+
hooks.add_lua_unload_callback(test)
4648

4749
//Example #2
4850

49-
hooks.add_hook("on_draw", function()
50-
if (engine.is_ingame() and engine.is_connected()) then
51-
renderer.draw_text(renderer.get_center().x, renderer.get_center().y + 15, "choke me daddy", 255, 255, 255, 255, font_flags.centered_x);
52-
end
51+
hooks.add_lua_unload_callback(function()
52+
print("Unload lua")
53+
end)
54+
```
55+
56+
### add\_menu\_callback
57+
58+
**`hooks.add_menu_callback(menu_item_name, protected_function)`** <mark style="color:purple;">`:Void`</mark>
59+
60+
| | Type | Description |
61+
| ------------------------ | -------------- | --------------------------- |
62+
| **`menu_item_name`** | **`String`** | Menu name |
63+
| **`protected_function`** | **`function`** | Functions to trigger unload |
64+
65+
```lua
66+
local checkbox_item = menu.add_checkbox("Example Checkbox", false);
67+
hooks.add_menu_callback("Example Checkbox", function()
68+
print("test")
69+
end)
70+
```
71+
72+
### add\_delayed\_callback
73+
74+
**`hooks.add_delayed_callback(delay, protected_function)`** <mark style="color:purple;">`:Void`</mark>
75+
76+
| | Type | Description |
77+
| ------------------------ | -------------- | --------------------------- |
78+
| **`delay`** | **`float`** | Delay time |
79+
| **`protected_function`** | **`function`** | Functions to trigger unload |
80+
81+
```lua
82+
local num = 1
83+
hooks.add_delayed_callback(10, function()
84+
print(num)
85+
num = num + 1
5386
end)
5487
```
5588

@@ -59,15 +92,14 @@ end)
5992
Official CS:GO events
6093
{% endembed %}
6194

62-
```lua
63-
function test(event)
64-
if(event ~= nil) then
65-
print(event:get_name());
66-
end
67-
end
68-
69-
hooks.add_hook("on_event", test);
70-
```
95+
<pre class="language-lua"><code class="lang-lua">-- Source: https://rifk7.com/index.php?threads/events.294/
96+
<strong>
97+
</strong><strong>function test(event)
98+
</strong> print(event:get_name());
99+
end
100+
101+
hooks.add_callback("on_event", test);
102+
</code></pre>
71103

72104
## List of events:
73105

@@ -76,15 +108,17 @@ hooks.add_hook("on_event", test);
76108
Fired every frame. Most functions from the renderer namespace can only be used here
77109

78110
```lua
79-
function test()
80-
if (engine.is_ingame() and engine.is_connected()) then
81-
renderer.draw_text(renderer.get_center().x, renderer.get_center().y + 15, "choke me daddy", 255, 255, 255, 255, font_flags.centered_x);
82-
renderer.draw_line_multicolored(renderer.get_center().x, renderer.get_center().y + 35, renderer.get_center().x + 40 * clientstate.get_choked_ticks() / 15.0, renderer.get_center().y + 35, 255, 255, 255, 255, 255, 255, 255, 0);
83-
renderer.draw_line_multicolored(renderer.get_center().x, renderer.get_center().y + 35, renderer.get_center().x - 40 * clientstate.get_choked_ticks() / 15.0, renderer.get_center().y + 35, 255, 255, 255, 255, 255, 255, 255, 0);
84-
end
85-
end
111+
-- Source: https://rifk7.com/index.php?threads/drawing.293/
112+
113+
function test()
114+
if (engine.is_ingame() and engine.is_connected()) then
115+
renderer.draw_text(renderer.get_center().x, renderer.get_center().y + 15, "choke me daddy", renderer.get_font(fonts.default), 255, 255, 255, 255, font_flags.centered_x);
116+
renderer.draw_line_multicolored(renderer.get_center().x, renderer.get_center().y + 35, renderer.get_center().x + 40 * clientstate.get_choked_ticks() / 15.0, renderer.get_center().y + 35, 255, 255, 255, 255, 255, 255, 255, 0);
117+
renderer.draw_line_multicolored(renderer.get_center().x, renderer.get_center().y + 35, renderer.get_center().x - 40 * clientstate.get_choked_ticks() / 15.0, renderer.get_center().y + 35, 255, 255, 255, 255, 255, 255, 255, 0);
118+
end
119+
end
86120

87-
hooks.add_hook("on_draw", test)
121+
hooks.add_callback("on_draw", test)
88122
```
89123

90124
### on\_paint
@@ -99,6 +133,10 @@ Fired every frame.&#x20;
99133

100134
on\_level\_init\_pre\_entity
101135

136+
### on\_delayed\_loop
137+
138+
runs every 500ms
139+
102140
### on\_event
103141

104142
Fired game events
@@ -121,6 +159,8 @@ Fired game events
121159

122160
on drawing model&#x20;
123161

162+
return lua\_dme/original
163+
124164
#### 🔗 struct <mark style="color:blue;">`lua_dme`</mark>
125165

126166
| | Type | Description |
@@ -157,13 +197,6 @@ start of createmove
157197

158198
before antiaim
159199

160-
#### 🔗 struct <mark style="color:blue;">`lua_createmove`</mark>
161-
162-
| | Type | Description |
163-
| ----------------- | --------------------------------------------- | ----------- |
164-
| cmd | [c\_user\_cmd](events.md#struct-c\_user\_cmd) | |
165-
| ragebot\_shooting | bool | |
166-
167200
### on\_override\_view
168201

169202
override view - every frame

0 commit comments

Comments
 (0)