forked from YimMenu-Lua/Samurais-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsamurais_scripts.lua
More file actions
78 lines (63 loc) · 2.2 KB
/
samurais_scripts.lua
File metadata and controls
78 lines (63 loc) · 2.2 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
-- 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 commandRegistry = require("includes.lib.commands")
local Weapons = require("includes.data.weapons")
local weaponData = require("includes.data.weapon_data")
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 function populate_weapons()
for hash, data in pairs(weaponData) do
data.display_name = Game.GetGXTLabel(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
require("includes.init")
GPointers:Init()
Serializer:FlushObjectQueue()
Backend:RegisterHandlers()
Translator:Load()
GUI:LateInit()
ThreadManager:Run(function()
local start_time = os.clock()
for name, cmd in pairs(commandRegistry) do
CommandExecutor:RegisterCommand(name, cmd.callback, cmd.opts)
end
YimActions:RegisterCommands()
populate_weapons()
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)