This event can be used as an event handler to trigger code because it indicates that the players data has changed!
RegisterNetEvent('QBCore:Player:SetPlayerData', function(val)
PlayerData = val
print(QBCore.Debug(PlayerData))
end)
QBCore:Notify
Arguments
Type
Required
Default
message
string | table
yes
'Placeholder'
type
string
yes
'primary'
length
number
yes
5000
Client example
-- /testnotify This is my message, primary, 5000
RegisterCommand('testnotify', function(_, args)
local message = {}
for i=1, #args do
message[#message + 1] = args[i]
if string.match(args[i], ',') then
local text = table.concat(message, ' '):gsub(",", "")
local type = args[i + 1]:gsub(",", "")
local length = args[i + 2]
TriggerEvent('QBCore:Notify', text, type, length)
break
end
end
end)
-- Using QBCore's shared functions!
RegisterCommand('testnotify', function(_, args)
local message = QBCore.Shared.SplitStr(table.concat(args, ' '), ",")
local text = message[1]
local type = QBCore.Shared.Trim(message[2])
local length = tonumber(message[3])
TriggerEvent('QBCore:Notify', text, type, length)
end)
Server example
-- /testnotify This is my message, primary, 5000
RegisterCommand('testnotify', function(source, args)
local message = {}
for i=1, #args do
message[#message + 1] = args[i]
if string.match(args[i], ',') then
local text = table.concat(message, ' '):gsub(",", "")
local type = args[i + 1]:gsub(",", "")
local length = args[i + 2]
TriggerClientEvent('QBCore:Notify', source, text, type, length)
break
end
end
end)
-- Using QBCore's shared functions!
RegisterCommand('testnotify', function(source, args)
local message = QBCore.Shared.SplitStr(table.concat(args, ' '), ",")
local text = message[1]
local type = QBCore.Shared.Trim(message[2])
local length = tonumber(message[3])
TriggerClientEvent('QBCore:Notify', source, text, type, length)
end)
QBCore:Client:UseItem
Arguments
Type
Required
Default
item name
string
yes
none
Client example (must have the item in your inventory)
-- /3dtext This is my message
RegisterCommand('3dtext', function(_, args)
local message = table.concat(args, ' ')
TriggerEvent('QBCore:Command:ShowMe3D', PlayerId(), message)
end)
Server example
-- /3dtext This is my message
RegisterCommand('3dtext', function(source, args)
local message = table.concat(args, ' ')
TriggerClientEvent('QBCore:Command:ShowMe3D', source, message)
end)
QBCore:Client:UpdateObject
This event must be used as a handler when using Shared Exports because it refreshes the core object in your resource