Jeromson 0 Posted September 20, 2018 (edited) Hello, i have a problem to pass a variable from server side to client side with the funtion events call : Server side mp.events.add('playerJoin', player => { console.log(`[GTARAGE]: Joueur ${player.socialClub} - IP :[${player.ip}] a rejoint le serveur.`); if(player.socialClub) == true){ console.log(`[GTARAGE]: Joueur ${player.socialClub} trouvé dans la collection.`); player.call(`LoginWindow`, player.socialClub); } else { console.log(`[GTARAGE]: Joueur ${player.socialClub} inconnu.`); player.call(`RegisterWindow`, player.socialClub); }; player.model = mp.joaat('player_zero'); player.spawn(new mp.Vector3(-425.517, 1123.620, 325.8544)); }); Client side : var BrowserRegisterWindow = mp.browsers.new('package://gtarage/ui/accountRegister.html'); mp.events.add({'RegisterWindow': (player, player.socialClub) => { // Create register window BrowserRegisterWindow.execute("updateSocialName("+player+","+player.socialClub+");"); } }); In HTML : <script> function updateSocialName(player) { let socialname = "player.socialClub"; document.getElementById("socialName").innerText = "player.socialClub"; }; </script> I want get player social Club in browser, Can you help me pls ? Edited September 20, 2018 by Jeromson Share this post Link to post Share on other sites
Robson 2 Posted September 20, 2018 I think this may solve your problem https://wiki.rage.mp/index.php?title=Player::call player.call(`RegisterWindow`, [player.socialClub]); not sure but I think you can't do this mp.events.add({'RegisterWindow': (player, player.socialClub) => { do it like this mp.events.add({'RegisterWindow': (player, socialClubID) => { Share this post Link to post Share on other sites
Jeromson 0 Posted September 20, 2018 Oh thanks you 🙂 Share this post Link to post Share on other sites
Larvell 2 Posted September 21, 2018 vor 21 Stunden schrieb Jeromson: BrowserRegisterWindow.execute("updateSocialName("+player+","+player.socialClub+");"); This syntax works the best for us: BrowserRegisterWindow.execute(`updateSocialName(${player},${player.socialClub});`); Share this post Link to post Share on other sites
Jeromson 0 Posted September 22, 2018 (edited) Yes, thanks. My function was useless lol, finaly i use this : BrowserRegisterWindow.execute(`document.getElementById('socialClub').innerHTML = '${socialClubID}';`); Edited September 22, 2018 by Jeromson Share this post Link to post Share on other sites