[HELP] resolved :)

I would like to put the jobs below money but his does not display :confused:

PS: I want to show the jobs of the addon loadout

sdf is my job

My code:

<head>
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
	<link href="https://afeld.github.io/emoji-css/emoji.css" rel="stylesheet">
	<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(LOADOUTS == sdf) then {
					$(".tiny").remove();

					var element = $("<div class='tiny'>+<font style='color: rgb(0, 125, 0); font-weight: 700; margin-right: 6px;'><i class="em em-tractor"></i></font>"+addCommas(LOADOUTS, sdf)+"</div>")
					$("#sdf").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;
		#sdf {
			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>
2 Likes

up :stuck_out_tongue: nobody know how to make this ???

Try the following:

Edit ā€œessentialmode/ui.htmlā€ with the following:

  • Add the code below to the javascript:
if(item.setJob == true){
  document.getElementById("job").innerHTML = "<font style='color: #FFFFFF; font-weight: 400;'>Job:</font> " + item.job;
}
  • Add <div id="job"></div> below the ā€œmoneyā€ div tags.

Edit ā€œessentialmode/client/main.luaā€

  • Add the following coode at the bottom of the file
RegisterNetEvent("es:setJobDisplay")
AddEventHandler("es:setJobDisplay", function(name)
	SendNUIMessage({
		setJob = true,
		job = name
	})
end)

Edit ā€œfivem-loadouts/loadout/server.luaā€

  • Add TriggerClientEvent("es:setJobDisplay", player, loadout.name) to the end of the ā€œdoLoadoutā€ event.

et voila!

You are now displaying the job (below?) with the money.

Note: This is a hack and should probably be put into itā€™s own addon.

Thx ur the best !

the code is good ? :stuck_out_tongue:

[details=Code]```

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' + '' + '$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;'>v</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)
			}
			if(item.setJob == true){
				document.getElementById("job").innerHTML = "<font style='color: #FFFFFF; font-weight: 400;'>MĆ©tiers:</font> " + item.job;
			}
		})
	}
</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>
</div>
<div id="container">
	<div id="money">

		<div id="cash"/>
		<div id="job"></div>
	</div>
</div>
```[/details]

Should be

<div id="money">
     <div id="cash"/>
</div>
<div id="job"></div>

I have this error in the consoleā€¦

ok its my fault i have resolved the error but i have an other error

and at the line 49 i have: TriggerClientEvent(ā€œes:setJobDisplayā€, player, loadout.name)

its good: D i have resolve the error :smiley:

Ok now i have a question it is possible to make a menu for choose a jobā€¦ The menu open with a marker at a specific position :slight_smile:

Bonjour ,jā€™ai modifier les fichier comme vous aviez dit mais jā€™ai un decalage au niveau de lā€™affichage et en nom de metier sa me mais ā€œRANDOMā€ pouvez vous maider sā€™il vous plait .
je vous mais les fichier que jā€™ai modifier pour que vous voyer ou se trouve mon erreur.

Hello, I have modified the files as you said but I have a shift in the display and in the name of metier its me but ā€œRANDOMā€ can please you please.
I you but the file I have modified so that you see or find my error.

ui.html (2.7 KB)
main.lua (2.5 KB)
server.lua (8.1 KB)

voila comment lā€™affichage se mais sur mon serveur.

Here is how the display happens but on my server.

Merci dā€™avance

thank you in advance

I have the same, do you know how can we fix it?