├── log.txt
├── fxmanifest.lua
├── README.md
├── config.lua
├── sv_rockstar.lua
└── cl_rockstar.lua
/log.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/fxmanifest.lua:
--------------------------------------------------------------------------------
1 | fx_version 'cerulean'
2 | name 'nad_rockstar'
3 | description 'Rockstar Editor script, made by Nad#1223.'
4 | author 'Nad#1223'
5 | game 'gta5'
6 |
7 | client_scripts {
8 | '@menuv/menuv.lua',
9 | 'config.lua',
10 | 'cl_rockstar.lua'
11 | }
12 |
13 | server_scripts {
14 | 'config.lua',
15 | 'sv_rockstar.lua'
16 | }
17 |
18 | dependencies {
19 | 'menuv'
20 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | ## About
19 | Hey all! This is my first resource release on the forums - it’s a fairly simple but useful script that allows you to record your in-game footage with Rockstar Editor through a clean UI (courtesy of MenuV). I noticed a lot of people in the community asking for something like this, so I decided to make it myself. It also has a logging feature which logs to a file and/or server console (configurable) whenever someone starts/deletes/saves a recording. I hope you all enjoy and find this useful!
20 |
--------------------------------------------------------------------------------
/config.lua:
--------------------------------------------------------------------------------
1 | Config = {}
2 |
3 | Config.command = "rockstar" -- Change this to whatever you want the command to be
4 |
5 |
6 | -- [[ Logs ]] --
7 | Config.enableLogs = true -- Change this to false if you want to disable logs
8 | Config.logToFile = true -- Change this to false if you do not want to log to a file // NOTE: Must have a 'log.txt' file in the resource folder.
9 | Config.printToConsole = true -- Change this to false if you do not want every event to print to server console
10 | -- [[ Logs ]] --
11 |
12 |
13 | -- [[ Locale ]] --
14 | -- Menu Slider Buttons
15 | Config.buttonRecord = "Start Recording"
16 | Config.buttonSaveClip = "Save Recording"
17 | Config.buttonDelClip = "Discard Recording"
18 | Config.buttonEditor = "Open Editor"
19 |
20 | -- Notifications
21 | Config.record = "Started recording"
22 | Config.saveclip = "Saved recording"
23 | Config.delclip = "Discarded recording"
24 | Config.editor = "Opening Rockstar Editor"
25 |
26 | -- Logs
27 | Config.logRecord = " began recording"
28 | Config.logSaveClip = " saved a recording"
29 | Config.logDelClip = " discarded a recording"
30 | Config.logEditor = " opened Rockstar Editor"
31 | -- [[ Locale ]] --
--------------------------------------------------------------------------------
/sv_rockstar.lua:
--------------------------------------------------------------------------------
1 | RegisterServerEvent('nad_rockstar:log')
2 | AddEventHandler('nad_rockstar:log', function(option)
3 | local id = source
4 | local date_table = os.date("*t")
5 | local hour, minute, second = date_table.hour, date_table.min, date_table.sec
6 | local year, month, day = date_table.year, date_table.month, date_table.day
7 | local result = string.format("%d-%d-%d %d:%d:%d", year, month, day, hour, minute, second)
8 |
9 | local name = GetPlayerName(id)
10 | local identifier = GetPlayerIdentifier(id, 0)
11 |
12 | if option == 'record' then
13 | local msg = result.." // "..name.." ("..identifier..")".. Config.logRecord
14 | if Config.logToFile == true then
15 | LogToFile(msg)
16 | end
17 | if Config.printToConsole == true then
18 | print(msg)
19 | end
20 | elseif option == 'saveclip' then
21 | local msg = result.." // "..name.." ("..identifier..")".. Config.logSaveClip
22 | if Config.logToFile == true then
23 | LogToFile(msg)
24 | end
25 | if Config.printToConsole == true then
26 | print(msg)
27 | end
28 | elseif option == 'delclip' then
29 | local msg = result.." // "..name.." ("..identifier..")".. Config.logDelClip
30 | if Config.logToFile == true then
31 | LogToFile(msg)
32 | end
33 | if Config.printToConsole == true then
34 | print(msg)
35 | end
36 | else
37 | local msg = result.." // "..name.." ("..identifier..")".. Config.logEditor
38 | if Config.logToFile == true then
39 | LogToFile(msg)
40 | end
41 | if Config.printToConsole == true then
42 | print(msg)
43 | end
44 | end
45 |
46 | end)
47 |
48 | function LogToFile(text)
49 | local content = LoadResourceFile(GetCurrentResourceName(), "log.txt")
50 | local newContent = content .. '\r\n' .. text
51 | SaveResourceFile(GetCurrentResourceName(), "log.txt", newContent, -1)
52 | end
53 |
--------------------------------------------------------------------------------
/cl_rockstar.lua:
--------------------------------------------------------------------------------
1 | -- [[ Initialize Menu ]] --
2 | local menu = MenuV:CreateMenu(false, 'Rockstar Editor', 'topleft', 52, 180, 235, 'size-125', 'none', 'menuv', 'example_namespace')
3 | slider = menu:AddSlider({ icon = '🎥', label = 'Option', value = 'option', values = {
4 | { label = Config.buttonRecord, value = 'record', description = '' },
5 | { label = Config.buttonSaveClip, value = 'saveclip', description = '' },
6 | { label = Config.buttonDelClip, value = 'delclip', description = '' },
7 | { label = Config.buttonEditor, value = 'editor', description = '' }
8 | }})
9 | slider:On('select', function(item, value)
10 | TriggerEvent("nad_rockstar:"..value)
11 | if Config.enableLogs == true then
12 | TriggerServerEvent('nad_rockstar:log', value)
13 | end
14 | end)
15 |
16 |
17 | -- [[ Register Events ]] --
18 | RegisterNetEvent("nad_rockstar:record")
19 | AddEventHandler("nad_rockstar:record", function()
20 | StartRecording(1) -- https://docs.fivem.net/natives/?_0xC3AC2FFF9612AC81
21 | notify(Config.record)
22 | end)
23 |
24 | RegisterNetEvent("nad_rockstar:saveclip")
25 | AddEventHandler("nad_rockstar:saveclip", function()
26 | StartRecording(0) -- https://docs.fivem.net/natives/?_0xC3AC2FFF9612AC81
27 | StopRecordingAndSaveClip() -- https://docs.fivem.net/natives/?_0x071A5197D6AFC8B3
28 | notify(Config.saveclip)
29 | end)
30 |
31 | RegisterNetEvent("nad_rockstar:delclip")
32 | AddEventHandler("nad_rockstar:delclip", function()
33 | StopRecordingAndDiscardClip() -- https://docs.fivem.net/natives/?_0x88BB3507ED41A240
34 | notify(Config.delclip)
35 | end)
36 |
37 | RegisterNetEvent("nad_rockstar:editor")
38 | AddEventHandler("nad_rockstar:editor", function()
39 | notify(Config.editor)
40 | NetworkSessionLeaveSinglePlayer() -- https://docs.fivem.net/natives/?_0x3442775428FD2DAA
41 | ActivateRockstarEditor() -- https://docs.fivem.net/natives/?_0x49DA8145672B2725
42 | end)
43 |
44 | -- [[ Register Command ]] --
45 | RegisterCommand(Config.command, function(source)
46 | MenuV:OpenMenu(menu)
47 | end, false)
48 |
49 |
50 | -- [[ Functions ]] --
51 | function notify(text)
52 | SetNotificationTextEntry("STRING")
53 | AddTextComponentString(text)
54 | DrawNotification(true, true)
55 | end
56 |
--------------------------------------------------------------------------------