Problem with my Identity Card (HTML/LUA)

I make a identity card… and the name of the player doesnt show and same for the age of the player (its genereated auto between 18 and 45 years old, but it doesnt work…) (sry for my english :stuck_out_tongue:)

My code

            <div id="playermenuidentity" data-parent="playermenu">
			    <p class="traineroption" data-action="identity nom">Name : <script type=text/lua>"GetPlayerName"</script></p>
                <p class="traineroption" data-action="identity age">Age : <script type=text/lua>"GetRandomIntInRange(18, 45)"</script></p>
            </div>
1 Like

FR : Quel est le problème exactement ?

EN : What is the problem exactly ?

<script type="text/lua">...</script> was never a thing.
what made you think such code ever existed?
you’re supposed to use SendNuiMessage from lua to get such data in html, take a look at the default chat resource for an example.

1 Like

idk I have never used the LUa with the HTML

up :confused: pls help me

and what is it ?? ( it is in essential mode)

	<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>

How do you print a command typed in-game into a HTML file ?

The equivalent of “fprintf” in C++ ?

You should store the data of players in your MySQL database, then when he relogs he will get same informations from your “Identity Card” system.

The script send a message and you take it with JS in your html page then your replace the placeholder with your data.

That easy see AJAX for exemple it’s almost the same thing.