mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
27 lines
1.3 KiB
Lua
27 lines
1.3 KiB
Lua
RegisterNetEvent('esx_rpchat:sendProximityMessage')
|
|
AddEventHandler('esx_rpchat:sendProximityMessage', function(id, title, message, color)
|
|
local source = PlayerId()
|
|
local target = GetPlayerFromServerId(id)
|
|
|
|
if target == source then
|
|
TriggerEvent('chat:addMessage', { args = { title, message }, color = color })
|
|
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(source)), GetEntityCoords(GetPlayerPed(target)), true) < 19 then
|
|
TriggerEvent('chat:addMessage', { args = { title, message }, color = color })
|
|
end
|
|
end)
|
|
|
|
Citizen.CreateThread(function()
|
|
TriggerEvent('chat:addSuggestion', '/ooc', _U('ooc_help'), {{name=_U('ooc_argument_name'), help=_U('ooc_argument_help')}})
|
|
TriggerEvent('chat:addSuggestion', '/twt', _U('twt_help'), {{name=_U('ooc_argument_name'), help=_U('ooc_argument_help')}})
|
|
TriggerEvent('chat:addSuggestion', '/me', _U('me_help'), {{name=_U('ooc_argument_name'), help=_U('ooc_argument_help')}})
|
|
TriggerEvent('chat:addSuggestion', '/news', _U('news_help'), {{name=_U('ooc_argument_name'), help=_U('ooc_argument_help')}})
|
|
end)
|
|
|
|
AddEventHandler('onResourceStop', function(resource)
|
|
if resource == GetCurrentResourceName() then
|
|
TriggerEvent('chat:removeSuggestion', '/ooc')
|
|
TriggerEvent('chat:removeSuggestion', '/twt')
|
|
TriggerEvent('chat:removeSuggestion', '/me')
|
|
TriggerEvent('chat:removeSuggestion', '/news')
|
|
end
|
|
end) |