Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing errors caused by new core #6

Merged
merged 9 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 88 additions & 127 deletions client/camera.lua

Large diffs are not rendered by default.

704 changes: 429 additions & 275 deletions client/main.lua

Large diffs are not rendered by default.

72 changes: 0 additions & 72 deletions config.lua

This file was deleted.

28 changes: 28 additions & 0 deletions config/client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
return {
useTarget = GetConvar('UseTarget', 'false') == 'true',
debugPoly = false,
useBlips = true,
locations = {
mainEntrance = {coords = vec4(-598.4, -929.85, 24.0, 271.5)},
inside = {coords = vec4(-77.55, -833.75, 243.0, 67.5)},
outside = {coords = vec4(-598.25, -929.86, 23.86, 86.5)},
vehicleStorage = {coords = vec4(-557.0, -925.25, 24.0, 270.0)},
roofEntrance = {coords = vec4(-80.45, -832.7, 243.0, 72.0)},
roofExit = {coords = vec4(-568.5, -927.75, 37.0, 85.25)},
helicopterStorage = {coords = vec4(-583.08, -930.55, 36.83, 89.26)}
},
authorizedVehicles = {
[0] = {rumpo = 'Rumpo'}, -- Grade 0
[1] = {rumpo = 'Rumpo'}, -- Grade 1
[2] = {rumpo = 'Rumpo'}, -- Grade 2
[3] = {rumpo = 'Rumpo'}, -- Grade 3
[4] = {rumpo = 'Rumpo'} -- Grade 4
},
authorizedhelicopters = {
[0] = {frogger = 'Frogger'}, -- Grade 0
[1] = {frogger = 'Frogger'}, -- Grade 1
[2] = {frogger = 'Frogger'}, -- Grade 2
[3] = {frogger = 'Frogger'}, -- Grade 3
[4] = {frogger = 'Frogger'} -- Grade 4
}
}
21 changes: 15 additions & 6 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
fx_version 'cerulean'
game 'gta5'

description 'QB-NewsJob'
description 'QBX_NewsJob'
repository 'https://github.com/Qbox-project/qbx_newsjob'
version '1.0.1'

shared_scripts {
'config.lua',
'@qb-core/shared/locale.lua',
'@ox_lib/init.lua',
'@qbx_core/modules/utils.lua',
'@qbx_core/shared/locale.lua',
'locales/en.lua',
'locales/*.lua',
'@ox_lib/init.lua'
}

client_scripts {
'@qbx_core/modules/playerdata.lua',
'client/main.lua',
'client/camera.lua'
}

server_script 'server/main.lua'
server_script {
'server/main.lua'
}

files {
'config/client.lua',
}

lua54 'yes'
lua54 'yes'
use_experimental_fxv2_oal 'yes'
36 changes: 23 additions & 13 deletions locales/en.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
local Translations = {
text = {
weazle_overlay = "Weazle Overlay ~INPUT_PICKUP~ \nFilm Overlay: ~INPUT_INTERACTION_MENU~",
weazel_news_vehicles = "Weazel News Vehicles",
close_menu = "⬅ Close Menu",
weazel_news_helicopters = "Weazel News Helicopters",
store_vehicle = "~g~E~w~ - Store the Vehicle",
vehicles = "~g~E~w~ - Vehicles",
store_helicopters = "~g~E~w~ - Store the Helicopters",
helicopters = "~g~E~w~ - Helicopters",
enter = "~g~E~w~ - Enter",
go_outside = "~g~E~w~ - Go outside",
breaking_news= "BREAKING NEWS"
}
error = {
cant_spawn_vehicle = 'Something went wrong spawning the vehicle',
no_access = 'You don\'t have access to this command.'
},
info = {
weazle_overlay = 'Weazel Overlay: [E] \nFilm Overlay: [M]',
weazel_news_vehicles = 'Weazel News Vehicles',
close_menu = '⬅ Close Menu',
weazel_news_helicopters = 'Weazel News Helicopters',
store_vehicle = '[E] - Store the Vehicle',
vehicles = '[E] - Vehicles',
store_helicopters = '[E] - Store the Helicopters',
helicopters = '[E] - Helicopters',
enter = '[E] - Enter',
go_outside = '[E] - Go outside',
roof_enter = '[E] - Enter roof',
roof_exit = '[E] - Exit roof',
breaking_news= 'BREAKING NEWS',
newscam = 'Grab a news camera',
newsmic = 'Grab a news microphone',
newsbmic = 'Grab a Boom microphone',
news_plate = 'WZNW', --Should only be 4 characters long
},
}

Lang = Lang or Locale:new({
Expand Down
34 changes: 22 additions & 12 deletions locales/es.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
local Translations = {
text = {
weazle_overlay = "Transmitir noticia en vivo ~INPUT_PICKUP~ \nGrabar noticia: ~INPUT_INTERACTION_MENU~",
weazel_news_vehicles = "Vehículos Weazel News",
close_menu = "⬅ Cerrar menu",
weazel_news_helicopters = "Helicopteros Weazel News",
store_vehicle = "[E] - Guardar vehículo",
vehicles = "[E] - Vehículos",
store_helicopters = "[E] - Guardar Helicoptero",
helicopters = "[E] - Helicopteros",
enter = "[E] - Entrar",
go_outside = "[E] - Salir",
breaking_news= "¡NOTICIA DE ULTIMA HORA!"
error = {
cant_spawn_vehicle = 'Something went wrong spawning the vehicle',
no_access = 'You don\'t have access to this command.'
},
info = {
weazle_overlay = 'Transmitir noticia en vivo ~INPUT_PICKUP~ \nGrabar noticia: ~INPUT_INTERACTION_MENU~',
weazel_news_vehicles = 'Vehículos Weazel News',
close_menu = '⬅ Cerrar menu',
weazel_news_helicopters = 'Helicopteros Weazel News',
store_vehicle = '[E] - Guardar vehículo',
vehicles = '[E] - Vehículos',
store_helicopters = '[E] - Guardar Helicoptero',
helicopters = '[E] - Helicopteros',
enter = '[E] - Entrar',
go_outside = '[E] - Salir',
roof_enter = '[E] - Enter roof',
roof_exit = '[E] - Exit roof',
breaking_news= '¡NOTICIA DE ULTIMA HORA!',
newscam = 'Grab a news camera',
newsmic = 'Grab a news microphone',
newsbmic = 'Grab a Boom microphone',
news_plate = 'WZNW', --Should only be 4 characters long
},
}

Expand Down
34 changes: 22 additions & 12 deletions locales/fr.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
local Translations = {
text = {
weazle_overlay = "Overlay Weazel ~INPUT_PICKUP~ \nOverlay Film: ~INPUT_INTERACTION_MENU~",
weazel_news_vehicles = "Vehicules Weazel-News",
close_menu = "⬅ Fermer Menu",
weazel_news_helicopters = "Hélicoptère Weazel News",
store_vehicle = "~g~E~w~ - Garer le véhicule",
vehicles = "~g~E~w~ - Véhicules",
store_helicopters = "~g~E~w~ - Garer l'hélicoptère",
helicopters = "~g~E~w~ - Hélicoptères",
enter = "~g~E~w~ - Entrer",
go_outside = "~g~E~w~ - Sortir",
breaking_news = "BREAKING NEWS"
error = {
cant_spawn_vehicle = 'Something went wrong spawning the vehicle',
no_access = 'You don\'t have access to this command.'
},
info = {
weazle_overlay = 'Overlay Weazel ~INPUT_PICKUP~ \nOverlay Film: ~INPUT_INTERACTION_MENU~',
weazel_news_vehicles = 'Vehicules Weazel-News',
close_menu = '⬅ Fermer Menu',
weazel_news_helicopters = 'Hélicoptère Weazel News',
store_vehicle = '[E] - Garer le véhicule',
vehicles = '[E] - Véhicules',
store_helicopters = '[E] - Garer l\'hélicoptère',
helicopters = '[E] - Hélicoptères',
enter = '[E] - Entrer',
go_outside = '[E] - Sortir',
roof_enter = '[E] - Enter roof',
roof_exit = '[E] - Exit roof',
breaking_news = 'BREAKING NEWS',
newscam = 'Grab a news camera',
newsmic = 'Grab a news microphone',
newsbmic = 'Grab a Boom microphone',
news_plate = 'WZNW', --Should only be 4 characters long
}
}

Expand Down
49 changes: 36 additions & 13 deletions server/main.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
local QBCore = exports['qbx-core']:GetCoreObject()
local function checkReporterJob(source)
local Player = exports.qbx_core:GetPlayer(source)
return Player.PlayerData.job.name == 'reporter'
end

QBCore.Commands.Add("newscam", "Grab a news camera", {}, false, function(source, _)
local Player = QBCore.Functions.GetPlayer(source)
if Player.PlayerData.job.name == "reporter" then
TriggerClientEvent("Cam:ToggleCam", source)
lib.addCommand('newscam', {
help = Lang:t('info.newscam'),
}, function(source)
if not checkReporterJob(source) then
TriggerClientEvent('ox_lib:notify', source, { description = Lang:t('error.no_access'), type = 'error' })
return
end
TriggerClientEvent('qbx_newsjob:client:toggleCam', source)
end)

QBCore.Commands.Add("newsmic", "Grab a news microphone", {}, false, function(source, _)
local Player = QBCore.Functions.GetPlayer(source)
if Player.PlayerData.job.name == "reporter" then
TriggerClientEvent("Mic:ToggleMic", source)
lib.addCommand('newsmic', {
help = Lang:t('info.newsmic'),
}, function(source)
if not checkReporterJob(source) then
TriggerClientEvent('ox_lib:notify', source, { description = Lang:t('error.no_access'), type = 'error' })
return
end
TriggerClientEvent('qbx_newsjob:client:toggleMic', source)
end)

QBCore.Commands.Add("newsbmic", "Grab a Boom microphone", {}, false, function(source, _)
local Player = QBCore.Functions.GetPlayer(source)
if Player.PlayerData.job.name == "reporter" then
TriggerClientEvent("Mic:ToggleBMic", source)
lib.addCommand('newsbmic', {
help = Lang:t('info.newsbmic'),
}, function(source)
if not checkReporterJob(source) then
TriggerClientEvent('ox_lib:notify', source, { description = Lang:t('error.no_access'), type = 'error' })
return
end
TriggerClientEvent('qbx_newsjob:client:toggleBMic', source)
end)

lib.callback.register('qbx_newsjob:server:spawnVehicle', function(source, model, coords, plate)
local netId = SpawnVehicle(source, model, coords)
if not netId or netId == 0 then return end
local veh = NetworkGetEntityFromNetworkId(netId)
if not veh or veh == 0 then return end
SetEntityHeading(veh, coords.w)
SetVehicleNumberPlateText(veh, plate)
TriggerClientEvent('vehiclekeys:client:SetOwner', source, plate)
return netId
end)
Loading