mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 00:01:22 +00:00
Refactor core structure and notification UI
Major refactor to centralize QBCore and replace the web UI stack: - Move QBConfig into a unified QBCore.Config and initialize QBCore.PlayerData; add shared/functions.lua. - Remove legacy client/main.lua and server/main.lua exports and update fxmanifest to include shared/functions and drop those main scripts. - Update client event handling: adapt player data events to QBCore:Client:OnPlayerUpdated and trigger job/gang update events; remove deprecated exploitable handlers. - Web UI rewrite: remove Vue/Quasar dependency and config module; implement a lightweight vanilla JS notification system (html/js/app.js) with updated html and css assets, plus drawtext tweaks. - CSS overhaul for notification styling and animations; HTML head/meta/font cleanup. - Server fixes: use QBCore.Shared.Locations in teleport command and strengthen numeric parsing/validation for coords. - Add .gitattributes for consistent text/eol handling and small code cleanups (thread/comment removal). These changes consolidate config/shared logic under QBCore, simplify the frontend dependencies, and fix a few parsing/event issues.
This commit is contained in:
+10
-19
@@ -1,6 +1,3 @@
|
||||
-- Player load and unload handling
|
||||
-- New method for checking if logged in across all scripts (optional)
|
||||
-- if LocalPlayer.state['isLoggedIn'] then
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||
ShutdownLoadingScreenNui()
|
||||
LocalPlayer.state:set('isLoggedIn', true, false)
|
||||
@@ -17,6 +14,7 @@ RegisterNetEvent('QBCore:Client:PvpHasToggled', function(pvp_state)
|
||||
SetCanAttackFriendly(PlayerPedId(), pvp_state, false)
|
||||
NetworkSetFriendlyFireOption(pvp_state)
|
||||
end)
|
||||
|
||||
-- Teleport Commands
|
||||
|
||||
RegisterNetEvent('QBCore:Command:TeleportToPlayer', function(coords)
|
||||
@@ -182,30 +180,23 @@ end)
|
||||
|
||||
-- Other stuff
|
||||
|
||||
RegisterNetEvent('QBCore:Player:SetPlayerData', function(val)
|
||||
QBCore.PlayerData = val
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Player:UpdatePlayerDataField', function(key, val)
|
||||
if QBCore.PlayerData and key then
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerUpdated', function(key, val)
|
||||
if key == 'all' then
|
||||
QBCore.PlayerData = val
|
||||
TriggerEvent('QBCore:Player:SetPlayerData', val)
|
||||
TriggerEvent('QBCore:Client:OnJobUpdate', val.job)
|
||||
TriggerEvent('QBCore:Client:OnGangUpdate', val.gang)
|
||||
elseif QBCore.PlayerData and key then
|
||||
QBCore.PlayerData[key] = val
|
||||
if key == 'job' then TriggerEvent('QBCore:Client:OnJobUpdate', val) end
|
||||
if key == 'gang' then TriggerEvent('QBCore:Client:OnGangUpdate', val) end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Player:UpdatePlayerData', function()
|
||||
TriggerServerEvent('QBCore:UpdatePlayer')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Notify', function(text, type, length, icon)
|
||||
QBCore.Functions.Notify(text, type, length, icon)
|
||||
end)
|
||||
|
||||
-- This event is exploitable and should not be used. It has been deprecated, and will be removed soon.
|
||||
RegisterNetEvent('QBCore:Client:UseItem', function(item)
|
||||
QBCore.Debug(string.format('%s triggered QBCore:Client:UseItem by ID %s with the following data. This event is deprecated due to exploitation, and will be removed soon. Check qb-inventory for the right use on this event.', GetInvokingResource(), GetPlayerServerId(PlayerId())))
|
||||
QBCore.Debug(item)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('getNotifyConfig', function(_, cb)
|
||||
cb(QBCore.Config.Notify)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user