Step 1. Remove old chat resource
Step 2. Install dependencies
Install the dependencies if they are not installed.
Step 3. Download lvs_chat
Download the lvs-chat package from your keymaster. It contains two resources: chat
and lvs_chat_extra
. Place both inside the resources
folder.
Step 4. Script initiate (server.cfg)
Copy ...
set resources_useSystemChat false # set false to build-in chat (newest version of fxserver))
...
# These resources will start by default.
ensure mapmanager
ensure chat # <-- still here
ensure spawnmanager
ensure sessionmanager
...
ensure ox_lib
ensure lvs_chat_extra # <-- somewhere after ox_lib
...
Now configure and translate your resources.
Config fileschat/config.lua
lvs_chat_extra/config.lua
lvs_chat_extra/server/webhook.lua
qb-core/server/commands.lua
Copy -- Out of Character Chat
QBCore.Commands. Add ( 'ooc' , Lang: t ( 'command.ooc.help' ), {}, false , function ( source , args )
local message = table.concat (args, ' ' )
local Players = QBCore.Functions. GetPlayers ()
local Player = QBCore.Functions. GetPlayer (source)
local playerCoords = GetEntityCoords ( GetPlayerPed (source))
for _, v in pairs (Players) do
if v == source then
TriggerClientEvent ( 'chat:addMessage' , v, {
color = QBCore.Config.Commands.OOCColor,
multiline = true ,
args = { 'OOC | ' .. GetPlayerName (source), message }
})
elseif # (playerCoords - GetEntityCoords ( GetPlayerPed (v))) < 20.0 then
TriggerClientEvent ( 'chat:addMessage' , v, {
color = QBCore.Config.Commands.OOCColor,
multiline = true ,
args = { 'OOC | ' .. GetPlayerName (source), message }
})
elseif QBCore.Functions. HasPermission (v, 'admin' ) then
if QBCore.Functions. IsOptin (v) then
TriggerClientEvent ( 'chat:addMessage' , v, {
color = QBCore.Config.Commands.OOCColor,
multiline = true ,
args = { 'Proximity OOC | ' .. GetPlayerName (source), message }
})
TriggerEvent ( 'qb-log:server:CreateLog' , 'ooc' , 'OOC' , 'white' , '**' .. GetPlayerName (source) .. '** (CitizenID: ' .. Player.PlayerData.citizenid .. ' | ID: ' .. source .. ') **Message:** ' .. message, false )
end
end
end
end , 'user' )
-- Me command
QBCore.Commands. Add ( 'me' , Lang: t ( 'command.me.help' ), { { name = Lang: t ( 'command.me.params.message.name' ), help = Lang: t ( 'command.me.params.message.help' ) } }, false , function ( source , args )
if # args < 1 then
TriggerClientEvent ( 'QBCore:Notify' , source, Lang: t ( 'error.missing_args2' ), 'error' )
return
end
local ped = GetPlayerPed (source)
local pCoords = GetEntityCoords (ped)
local msg = table.concat (args, ' ' ): gsub ( '[~<].-[>~]' , '' )
local Players = QBCore.Functions. GetPlayers ()
for i = 1 , # Players do
local Player = Players[i]
local target = GetPlayerPed (Player)
local tCoords = GetEntityCoords (target)
if target == ped or # (pCoords - tCoords) < 20 then
TriggerClientEvent ( 'QBCore:Command:ShowMe3D' , Player, source, msg)
end
end
end , 'user' )