Fixed voice icon is now only been showed when loggedin

This commit is contained in:
Zeuto
2019-05-01 19:58:31 +02:00
parent 2d623ab6df
commit f799ce1e0b
3 changed files with 14 additions and 12 deletions

View File

@@ -4,7 +4,7 @@
* @copyright (c) 2008 - 2019 Life of German
*/
export default function voice() {
export default function voice(globalData: GlobalData) {
let dictLoaded = false;
const Use3d = true;
@@ -24,17 +24,19 @@ export default function voice() {
mp.events.add('render', () => {
if (!dictLoaded) {
mp.game.graphics.requestStreamedTextureDict("voiceimages", true);
dictLoaded = true;
}
if (globalData.LoggedIn) {
if (!dictLoaded) {
mp.game.graphics.requestStreamedTextureDict("voiceimages", true);
dictLoaded = true;
}
var { x, y } = mp.game.graphics.getScreenActiveResolution(0, 0);
var { x, y } = mp.game.graphics.getScreenActiveResolution(0, 0);
if (!mp.voiceChat.muted) {
mp.game.graphics.drawSprite("voiceimages", "microphone-black-shape", 0.165, 0.952, 0.015, 0.015 * (x / y), 0, 0, 102, 0, 255);
} else {
mp.game.graphics.drawSprite("voiceimages", "microphone-off", 0.165, 0.952, 0.015, 0.015 * (x / y), 0, 255, 51, 51, 255);
if (!mp.voiceChat.muted) {
mp.game.graphics.drawSprite("voiceimages", "microphone-black-shape", 0.165, 0.952, 0.015, 0.015 * (x / y), 0, 0, 102, 0, 255);
} else {
mp.game.graphics.drawSprite("voiceimages", "microphone-off", 0.165, 0.952, 0.015, 0.015 * (x / y), 0, 255, 51, 51, 255);
}
}
})

View File

@@ -9,11 +9,11 @@ let globalData: GlobalData = {
HideGui: false,
Interaction: false,
InChat: false,
LoggedIn = false
LoggedIn: false
};
import voice from './Voice/main';
voice();
voice(globalData);
import handMoney from './Gui/handmoney'
handMoney();