forked from YimMenu-Lua/Samurais-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsamurais_scripts.lua
More file actions
103 lines (85 loc) · 2.77 KB
/
Copy pathsamurais_scripts.lua
File metadata and controls
103 lines (85 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
-- Copyright (C) 2026 SAMURAI (xesdoog) & Contributors.
-- This file is part of Samurai's Scripts.
--
-- Permission is hereby granted to copy, modify, and redistribute
-- this code as long as you respect these conditions:
-- * Credit the owner and contributors.
-- * 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/>.
local start_time = os.clock()
require("includes.init")
if (Backend:IsMockEnv()) then
require("includes.tests")
return
end
local function populate_weapons()
local weapons = require("includes.data.weapons")
local weapons_map = {
["GROUP_MELEE"] = weapons.Melee,
["GROUP_PISTOL"] = weapons.Pistols,
["GROUP_RIFLE"] = weapons.AssaultRifles,
["GROUP_SHOTGUN"] = weapons.Shotguns,
["GROUP_SMG"] = weapons.SMG,
["GROUP_MG"] = weapons.MachineGuns,
["GROUP_SNIPER"] = weapons.SniperRifles,
["GROUP_HEAVY"] = weapons.Heavy,
["GROUP_THROWN"] = weapons.Throwables,
["GROUP_PETROLCAN"] = weapons.Misc,
["GROUP_STUNGUN"] = weapons.Misc,
["GROUP_TRANQILIZER"] = weapons.Misc,
}
local weaponData = require("includes.data.weapon_data")
local branch = Backend:GetGameBranch()
for hash, data in pairs(weaponData) do
if (branch == Enums.eGameBranch.LEGACY and data.model_name == "WEAPON_STRICKLER") then
goto continue
end
if (not WEAPON.IS_WEAPON_VALID(hash)) then
goto continue
end
data.display_name = Game.GetLabelText(data.gxt)
local weapon_group = weapons_map[data.group]
if (not weapon_group) then
goto continue
end
table.insert(weapon_group, hash)
table.insert(weapons.All, hash)
::continue::
end
end
local function register_commands()
local yimActions = require("includes.features.extra.yim_actions.YimActionsV3")
local commandRegistry = require("includes.lib.commands")
for name, cmd in pairs(commandRegistry) do
CommandExecutor:RegisterCommand(name, cmd.callback, cmd.opts)
end
yimActions:RegisterCommands()
end
local function unlock_if_fsl()
if (Game.IsFSL()) then
GVars.features.unsafe_feats_enabled = true
end
end
GPointers:Init()
GGlobals:Init()
Serializer:FlushObjectQueue()
Backend:RegisterHandlers()
Translator:Load()
GUI:LateInit()
ThreadManager:Run(function()
populate_weapons()
register_commands()
unlock_if_fsl()
KeyManager:RegisterKeybind(eVirtualKeyCodes.NUMPAD8, function()
LocalPlayer:GetVehicle():RamForward()
end)
KeyManager:RegisterKeybind(eVirtualKeyCodes.NUMPAD4, function()
LocalPlayer:GetVehicle():RamLeft()
end)
KeyManager:RegisterKeybind(eVirtualKeyCodes.NUMPAD6, function()
LocalPlayer:GetVehicle():RamRight()
end)
while (not PatternScanner:IsDone()) do
yield()
end
Backend:debug("Script loaded in %.0fms", (os.clock() - start_time) * 1000)
end)