From 769dfd85c337702e7e8e6c03b97eb19364923132 Mon Sep 17 00:00:00 2001 From: Guy293 Date: Sat, 16 Mar 2019 11:02:33 +0200 Subject: [PATCH] license fixes --- .editorconfig | 9 --- README.md | 24 +++---- __resource.lua | 19 +++--- client.lua | 171 ++++++++++++++++++++++++++++++++++++++++++++++++ client/main.lua | 72 -------------------- config.lua | 2 - locales/br.lua | 6 -- locales/en.lua | 6 -- locales/fi.lua | 6 -- locales/fr.lua | 6 -- locales/pl.lua | 6 -- locales/sv.lua | 6 -- 12 files changed, 190 insertions(+), 143 deletions(-) delete mode 100644 .editorconfig create mode 100644 client.lua delete mode 100644 client/main.lua delete mode 100644 config.lua delete mode 100644 locales/br.lua delete mode 100644 locales/en.lua delete mode 100644 locales/fi.lua delete mode 100644 locales/fr.lua delete mode 100644 locales/pl.lua delete mode 100644 locales/sv.lua diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 9b42525..0000000 --- a/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -indent_size = 4 -indent_style = tab -end_of_line = crlf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true \ No newline at end of file diff --git a/README.md b/README.md index 1588f62..6b83b2c 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,28 @@ -# esx_voice -FXServer ESX Voice +# Guy293_Voice #### Description -This is a proximity voice controller script. The default control for this is `Left Shift + H` (QWERTY). +This is a proximity voice controller script. The default control for this is `Left Shift + Y` (QWERTY) to change the mode. +To view the talking range hold `Y`. +This script has diffrent modes in vehicles, police have speakers in the vehicle. #### Download -**1) Using [fvm](https://github.com/qlaffont/fvm-installer)** -``` -fvm install --save --folder=esx esx-org/esx_voice -``` -**2) Manually** -- Download https://github.com/ESX-Org/esx_voice/releases/latest +**1) Manually** +- Download https://github.com/Guy293/guy293_voice/releases - Put it in resource/[esx] directory -**3) Using Git** +**2) Using Git** ``` cd resouces -git clone https://github.com/ESX-Org/esx_voice +git clone https://github.com/Guy293/guy293_voice ``` #### Installation - -1) Add `start esx_voice` to your server.cfg +1) Add `start guy293_voice` to your server.cfg #### Credits -Original Script by [aabbfive](https://github.com/aabbfive/voicecontroller) +Original Script by [ESX-Org](https://github.com/ESX-Org/esx_voice) diff --git a/__resource.lua b/__resource.lua index d314d63..4cc0d31 100644 --- a/__resource.lua +++ b/__resource.lua @@ -1,17 +1,16 @@ +---------------------------------------------------------------- +-- Copyright © 2019 by Guy Shefer +-- Made By: Guy293 +-- GitHub: https://github.com/Guy293 +-- Fivem Forum: https://forum.fivem.net/u/guy293/ +---------------------------------------------------------------- + resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' -description 'ESX Voice Controller' +description 'Voice Controller' version '1.1.0' client_scripts { - '@es_extended/locale.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fi.lua', - 'locales/fr.lua', - 'locales/pl.lua', - 'locales/sv.lua', - 'config.lua', - 'client/main.lua' + 'client.lua' } diff --git a/client.lua b/client.lua new file mode 100644 index 0000000..f01d427 --- /dev/null +++ b/client.lua @@ -0,0 +1,171 @@ +---------------------------------------------------------------- +-- Copyright © 2019 by Guy Shefer +-- Made By: Guy293 +-- GitHub: https://github.com/Guy293 +-- Fivem Forum: https://forum.fivem.net/u/guy293/ +---------------------------------------------------------------- + + + + + +local Keys = { + ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, + ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, + ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, + ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, + ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, + ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, + ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, + ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, + ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 +} + + +local voice = {default = 20.0, shout = 50.0, whisper = 2.0, current = 0, level = nil} +local voicecar = {incar = 5.0, nexttocar = 18.0, current = 0, level = nil} +local voicepolice = {incar = 5.0, nexttocar = 18.0, speaker = 200.0, current = 0, level = nil} + +function drawLevel(r, g, b, a) + SetTextFont(4) + SetTextProportional(1) + SetTextScale(0.5, 0.5) + SetTextColour(r, g, b, a) + SetTextDropShadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + + BeginTextCommandDisplayText("STRING") + + + if IsPedInAnyPoliceVehicle(GetPlayerPed(-1)) and GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1)), -1) == GetPlayerPed(-1) then + AddTextComponentSubstringPlayerName('~y~Police mode - Voice: ~s~%s', voicepolice.level) + elseif IsPedInAnyVehicle(GetPlayerPed(-1), false) then + AddTextComponentSubstringPlayerName('~y~Car mode - Voice: ~s~%s', voicecar.level) + else + AddTextComponentSubstringPlayerName('~y~Voice: ~s~%s', voice.level) + end + EndTextCommandDisplayText(0.2, 0.867) +end + +AddEventHandler('onClientMapStart', function() + if voice.current == 0 then + NetworkSetTalkerProximity(voice.default) + elseif voice.current == 1 then + NetworkSetTalkerProximity(voice.shout) + elseif voice.current == 2 then + NetworkSetTalkerProximity(voice.whisper) + end +end) + + +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if IsControlPressed(1, Keys['Y']) then + local pos = GetEntityCoords(GetPlayerPed(-1), true) + if IsPedInAnyPoliceVehicle(GetPlayerPed(-1)) and GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1)), -1) == GetPlayerPed(-1) then + if voicepolice.current == 0 then + --DrawMarker(28,pos.x,pos.y,pos.z - 0.8, 0, 0, 0, 0, 0, 0, voicepolice.incar, voicepolice.incar, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + DrawMarker(25,pos.x,pos.y,pos.z - 0.5, 0, 0, 0, 0, 0, 0, voicepolice.incar, voicepolice.incar, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + elseif voicepolice.current == 1 then + DrawMarker(25,pos.x,pos.y,pos.z - 0.5, 0, 0, 0, 0, 0, 0, voicepolice.nexttocar, voicepolice.nexttocar, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + elseif voicepolice.current == 2 then + DrawMarker(25,pos.x,pos.y,pos.z - 0.5, 0, 0, 0, 0, 0, 0, voicepolice.speaker, voicepolice.speaker, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + end + elseif IsPedInAnyVehicle(GetPlayerPed(-1), false) then + if voicecar.current == 0 then + DrawMarker(25,pos.x,pos.y,pos.z - 0.5, 0, 0, 0, 0, 0, 0, voicecar.incar, voicecar.incar, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + elseif voicecar.current == 1 then + DrawMarker(25,pos.x,pos.y,pos.z - 0.5, 0, 0, 0, 0, 0, 0, voicecar.nexttocar, voicecar.nexttocar, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + end + else + if voice.current == 1 then + DrawMarker(25,pos.x,pos.y,pos.z - 0.95, 0, 0, 0, 0, 0, 0, voice.shout, voice.shout, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + elseif voice.current == 2 then + DrawMarker(25,pos.x,pos.y,pos.z - 0.95, 0, 0, 0, 0, 0, 0, voice.whisper, voice.whisper, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + elseif voice.current == 0 then + DrawMarker(25,pos.x,pos.y,pos.z - 0.95, 0, 0, 0, 0, 0, 0, voice.default, voice.default, 0.5, 55, 160, 205, 105, 0, true, 2, 0, 0, 0, 0) + end + end + end + end +end) + + + + + +Citizen.CreateThread(function() + while true do + Citizen.Wait(1) + if IsControlJustPressed(1, Keys['Y']) and IsControlPressed(1, Keys['LEFTSHIFT']) then + if IsPedInAnyPoliceVehicle(GetPlayerPed(-1)) and GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1)), -1) == GetPlayerPed(-1) then + voicepolice.current = (voicepolice.current + 1) % 3 + if voicepolice.current == 0 then + NetworkSetTalkerProximity(voicepolice.incar) + voicepolice.level = 'In Vehicle' + elseif voicepolice.current == 1 then + NetworkSetTalkerProximity(voicepolice.nexttocar) + voicepolice.level = 'Next To Vehicle' + elseif voicepolice.current == 2 then + NetworkSetTalkerProximity(voicepolice.speaker) + voicepolice.level = 'Speaker' + end + + elseif IsPedInAnyVehicle(GetPlayerPed(-1), false) then + voicecar.current = (voicecar.current + 1) % 2 + if voicecar.current == 0 then + NetworkSetTalkerProximity(voicecar.incar) + voicecar.level = 'In Vehicle' + elseif voicecar.current == 1 then + NetworkSetTalkerProximity(voicecar.nexttocar) + voicecar.level ='Next To Vehicle' + end + + else + voice.current = (voice.current + 1) % 3 + if voice.current == 0 then + NetworkSetTalkerProximity(voice.default) + voice.level = 'normal' + elseif voice.current == 1 then + NetworkSetTalkerProximity(voice.shout) + voice.level = 'shout' + elseif voice.current == 2 then + NetworkSetTalkerProximity(voice.whisper) + voice.level = 'whisper' + end + + end + end + + if voice.current == 0 then + voice.level = 'normal' + elseif voice.current == 1 then + voice.level = 'shout' + elseif voice.current == 2 then + voice.level = 'whisper' + end + + if voicecar.current == 0 then + voicecar.level = 'In Vehicle' + elseif voicecar.current == 1 then + voicecar.level = 'Next To Vehicle' + end + + if voicepolice.current == 0 then + voicepolice.level = 'In Vehicle' + elseif voicepolice.current == 1 then + voicepolice.level = 'Next To Vehicle' + elseif voicepolice.current == 2 then + voicepolice.level = 'Speaker' + end + + if NetworkIsPlayerTalking(PlayerId()) then + drawLevel(41, 128, 185, 255) + elseif not NetworkIsPlayerTalking(PlayerId()) then + drawLevel(185, 185, 185, 255) + end + end +end) diff --git a/client/main.lua b/client/main.lua deleted file mode 100644 index e079757..0000000 --- a/client/main.lua +++ /dev/null @@ -1,72 +0,0 @@ -local Keys = { - ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, - ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, - ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, - ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, - ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, - ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, - ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, - ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, - ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 -} - -local voice = {default = 5.0, shout = 12.0, whisper = 1.0, current = 0, level = nil} - -function drawLevel(r, g, b, a) - SetTextFont(4) - SetTextProportional(1) - SetTextScale(0.5, 0.5) - SetTextColour(r, g, b, a) - SetTextDropShadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - - BeginTextCommandDisplayText("STRING") - AddTextComponentSubstringPlayerName(_U('voice', voice.level)) - EndTextCommandDisplayText(0.175, 0.92) -end - -AddEventHandler('onClientMapStart', function() - if voice.current == 0 then - NetworkSetTalkerProximity(voice.default) - elseif voice.current == 1 then - NetworkSetTalkerProximity(voice.shout) - elseif voice.current == 2 then - NetworkSetTalkerProximity(voice.whisper) - end -end) - -Citizen.CreateThread(function() - while true do - Citizen.Wait(1) - - if IsControlJustPressed(1, Keys['H']) and IsControlPressed(1, Keys['LEFTSHIFT']) then - voice.current = (voice.current + 1) % 3 - if voice.current == 0 then - NetworkSetTalkerProximity(voice.default) - voice.level = _U('normal') - elseif voice.current == 1 then - NetworkSetTalkerProximity(voice.shout) - voice.level = _U('shout') - elseif voice.current == 2 then - NetworkSetTalkerProximity(voice.whisper) - voice.level = _U('whisper') - end - end - - if voice.current == 0 then - voice.level = _U('normal') - elseif voice.current == 1 then - voice.level = _U('shout') - elseif voice.current == 2 then - voice.level = _U('whisper') - end - - if NetworkIsPlayerTalking(PlayerId()) then - drawLevel(41, 128, 185, 255) - elseif not NetworkIsPlayerTalking(PlayerId()) then - drawLevel(185, 185, 185, 255) - end - end -end) diff --git a/config.lua b/config.lua deleted file mode 100644 index ad83260..0000000 --- a/config.lua +++ /dev/null @@ -1,2 +0,0 @@ -Config = {} -Config.Locale = 'en' \ No newline at end of file diff --git a/locales/br.lua b/locales/br.lua deleted file mode 100644 index 207f311..0000000 --- a/locales/br.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales ['br'] = { - ['voice'] = '~y~Voz: ~s~%s', - ['normal'] = 'normal', - ['shout'] = 'gritar', - ['whisper'] = 'sussurro', -} diff --git a/locales/en.lua b/locales/en.lua deleted file mode 100644 index 6b7fc11..0000000 --- a/locales/en.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales ['en'] = { - ['voice'] = '~y~Voice: ~s~%s', - ['normal'] = 'normal', - ['shout'] = 'shout', - ['whisper'] = 'whisper', -} diff --git a/locales/fi.lua b/locales/fi.lua deleted file mode 100644 index 7550b28..0000000 --- a/locales/fi.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales ['fi'] = { - ['voice'] = '~y~Puhe: ~s~%s', - ['normal'] = 'normaali', - ['shout'] = 'huuto', - ['whisper'] = 'kuiskaus', -} diff --git a/locales/fr.lua b/locales/fr.lua deleted file mode 100644 index 3920a16..0000000 --- a/locales/fr.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales ['fr'] = { - ['voice'] = '~y~Voix: ~s~%s', - ['normal'] = 'normal', - ['shout'] = 'crier', - ['whisper'] = 'chuchoter', -} diff --git a/locales/pl.lua b/locales/pl.lua deleted file mode 100644 index 7962786..0000000 --- a/locales/pl.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales ['pl'] = { - ['voice'] = '~y~Głos: ~s~%s', - ['normal'] = 'normalny', - ['shout'] = 'krzyk', - ['whisper'] = 'szept', -} diff --git a/locales/sv.lua b/locales/sv.lua deleted file mode 100644 index c5c716e..0000000 --- a/locales/sv.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales ['sv'] = { - ['voice'] = '~y~Röst: ~s~%s', - ['normal'] = 'prata', - ['shout'] = 'skrik', - ['whisper'] = 'viska', -}