Hey there, it’s me again, I’ll print all my code for my problem, but first, I’ll explain to you. I only got on the right-top screen "Prénom "- “Nom” - “Id”, not the Lua var that I pass to Js. I’m begining in Js, so please, be indulgant if it’s a lil’ mistake
Lua
RegisterNetEvent("Iphone:rgetidui") -- IL FAUT PRENDRE LE LAST ET LE FIRST NAME
AddEventHandler("Iphone:rgetidui", function(firstname, lastename, matricule)
----------PARTIE UI -----------
guiEnabled = not guiEnabled
Citizen.Trace("ON EST BIEN DANS RGETIDUI")
if guiEnabled then
SendNUIMessage({
type = "enableui",
tlastname = lastename,
tfirstname = firstname,
tid = matricule
})
else
SendNUIMessage({
type = "disableui"
})
end
end)
Js
$(document).ready(function (){
function openMain() {
$(".container").css("display", "block");
}
function closeMain() {
$(".container").css("display", "none");
}
window.addEventListener("message", function(event){
if (event.data.type == "enableui") {
$(".tlastname").text(event.data.tlastname); -- EDIT
$(".tfirstname").text(event.data.tfirstname);
$(".tid").text(event.data.tid);
openMain();
}
else if (event.data.type == "disableui") {
closeMain();
}
})
});
Html :
<head>
<meta charset="UTF-8">
<script src="jquery-3.2.1.min.js" type="text/javascript"></script>
<script src="scripts.js" type="text/javascript"></script>
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body>
<div class="container">
<img src="card.png" >
<div class="card">
<div class="txtfix">
<p class="lastname">Nom :</p>
<p class="firstname">Prénom :</p>
<p class="id">ID :</p>
</div>
<div class="txtdyna">
<p class="tlastname">LasteName</p>
<p class="tfirstname">FirstName</p>
<p class="tid">Matricule</p>
</div>
</div>
</div>
</body>
Css :
.container {
width: 350px;
height: 210px;
background: url(card.png) no-repeat center;
font-family: sans-serif;
font-size: 15px;
}
.container .card {
position: relative;
top: 95px;
left: 50px;
}
.container .card p {
font-weight: bold;
}
.container .card .txtfix {
position: absolute;
top: -16px;
left: 0;
}
.container .card .txtdyna {
text-transform: uppercase;
position: absolute;
top: -16px;
left: 85px;
}
As I said, it’s only printing on the right-top side the txtfix class… What a shame !
I’m learning js, be indulgant please
If you got docs about exange js/lua, i take with pleasure I already saw the tutorial on the fourm
Have a nice day
Thanks in advance