Files
esx_core/client/main.lua
T
Jimmy Bassy d99cfff4f2 Fix for the new es_extended + feature
Fix for the proximity BUG with the new ESX, and added feature for anonymous tweets, using the command /anontwt
2020-06-28 23:12:24 +02:00

31 lines
1.4 KiB
Lua

RegisterNetEvent('esx_rpchat:sendProximityMessage')
AddEventHandler('esx_rpchat:sendProximityMessage', function(playerId, title, message, color)
local player = PlayerId()
local target = GetPlayerFromServerId(playerId)
local playerPed = PlayerPedId()
local targetPed = GetPlayerPed(target)
local playerCoords = GetEntityCoords(playerPed)
local targetCoords = GetEntityCoords(targetPed)
if target == player or #(playerCoords - targetCoords) < 20 then
TriggerEvent('chat:addMessage', {args = {title, message}, color = color})
end
end)
Citizen.CreateThread(function()
TriggerEvent('chat:addSuggestion', '/twt', _U('twt_help'), {{name = _U('generic_argument_name'), help = _U('generic_argument_help')}})
TriggerEvent('chat:addSuggestion', '/anontwt', _U('twtanon_help'), {{name = _U('generic_argument_name'), help = _U('generic_argument_help')}})
TriggerEvent('chat:addSuggestion', '/me', _U('me_help'), {{name = _U('generic_argument_name'), help = _U('generic_argument_help')}})
TriggerEvent('chat:addSuggestion', '/do', _U('do_help'), {{name = _U('generic_argument_name'), help = _U('generic_argument_help')}})
end)
AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
TriggerEvent('chat:removeSuggestion', '/twt')
TriggerEvent('chat:removeSuggestion', '/me')
TriggerEvent('chat:removeSuggestion', '/do')
end
end)