Skip to content

Commit

Permalink
Merge branch 'main' into remove_loop
Browse files Browse the repository at this point in the history
  • Loading branch information
TonybynMp4 authored Feb 7, 2024
2 parents 0622c70 + ba72f3c commit 0f8dbb8
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
13 changes: 13 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local radioMenu = false
local onRadio = false
local radioChannel = 0
local radioVolume = 50
local micClicks = true

local function connectToRadio(channel)
radioChannel = channel
Expand Down Expand Up @@ -158,6 +159,18 @@ RegisterNUICallback('decreaseradiochannel', function(_, cb)
cb('ok')
end)

RegisterNUICallback('toggleClicks', function(_, cb)
micClicks = not micClicks
exports['pma-voice']:setVoiceProperty("micClicks", micClicks)
qbx.playAudio({
audioName = "Off_High",
audioRef = 'MP_RADIO_SFX',
source = cache.ped
})
exports.qbx_core:Notify(locale('clicks'..(micClicks and 'On' or 'Off')), micClicks and 'success' or 'error')
cb('ok')
end)

RegisterNUICallback('poweredOff', function(_, cb)
leaveradio()
cb('ok')
Expand Down
14 changes: 14 additions & 0 deletions html/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ body {
user-select: none;
}

#toggleClicks {
position: absolute;
width: 4vh;
height: 3.5vh;
bottom: 37.5vh;
border-radius: 5px;
transition: all 0.1s linear;
left: 7.5vh;
}

#toggleClicks:hover {
background: rgba(255, 255, 255, 0.25);
}

#submit {
position: absolute;
width: 2.2vh;
Expand Down
7 changes: 7 additions & 0 deletions html/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ $(function() {

QBRadio = {}

document.getElementById('toggleClicks').addEventListener('click', function (e) {
e.preventDefault();
fetch(`https://${GetParentResourceName()}/toggleClicks`, {
method: 'POST',
});
});

$(document).on('click', '#submit', function(e){
e.preventDefault();

Expand Down
1 change: 1 addition & 0 deletions html/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<div class="radio-container">
<img src="./img/radio.png" alt="" class="radio">

<div id="toggleClicks"></div>
<div class="channel">
<input id="channel" type="number" name="channel" min="1" max="500" placeholder="1-500">
</div>
Expand Down
4 changes: 3 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
"min_volume": "The radio is already set to the lowest volume",
"max_volume": "he radio is already set to maximum volume",
"new_volume": "New volume: ",
"new_channel": "New channel: "
"new_channel": "New channel: ",
"clicksOn": "Mic clicks are now on",
"clicksOff": "Mic clicks are now off"
}
4 changes: 3 additions & 1 deletion locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
"min_volume": "Cette radio est déjà au volume minimum",
"max_volume": "Cette radio est déjà au volume maximum",
"new_volume": "Nouveau volume : ",
"new_channel": "Nouvelle fréquence : "
"new_channel": "Nouvelle fréquence : ",
"clicksOn": "Clicks radio activés",
"clicksOff": "Clicks radio désactivés"
}

0 comments on commit 0f8dbb8

Please sign in to comment.