Skip to content

Commit 3ca56f2

Browse files
committed
fix: miscellaneous fixes
1 parent 7d7bae4 commit 3ca56f2

35 files changed

Lines changed: 312 additions & 183 deletions

SSV2/includes/classes/gta/CPed.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ local CPlayerInfo = require("includes.classes.gta.CPlayerInfo")
2727
---@field m_ped_weapon_mgr pointer_ref<CPedWeaponManager>
2828
---@field m_player_info CPlayerInfo
2929
---@field m_velocity pointer<vec3>
30-
---@field m_ped_type pointer<uint8_t>
30+
---@field m_ped_type pointer<uint32_t>
3131
---@field m_ped_task_flag pointer<uint8_t>
3232
---@field m_seatbelt pointer<uint8_t>
3333
---@field m_armor pointer<float>
@@ -64,14 +64,14 @@ end
6464
---@return boolean
6565
function CPed:CanRagdoll()
6666
return self:__safecall(false, function()
67-
return (self.m_ped_type & 0x20) ~= 0
67+
return (self.m_ped_type:get_dword() & 0x20) ~= 0
6868
end)
6969
end
7070

7171
---@return boolean
7272
function CPed:HasSeatbelt()
7373
return self:__safecall(false, function()
74-
return (self.m_seatbelt & 0x3) ~= 0
74+
return (self.m_seatbelt:get_byte() & 0x3) ~= 0
7575
end)
7676
end
7777

@@ -85,7 +85,7 @@ end
8585
---@return ePedType
8686
function CPed:GetPedType()
8787
return self:__safecall(-1, function()
88-
return (self.m_ped_type:get_word() << 11 >> 25)
88+
return (self.m_ped_type:get_dword() << 11 >> 25)
8989
end)
9090
end
9191

SSV2/includes/data/config.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ local Config <const> = {
1414
auto_cleanup_entities = false,
1515
language_index = 1,
1616
language_code = "en-US",
17-
language_name = "English"
17+
language_name = "English",
18+
use_game_language = false
1819
},
1920
ui = {
2021
disable_tooltips = false,

SSV2/includes/data/enums/__init__.lua

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@
88

99

1010
local Enums <const> = {
11+
eActionType = require("includes.data.enums.action_type"),
12+
eAnimFlags = require("includes.data.enums.anim_flags"),
13+
eDrivingFlags = require("includes.data.enums.driving_flags"),
1114
eGameState = require("includes.data.enums.game_state"),
12-
eModelType = require("includes.data.enums.model_type"),
13-
eRagdollBlockingFlags = require("includes.data.enums.ragdoll_blocking_flags"),
14-
eVehicleClasses = require("includes.data.enums.vehicle_classes"),
15+
eGameLanguage = require("includes.data.enums.game_language"),
1516
eHandlingType = require("includes.data.enums.handling_type"),
16-
eDrivingFlags = require("includes.data.enums.driving_flags"),
17-
eVehicleHandlingFlags = require("includes.data.enums.handling_flags"),
18-
eVehicleModelFlags = require("includes.data.enums.vehicle_model_flags"),
19-
eVehicleModelInfoFlags = require("includes.data.enums.vehicle_model_info_flags"),
20-
eVehicleAdvancedFlags = require("includes.data.enums.vehicle_advanced_flags"),
21-
ePedType = require("includes.data.enums.ped_type"),
22-
ePedGender = require("includes.data.enums.ped_gender"),
17+
eLandingGearState = require("includes.data.enums.landing_gear_state"),
18+
eModelType = require("includes.data.enums.model_type"),
19+
ePedCombatAttributes = require("includes.data.enums.ped_combat_attributes"),
2320
ePedComponents = require("includes.data.enums.ped_components"),
2421
ePedConfigFlags = require("includes.data.enums.ped_config_flags"),
22+
ePedGender = require("includes.data.enums.ped_gender"),
2523
ePedResetFlags = require("includes.data.enums.ped_reset_flags"),
26-
ePedCombatAttributes = require("includes.data.enums.ped_combat_attributes"),
2724
ePedTaskIndex = require("includes.data.enums.ped_task_index"),
28-
eAnimFlags = require("includes.data.enums.anim_flags"),
29-
eActionType = require("includes.data.enums.action_type"),
25+
ePedType = require("includes.data.enums.ped_type"),
26+
eRagdollBlockingFlags = require("includes.data.enums.ragdoll_blocking_flags"),
27+
eVehicleAdvancedFlags = require("includes.data.enums.vehicle_advanced_flags"),
28+
eVehicleClasses = require("includes.data.enums.vehicle_classes"),
29+
eVehicleHandlingFlags = require("includes.data.enums.vehicle_handling_flags"),
30+
eVehicleModelFlags = require("includes.data.enums.vehicle_model_flags"),
31+
eVehicleModelInfoFlags = require("includes.data.enums.vehicle_model_info_flags"),
3032
eVehicleTask = require("includes.data.enums.vehicle_task"),
31-
eLandingGearState = require("includes.data.enums.landing_gear_state"),
3233
}
3334

3435
return Enums
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- Copyright (C) 2026 SAMURAI (xesdoog) & Contributors.
2+
-- This file is part of Samurai's Scripts.
3+
--
4+
-- Permission is hereby granted to copy, modify, and redistribute
5+
-- this code as long as you respect these conditions:
6+
-- * Credit the owner and contributors.
7+
-- * Provide a copy of or a link to the original license (GPL-3.0 or later); see LICENSE.md or <https://www.gnu.org/licenses/>.
8+
9+
10+
---@enum eGameLanguage
11+
local eGameLanguage <const> = {
12+
ENGLISH = 0,
13+
FRENCH = 1,
14+
GERMAN = 2,
15+
ITALIAN = 3,
16+
SPANISH = 4,
17+
PORTUGUESE_BRASIL = 5,
18+
POLISH = 6,
19+
RUSSIAN = 7,
20+
KOREAN = 8,
21+
CHINESE_TRADITIONAL = 9,
22+
JAPANESE = 10,
23+
SPANISH_MEXICAN = 11,
24+
CHINESE_SIMPLIFIED = 12,
25+
}
26+
27+
return eGameLanguage
File renamed without changes.

SSV2/includes/features/vehicle/misc_vehicle.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function MiscVehicle:UpdateMachineGuns()
132132
return
133133
end
134134

135-
if (not LocalPlayer:IsUsingAirctaftMG()) then
135+
if (not LocalPlayer:IsUsingAircraftMG()) then
136136
return
137137
end
138138

SSV2/includes/frontend/self/self_ui.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ local playerAbilitiesWindow = {
3030

3131
local function CheckIfRagdollBlocked()
3232
ThreadManager:Run(function()
33-
if (LocalPlayer:IsOnFoot() and not PED.CAN_PED_RAGDOLL(LocalPlayer:GetHandle())) then
34-
Notifier:ShowWarning(
35-
"Samurais Scripts",
36-
_T("SELF_RAGDOLL_BLOCK_INFO")
37-
)
33+
if (LocalPlayer:IsOnFoot() and not LocalPlayer:IsRagdoll() and not LocalPlayer:CanRagdoll()) then
34+
Notifier:ShowWarning("Samurais Scripts", _T("SELF_RAGDOLL_BLOCK_INFO"))
3835
end
3936
end)
4037
end

SSV2/includes/frontend/settings/debug_ui.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ local function DrawMiscTests()
547547
return
548548
end
549549

550-
local cweaponinfo = cpedweaponmgr.m_weapon_info
551-
if (not cweaponinfo) then
550+
local cweaponinfo = cpedweaponmgr:GetWeaponInfo()
551+
if not (cweaponinfo and cweaponinfo:IsValid()) then
552552
print("CWeaponInfo: invalid pointer.")
553553
return
554554
end

SSV2/includes/frontend/settings/settings_ui.lua

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
-- * Provide a copy of or a link to the original license (GPL-3.0 or later); see LICENSE.md or <https://www.gnu.org/licenses/>.
88

99

10-
local ThemeManager = require("includes.services.ThemeManager")
11-
local selectedTheme = ThemeManager:GetCurrentTheme()
12-
local newThemeBuff = selectedTheme:Copy()
13-
local cfgReset = {
10+
local ThemeManager = require("includes.services.ThemeManager")
11+
local selectedTheme
12+
local newThemeBuff
13+
14+
local cfgReset = {
1415
---@type Set<string>
1516
exceptions = Set.new("backend.debug_mode"),
1617
excToggles = {
@@ -23,14 +24,13 @@ local cfgReset = {
2324
},
2425
open = false,
2526
}
26-
local themeEditor = {
27+
local themeEditor = {
2728
shouldDraw = false,
2829
liveEdit = false,
2930
shouldFocusName = false,
3031
valid = true,
3132
errors = {}
3233
}
33-
newThemeBuff.Name = ""
3434

3535
local function onConfigReset()
3636
for _, v in pairs(cfgReset.excToggles) do
@@ -44,29 +44,38 @@ local function drawGeneralSettings()
4444
GVars.backend.auto_cleanup_entities = GUI:CustomToggle(_T("SETTINGS_ENTITY_REPLACE"),
4545
GVars.backend.auto_cleanup_entities
4646
)
47-
GUI:Tooltip(_T("SETTINGS_ENTITY_REPLACE_TT"))
47+
GUI:HelpMarker(_T("SETTINGS_ENTITY_REPLACE_TT"))
4848

49-
ImGui.Spacing()
50-
ImGui.BulletText(_F("%s: %s (%s)", _T("SETTINGS_LANGUAGE"), GVars.backend.language_name, GVars.backend.language_code))
51-
ImGui.Spacing()
49+
if (Translator and Translator:IsReady()) then
50+
GUI:HeaderText(_T("SETTINGS_LANGUAGE"), { separator = true, spacing = true })
5251

53-
if ImGui.BeginCombo("##langs", _F("%s (%s)",
54-
Translator.locales[GVars.backend.language_index].name,
55-
Translator.locales[GVars.backend.language_index].iso
56-
)) then
57-
for i, lang in ipairs(Translator.locales) do
58-
local is_selected = (i == GVars.backend.language_index)
59-
if (ImGui.Selectable(_F("%s (%s)", lang.name, lang.iso), is_selected)) then
60-
GVars.backend.language_index = i
61-
GVars.backend.language_name = lang.name
62-
GVars.backend.language_code = lang.iso
52+
GVars.backend.use_game_language = GUI:CustomToggle(_T("SETTINGS_GAME_LANGUAGE"),
53+
GVars.backend.use_game_language,
54+
{ onClick = function() Translator:Reload() end, }
55+
)
56+
GUI:HelpMarker(_T("SETTINGS_GAME_LANGUAGE_TT"))
57+
58+
ImGui.Spacing()
59+
ImGui.BeginDisabled(GVars.backend.use_game_language)
60+
if ImGui.BeginCombo("##langs", _F("%s (%s)",
61+
Translator.locales[GVars.backend.language_index].name,
62+
Translator.locales[GVars.backend.language_index].iso
63+
)) then
64+
for i, lang in ipairs(Translator.locales) do
65+
local is_selected = (i == GVars.backend.language_index)
66+
if (ImGui.Selectable(_F("%s (%s)", lang.name, lang.iso), is_selected)) then
67+
GVars.backend.language_index = i
68+
GVars.backend.language_name = lang.name
69+
GVars.backend.language_code = lang.iso
70+
end
6371
end
72+
ImGui.EndCombo()
6473
end
65-
ImGui.EndCombo()
74+
ImGui.EndDisabled()
6675
end
6776

6877
ImGui.Spacing()
69-
78+
ImGui.Separator()
7079
if ImGui.Button(_T("SETTINGS_CFG_RESET")) then
7180
cfgReset.open = true
7281
end
@@ -105,11 +114,10 @@ local function drawGeneralSettings()
105114
end, function()
106115
cfgReset.exceptions:Clear()
107116
onConfigReset()
108-
end)
117+
end, true)
109118
ImGui.End()
110119
end
111120
end
112-
ImGui.Dummy(1, 10)
113121
end
114122

115123
local function drawThemeSettings()
@@ -119,7 +127,6 @@ local function drawThemeSettings()
119127

120128
if (ImGui.Begin("##new_theme",
121129
ImGuiWindowFlags.NoTitleBar
122-
| ImGuiWindowFlags.NoMove
123130
| ImGuiWindowFlags.NoResize
124131
| ImGuiWindowFlags.AlwaysAutoResize
125132
)) then
@@ -306,7 +313,8 @@ local function drawGuiSettings()
306313
ImGui.PopStyleVar()
307314
GUI:ShowWindowHeightLimit()
308315
end,
309-
ImGui.CloseCurrentPopup
316+
ImGui.CloseCurrentPopup,
317+
true
310318
)
311319
ImGui.EndPopup()
312320
end
@@ -346,14 +354,18 @@ local function drawGuiSettings()
346354
end
347355

348356
ImGui.BeginDisabled()
349-
GVars.ui.window_pos.x, _ = ImGui.SliderFloat(_T("SETTINGS_WINDOW_POS_X"), GVars.ui.window_pos.x, 0, resolution.x)
350-
GUI:Tooltip(_T("SETTINGS_WINDOW_POS_TT"))
351-
GVars.ui.window_pos.y, _ = ImGui.SliderFloat(_T("SETTINGS_WINDOW_POS_Y"), GVars.ui.window_pos.y, 0, resolution.y)
357+
GVars.ui.window_pos.x = ImGui.SliderFloat(_T("SETTINGS_WINDOW_POS_X"), GVars.ui.window_pos.x, 0, resolution.x)
358+
ImGui.EndDisabled()
352359
GUI:Tooltip(_T("SETTINGS_WINDOW_POS_TT"))
360+
361+
ImGui.BeginDisabled()
362+
GVars.ui.window_pos.y = ImGui.SliderFloat(_T("SETTINGS_WINDOW_POS_Y"), GVars.ui.window_pos.y, 0, resolution.y)
353363
ImGui.EndDisabled()
364+
GUI:Tooltip(_T("SETTINGS_WINDOW_POS_TT"))
354365

355366
ImGui.Spacing()
356367
GUI:HeaderText(_T("SETTINGS_WINDOW_STYLE"), { separator = true })
368+
selectedTheme = selectedTheme or ThemeManager:GetCurrentTheme()
357369

358370
GVars.ui.style.bg_alpha, _ = ImGui.SliderFloat(_T("SETTINGS_WINDOW_ALPHA"), GVars.ui.style.bg_alpha, 0.01, 1.0)
359371
ImGui.SameLine()

SSV2/includes/frontend/vehicle/stancer_ui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ return function()
320320
end
321321
end, function()
322322
saved_vehs_window.should_draw = false
323-
end)
323+
end, true)
324324

325325
ImGui.End()
326326
end

0 commit comments

Comments
 (0)