Skip to content

Commit 9b60cf9

Browse files
authored
Merge pull request YimMenu-Lua#67 from acidlabsgg/main
### 🔧 Fixes: - Features/PlayerVehicle - Refactored `Launch Control`: The feature now has two modes (realistic / ridiculous) and performs a lot better than before. - Refactored `Fast Jets`: No more air drag loss when speed is increased. Jets now handle the same as default, only faster. - Fixed `Brake Force Display` toggling ABS when the vehicle is moving in reverse. - Fixed optional tyre smoke color in the `Drift Mode` feature always set to black. - Script Globals/Locals: - Fixed some locals that were swapped with their offsets due to bad regex patterns. - Added Enhanced globals and locals. - Pointers: - Added Enhanced patterns. - Scripts/CI: - Fixed offset updater and refactored it to update both legacy and enhanced. ### 🧩Features - Added a stancer to the vehicle tab. It is nothing like VStancer but it gets the job done.
2 parents fe9d933 + 85742c9 commit 9b60cf9

70 files changed

Lines changed: 2102 additions & 578 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
root = true
22

3-
[*]
3+
[*.{lua,py}]
44
indent_style = tab
55
indent_size = 4
66
end_of_line = crlf
77
insert_final_newline = true
8-
9-
[*.{lua,py}]
108
charset = utf-8

.github/workflows/offsets.yml

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88

99
concurrency:
10-
group: offsets-${{ github.ref }}
10+
group: ss_offsets-${{ github.ref }}
1111
cancel-in-progress: true
1212

1313

@@ -21,54 +21,67 @@ jobs:
2121

2222
- name: Fetch Upstream
2323
run: |
24-
git ls-remote https://github.com/calamity-inc/GTA-V-Decompiled-Scripts HEAD | cut -f1 > upstream_commit.txt
24+
git ls-remote https://github.com/acidlabsgg/gtav-legacy-scripts HEAD | cut -f1 > legacy_upstream.txt
25+
git ls-remote https://github.com/acidlabsgg/gtav-enhanced-scripts HEAD | cut -f1 > enhanced_upstream.txt
2526
26-
- name: Read Last Commit Hash
27-
id: last
27+
- name: Read Saved Commit Hashes
28+
id: saved_commits
2829
run: |
29-
if [ -f scripts/offsets/.last_commit_hash ]; then
30-
cat scripts/offsets/.last_commit_hash > last_commit.txt
30+
if [ -f scripts/offsets/legacy.last_commit_hash ]; then
31+
cat scripts/offsets/legacy.last_commit_hash > last_commit_legacy
3132
else
32-
echo "none" > last_commit.txt
33+
echo "none" > last_commit_legacy
3334
fi
3435
35-
- name: Compare Commit
36-
id: compare_commit
36+
if [ -f scripts/offsets/enhanced.last_commit_hash ]; then
37+
cat scripts/offsets/enhanced.last_commit_hash > last_commit_enhanced
38+
else
39+
echo "none" > last_commit_enhanced
40+
fi
41+
42+
- name: Compare Commits
43+
id: compare_commits
3744
run: |
38-
UPSTREAM=$(cat upstream_commit.txt)
39-
LAST=$(cat last_commit.txt)
45+
LEGACY_UPSTREAM=$(cat legacy_upstream.txt)
46+
ENHANCED_UPSTREAM=$(cat enhanced_upstream.txt)
47+
LEGACY_LAST=$(cat last_commit_legacy)
48+
ENHANCED_LAST=$(cat last_commit_enhanced)
4049
41-
echo "Upstream: $UPSTREAM"
42-
echo "Last run: $LAST"
50+
echo "Legacy Upstream: $LEGACY_UPSTREAM"
51+
echo "Legacy Last Run: $LEGACY_LAST"
52+
echo "Enhanced Upstream: $ENHANCED_UPSTREAM"
53+
echo "Enhanced Last Run: $ENHANCED_LAST"
4354
44-
if [ "$UPSTREAM" = "$LAST" ] && [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
55+
if [ "$LEGACY_UPSTREAM" = "$LEGACY_LAST" ] && [ "$ENHANCED_UPSTREAM" = "$ENHANCED_LAST" ] && [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
4556
echo "run=false" >> $GITHUB_OUTPUT
4657
else
4758
echo "run=true" >> $GITHUB_OUTPUT
4859
fi
4960
5061
- name: Setup Python
51-
if: steps.compare_commit.outputs.run == 'true'
62+
if: steps.compare_commits.outputs.run == 'true'
5263
uses: actions/setup-python@v5
5364
with:
5465
python-version: "3.12.x"
5566

5667
- name: Run Offset Updater
57-
if: steps.compare_commit.outputs.run == 'true'
68+
if: steps.compare_commits.outputs.run == 'true'
5869
run: |
5970
python ./scripts/offsets/update_offsets.py
6071
61-
- name: Save New Commit Hash
62-
if: steps.compare_commit.outputs.run == 'true'
72+
- name: Save New Commit Hashes
73+
if: steps.compare_commits.outputs.run == 'true'
6374
run: |
64-
cp upstream_commit.txt ./scripts/offsets/.last_commit_hash
75+
cp legacy_upstream.txt ./scripts/offsets/legacy.last_commit_hash
76+
cp enhanced_upstream.txt ./scripts/offsets/enhanced.last_commit_hash
6577
6678
- name: Commit Changes
67-
if: steps.compare_commit.outputs.run == 'true'
79+
if: steps.compare_commits.outputs.run == 'true'
6880
run: |
6981
git config user.name "github-actions[bot]"
7082
git config user.email "github-actions[bot]@users.noreply.github.com"
71-
git add scripts/offsets/.last_commit_hash
83+
git add scripts/offsets/legacy.last_commit_hash
84+
git add scripts/offsets/enhanced.last_commit_hash
7285
git add includes/data/globals_locals.lua
73-
git diff --cached --quiet || git commit -m "chore(offsets): update script globals & locals from upstream"
86+
git diff --cached --quiet || git commit -m "chore(offsets): update script globals & locals"
7487
git push

.github/workflows/zip-release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Check Changes
6161
id: check_changes
6262
run: |
63-
if git diff --name-only HEAD^ HEAD | grep '\.lua$' > /dev/null; then
63+
if git diff --name-only origin/main | grep '\.lua$' > /dev/null; then
6464
echo "should_release=true" >> $GITHUB_OUTPUT
6565
else
6666
echo "should_release=false" >> $GITHUB_OUTPUT
@@ -74,6 +74,7 @@ jobs:
7474
7575
- name: Increment Tag
7676
id: increment_tag
77+
if: steps.check_changes.outputs.should_release == 'true'
7778
uses: actions/github-script@v7
7879
with:
7980
script: |
@@ -107,6 +108,7 @@ jobs:
107108
core.setOutput("old_tag", old_tag);
108109
109110
- name: Bump Version
111+
if: steps.check_changes.outputs.should_release == 'true'
110112
run: |
111113
sed -i "s|return \".*\"|return \"${{steps.increment_tag.outputs.no_prefix}}\"|" includes/version.lua
112114
sed -i "s|https://img.shields.io/badge/Script%20Version-v[0-9]\+\.[0-9]\+\.[0-9]\+-blue|https://img.shields.io/badge/Script%20Version-${{steps.increment_tag.outputs.version_number}}-blue|g" README.md
@@ -117,13 +119,15 @@ jobs:
117119
git push
118120
119121
- name: Create Archive
122+
if: steps.check_changes.outputs.should_release == 'true'
120123
uses: thedoctor0/zip-release@0.7.6
121124
with:
122125
type: 'zip'
123126
filename: "Samurais_Scripts_${{steps.increment_tag.outputs.version_number}}.zip"
124127
exclusions: /.git* /scripts* /docs* *.json *.md *.editorconfig *.py
125128

126129
- name: Upload Release
130+
if: steps.check_changes.outputs.should_release == 'true'
127131
uses: softprops/action-gh-release@v2
128132
with:
129133
name: Samurai's Scripts ${{steps.increment_tag.outputs.version_number}}

README.md

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,87 @@
1-
<h1 align="center">
2-
Samurai's-Scripts
3-
</h1>
1+
<div align="center">
2+
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts/releases/latest">
3+
<img alt="Script Version" src="https://img.shields.io/badge/Script%20Version-v1.7.5-blue?style=for-the-badge">
4+
</a>
5+
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts/blob/main/LICENSE">
6+
<img alt="License" src="https://img.shields.io/badge/Licence-GPL--3.0-white?style=for-the-badge">
7+
</a>
8+
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts">
9+
<img alt="Game Version" src="https://img.shields.io/badge/Game%20Build-latest-green?style=for-the-badge">
10+
</a>
11+
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts">
12+
<img alt="Online Version" src="https://img.shields.io/badge/Online%20Version-latest-green?style=for-the-badge">
13+
</a>
14+
<br/>
15+
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts/issues">
16+
<img alt="Issues" src="https://img.shields.io/github/issues/YimMenu-Lua/Samurais-Scripts?style=plastic">
17+
</a>
18+
<a href="https://github.com/YimMenu-Lua/Samurais-Scripts/pulls">
19+
<img alt="PRs" src="https://img.shields.io/github/issues-pr/YimMenu-Lua/Samurais-Scripts?style=plastic">
20+
</a>
21+
</div>
422

5-
#### A Lua script written for [YimMenu](https://github.com/YimMenu/YimMenu) and [Tupoye-Menu](https://github.com/TupoyeMenu/TupoyeMenu), centered around roleplaying and having fun in a game full of ad bots and toxic cheaters
23+
# About
624

7-
[![sv](https://img.shields.io/badge/Script%20Version-v1.7.5-blue)](https://github.com/YimMenu-Lua/Samurais-Scripts/releases/latest)
8-
[![gv](https://img.shields.io/badge/Game%20Build-latest-green)](https://github.com/YimMenu-Lua/Samurais-Scripts)
9-
[![gv](https://img.shields.io/badge/Online%20Version-latest-green)](https://github.com/YimMenu-Lua/Samurais-Scripts)
25+
![ss](./docs/ss.png)
1026

11-
###  
27+
A modular GTA V Lua framework focused on enhancing the player's experience through fun features, online business options, and unpopular opinions.
1228

13-
> [!Note]
14-
> **Legacy Only.**
29+
## Getting Started
1530

16-
___
31+
### Setup
1732

18-
## Setup
19-
20-
1. Download the latest zip archive from the [releases section](https://github.com/YimMenu-Lua/Samurais-Scripts/releases).
21-
2. Extract the archive to YimMenu's `scripts` folder:
33+
- Download the latest zip archive from the [releases section](https://github.com/YimMenu-Lua/Samurais-Scripts/releases/latest).
34+
- Extract the archive to YimMenu's `scripts` folder:
2235

2336
%AppData%\YimMenu\scripts
2437

25-
3. Once in-game, press **[F5]** to toggle the script's UI.
38+
- Once in-game, press **[F5]** to toggle the script's UI.
2639

27-
## Commands
40+
### Commands Console
2841

29-
- Use **[F4]** to toggle the command executor window.
42+
- Use **[F4]** to toggle the console window.
3043
- Type `!ls` or `!dump` to dump all available commands.
31-
- Default commands are prefixed with an exclamation mark.
44+
- All default commands are prefixed with an exclamation mark `<!>`.
45+
46+
## Contributing
47+
48+
Contributions are what make the open source community a great place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
49+
50+
If you have a suggestion that would make this project better, please fork the repo and create a pull request. You can also simply open a [feature request](https://github.com/YimMenu-Lua/Samurais-Scripts/issues/new?template=request.yml).
51+
52+
Don't forget to give the project a star!
53+
54+
1. Fork the repo
55+
2. Create your feature branch.
56+
3. Commit your changes.
57+
4. Open a Pull Request.
58+
59+
Refer to the [Contribution Guidelines](./CONTRIBUTING.md) for more details on the project's structure and conventions.
60+
61+
## Documentation
62+
63+
This project was rewritten from scratch using [SmallBase](https://github.com/xesdoog/SmallBase). For API documentation, please refer to the [docs](https://github.com/xesdoog/SmallBase/tree/main/docs).
64+
65+
>[!Note]
66+
> Some parts of the API were refactored or extended but nothing has drastically changed.
67+
> All changes introduced in this project are documented in the source.
68+
69+
## Contact
70+
71+
<div>
72+
<a href="https://discord.gg/RHBUxJ5Qhp">
73+
<img height="96" width="192" src="https://substackcdn.com/image/fetch/$s_!nfCP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a41e45e-aac9-44e5-8b69-55a81058ecbf_875x280.png">
74+
</a>
75+
</div>
3276

33-
## Credits
77+
## Acknowledgments
3478

35-
| Awesome Person | Contribution |
36-
| :---: | :---: |
79+
| | |
80+
| :---: | :---: |
3781
| [Harmless](https://github.com/harmless05) | Shift-Drift |
3882
| [NiiV3AU](https://github.com/NiiV3AU) | German translations |
3983
| [gir489returns](https://github.com/gir489returns) | [Casino Pacino](https://github.com/YimMenu-Lua/Casino-Pacino) |
4084
| [tupoy-ya](https://github.com/tupoy-ya) | Several contributions and shared knowledge |
41-
| [szalikdev](https://github.com/szalikdev) | Revived the project |
85+
| [szalikdev](https://github.com/szalikdev) | Revived the project and joined the cause |
86+
| [ShinyWasabi](https://github.com/shinywasabi) | Foundational community tooling frequently used as reference |
87+
| [UnknownCheats.me](https://unknowncheats.me) | A treasure trove of information |

docs/ss.png

474 KB
Loading

includes/backend.lua

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,34 @@ end
8888

8989
---@return eAPIVersion
9090
function Backend:GetAPIVersion()
91-
if self.api_version then
92-
return self.api_version
93-
end
91+
if (not self.api_version) then
92+
if (script and (type(script) == "table")) then
93+
if (menu_event and menu_event.Wndproc) then
94+
if (type(_G["get_game_branch"]) == "function") then
95+
local branch = _G["get_game_branch"]()
96+
if (type(branch) ~= "number" or branch > 1) then
97+
error("Unknown or unsupported game branch.")
98+
end
9499

95-
if (script and (type(script) == "table")) then
96-
if (menu_event and menu_event.Wndproc) then
97-
return Enums.eAPIVersion.V1
98-
end
100+
self.api_version = _G["get_game_branch"]() + 1
101+
else
102+
self.api_version = Enums.eAPIVersion.V1
103+
end
104+
end
99105

100-
if (type(script["run_in_callback"]) == "function") then
101-
return Enums.eAPIVersion.V2
106+
if (type(script["run_in_callback"]) == "function") then
107+
error(
108+
"YmMenu V2 is not supported. If you want to run this script in GTA V Enhanced, download YimLuaAPI.") -- test error; add Github link later
109+
end
110+
---@diagnostic disable-next-line: undefined-global
111+
elseif (util or (menu and menu.root) or SCRIPT_SILENT_START or (_VERSION ~= "Lua 5.4")) then -- should probably place these in a lookup table
112+
error("Failed to load: Unknown or unsupported Lua environment.")
113+
else
114+
self.api_version = Enums.eAPIVersion.L54
102115
end
103-
---@diagnostic disable-next-line: undefined-global
104-
elseif (util or (menu and menu.root) or SCRIPT_SILENT_START or (_VERSION ~= "Lua 5.4")) then -- should probably place these in a lookup table
105-
error("Failed to load: Unknown or unsupported environment.")
106116
end
107117

108-
return Enums.eAPIVersion.L54
118+
return self.api_version
109119
end
110120

111121
---@return boolean
@@ -248,15 +258,15 @@ end
248258

249259
---@param handle integer
250260
function Backend:CheckFeatureEntities(handle)
251-
if Decorator:IsEntityRegistered(handle, "EntityForge") then
261+
if Decorator:ExistsOn(handle, "EntityForge") then
252262
EntityForge:RemoveEntityByHandle(handle)
253263
end
254264

255-
if Decorator:IsEntityRegistered(handle, "BillionaireServices") then
265+
if Decorator:ExistsOn(handle, "BillionaireServices") then
256266
BillionaireServices:RemoveEntityByHandle(handle)
257267
end
258268

259-
if Decorator:IsEntityRegistered(handle, "YimActions") then
269+
if Decorator:ExistsOn(handle, "YimActions") then
260270
YimActions.CompanionManager:RemoveCompanionByHandle(handle)
261271
end
262272
end
@@ -287,7 +297,7 @@ function Backend:EntitySweep()
287297
end
288298

289299
function Backend:PoolMgr()
290-
local timeout = self.debug_mode and 500 or 5e3
300+
local timeout = self.debug_mode and 500 or 2e3
291301

292302
for index, category in ipairs({ self.SpawnedEntities[Enums.eEntityType.Object], self.SpawnedEntities[Enums.eEntityType.Ped], self.SpawnedEntities[Enums.eEntityType.Vehicle] }) do
293303
if (next(category) == nil) then
@@ -442,7 +452,7 @@ function Backend:RegisterHandlers()
442452
self:OnPlayerSwitch()
443453
self:OnSessionSwitch()
444454
PreviewService:Update()
445-
455+
Decorator:CollectGarbage()
446456
yield()
447457
end)
448458

0 commit comments

Comments
 (0)