Merge pull request #41 from JimmyBassy/master

Fix for the new ESX + extra feature
This commit is contained in:
LazarusOfTheFallen
2021-02-01 15:02:01 -06:00
committed by GitHub
3 changed files with 33 additions and 4 deletions
+6 -2
View File
@@ -3,8 +3,10 @@ AddEventHandler('esx_rpchat:sendProximityMessage', function(playerId, title, mes
local player = PlayerId()
local target = GetPlayerFromServerId(playerId)
local playerPed, targetPed = PlayerPedId(), GetPlayerPed(target)
local playerCoords, targetCoords = GetEntityCoords(playerPed), GetEntityCoords(targetPed)
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})
@@ -13,6 +15,7 @@ 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)
@@ -24,3 +27,4 @@ AddEventHandler('onResourceStop', function(resource)
TriggerEvent('chat:removeSuggestion', '/do')
end
end)
+12
View File
@@ -0,0 +1,12 @@
Locales['es'] = {
['ooc_prefix'] = 'OOC | %s',
['twt_help'] = 'Mandar tweet',
['twtanon_help'] = 'Mandar tweet anonimo',
['twt_prefix'] = '^0[^4Twitter^0] (^5@%s^0)',
['me_help'] = 'Accion Global',
['me_prefix'] = 'me | %s',
['do_help'] = 'Accion Personal',
['do_prefix'] = 'do | %s',
['generic_argument_name'] = 'mensaje',
['generic_argument_help'] = 'el mensaje',
}
+15 -2
View File
@@ -16,12 +16,25 @@ RegisterCommand('twt', function(playerId, args, rawCommand)
print('esx_rpchat: you can\'t use this command from console!')
else
args = table.concat(args, ' ')
local playerName = GetRealPlayerName(playerId)
TriggerClientEvent('chat:addMessage', -1, {args = {_U('twt_prefix', playerName), args}, color = {0, 153, 204}})
end
end, false)
RegisterCommand('anontwt', function(playerId, args, rawCommand)
if playerId == 0 then
print('esx_rpchat: you can\'t use this command from console!')
else
args = table.concat(args, ' ')
local playerName = GetRealPlayerName(playerId)
TriggerClientEvent('chat:addMessage', -1, {args = {_U('twt_prefix', "Anonymous"), args}, color = {0, 153, 204}})
end
end, false)
RegisterCommand('me', function(playerId, args, rawCommand)
if playerId == 0 then
print('esx_rpchat: you can\'t use this command from console!')
@@ -29,7 +42,7 @@ RegisterCommand('me', function(playerId, args, rawCommand)
args = table.concat(args, ' ')
local playerName = GetRealPlayerName(playerId)
TriggerClientEvent('esx_rpchat:sendProximityMessage', -1, source, _U('me_prefix', playerName), args, {255, 0, 0})
TriggerClientEvent('esx_rpchat:sendProximityMessage', -1, playerId, _U('me_prefix', playerName), args, {255, 0, 0})
end
end, false)
@@ -40,7 +53,7 @@ RegisterCommand('do', function(playerId, args, rawCommand)
args = table.concat(args, ' ')
local playerName = GetRealPlayerName(playerId)
TriggerClientEvent('esx_rpchat:sendProximityMessage', -1, source, _U('do_prefix', playerName), args, {0, 0, 255})
TriggerClientEvent('esx_rpchat:sendProximityMessage', -1, playerId, _U('do_prefix', playerName), args, {0, 0, 255})
end
end, false)