Jump to content

variable from server-side to client-side with events call ?


Jeromson

Recommended Posts

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 by Jeromson
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...