Money icon UNDEFINED - EssentialMode

Hey all,

I’m trying to help set up a server, and so far I’ve been able to muddle through most of the heavy lifting, including SQL setup, etc…

Yesterday, we installed EssentialMode and es-freeroam, and we’re getting this issue when a player makes cash on a job. Money is being properly recorded in the db, but the UI on-screen is throwing this little beauty at us;

Not only is the MoneyIcon not being rendered properly, but the UI is also not properly reading the TTF file to display the Pricedown font. I’ve checked to make sure everything is in place on the server, and I’ve double-checked the SQL db, and everything there looks good. Is there anybody that can give me an idea of what might be going on here? I’d be eternally grateful.

Thanks!

Try this

-- Settings for EssentialMode
TriggerEvent("es:setDefaultSettings", {
	moneyIcon = "$"
})

Thanks for your response!

I’ve got this so far… saw some people talking about something similar on the Discord channel.

-- Settings for EssentialMode
TriggerEvent("es:setDefaultSettings", {
    pvpEnabled = true,
    debugInformation = false,
    startingCash = 0.0,
    enableRankDecorators = true,
    moneyIcon = "C "
})

This has fixed the TTF issue, but the moneyIcon placement in the UI is still coming up UNDEFINED. Is it UNDEFINED because perhaps font file doesn’t have that character in it? I’m just spitballing, here.

Thanks!

FYI it looks like I came across something that needed to be updated in ui.html, as well. It should be pushed to the next release.

Hi AccidentalRob, please if you have the solution tell me pleaaaaaase ! :stuck_out_tongue:

EDIT : I found the problem. It’s the fuckin variable “MoneyIcon” in ui.html… Replace it by the caracter you want (for me ‘€’) and it’s over. Look at it :

<head>
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
	<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
	<script>
		function addCommas(nStr) {
			nStr += '';
			var x = nStr.split('.');
			var x1 = x[0];
			var x2 = x.length > 1 ? '.' + x[1] : '';
			var rgx = /(\d+)(\d{3})/;
			while (rgx.test(x1)) {
				x1 = x1.replace(rgx, '$1' + '<span style="margin-left: 3px; margin-right: 3px;"/>' + '$2');
			}
			return x1 + x2;
		}

		window.onload = function(e){
			// NUI Callback
			window.addEventListener('message', function(event){
				var item = event.data;

				if(item.setmoney == true)
					document.getElementById("cash").innerHTML = "<div><font style='color: rgb(0, 125, 0); font-weight: 700; margin-right: 6px;'>€</font>" + addCommas(item.money);
				if(item.addcash == true){
					$(".tiny").remove();

					var element = $("<div class='tiny'>+<font style='color: rgb(0, 125, 0); font-weight: 700; margin-right: 6px;'>€</font>"+addCommas(item.money)+"</div>")
					$("#money").append(element)

					setTimeout(function(){
						$(element).fadeOut(600, function() { $(this).remove(); })
					}, 1000)
				}
				if(item.removecash == true){
					$(".tiny").remove();
					
					var element = $("<div class='tiny'>-<font style='color: rgb(250, 0, 0); font-weight: 700; margin-right: 6px;'>€</font>"+addCommas(item.money)+"</div>")
					$("#money").append(element)

					setTimeout(function(){
						$(element).fadeOut(600, function() { $(this).remove(); })
					}, 1000)
				}
				if(item.removeStartWindow == true){
					$("#starter").remove();
				}
				if(item.setDisplay == true){
					$("#money").css('opacity', item.display)
				}
			})
		}
	</script>

	<style>
		@font-face {
			font-family: pcdown;
			src: url(pdown.ttf);
		}
		.tiny {
			font-size: 29px;
			position: absolute; right: 10;
		}
		#money {
			font-family: pcdown;
			font-size: 35px;
			color: white;
			padding: 4px;
		text-shadow:
		   -1px -1px 0 #000,
			1px -1px 0 #000,
			-1px 1px 0 #000,
			 1px 1px 0 #000;
				}

		#container {
			position: absolute;
			top: 40; right: 40;
		}
	</style>
</head>

<body>
	<div id="starter" style="font-family: 'roboto'; color: white; position: absolute; left: 20%; top: 5%; width: 60%; background: rgba(40, 40, 40, 0.8)">

	</div>
	<div id="container">
		<div id="money">

			<div id="cash"/>
		</div>
	</div>
</body>

That’s it!

Sorry Formex, I didn’t see your message until just now. I did receive an updated ui.html from the script author, and that was the change that was made. I was unsure about sharing the fix here, because I wasn’t sure if that was the only alteration they did to the HTML file.

Glad you found the fix. Hopefully others who run into the same problem can find this thread. I’ve added the .zip file of the ui.html that I received.

ui.zip (1.2 KB)

Still didn’t fix it for me! :disappointed_relieved:

Refer to the essentialmode script thread for assistance.

– Locked