Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
feat(config) : add config to let players hide/show the list
Browse files Browse the repository at this point in the history
  • Loading branch information
mahanmoulaei committed Apr 12, 2022
1 parent 6ecd313 commit edb5b30
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Client/Client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ end
function HideTheRadioList()
SendNUIMessage({ clearRadioList = true }) -- Clear radio listPlayersInRadio
end

if Config.LetPlayersChangeVisibilityOfRadioList then
local visibility = true
RegisterCommand(Config.RadioListVisibilityCommand,function()
visibility = not visibility
SendNUIMessage({ changeVisibility = true, visible = visibility })
end)
end
3 changes: 3 additions & 0 deletions Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Config = {}

Config.UseRPName = true

Config.LetPlayersChangeVisibilityOfRadioList = true
Config.RadioListVisibilityCommand = "radiolist" --Only works if Config.LetPlayersChangeVisibilityOfRadioList is set to true

Config.RadioChannelsWithName = {
["0"] = "Admin",
["1"] = "Police",
Expand Down
10 changes: 10 additions & 0 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

window.addEventListener("message", function(event) {
var item = event.data;



if (item.radioId != null) {
let radioListElem = document.getElementById("radio-list");
Expand Down Expand Up @@ -70,6 +72,14 @@
radioListElem.removeChild(radioListElem.firstChild);
}
}

if (item.changeVisibility) {
if (item.visible == true) {
document.getElementById("radio-list").style.display = 'block';
} else if (item.visible == false) {
document.getElementById("radio-list").style.display = 'none';
}
}
});
</script>
</head>
Expand Down

0 comments on commit edb5b30

Please sign in to comment.