Sign in to follow this  
SammyD86

Login Missing on other clients

Recommended Posts

 

I have a login script taken from the resources, but only when I connect the login window appears, any other connect it does not appear. What can this be?

I use the C# Brigde.

I hope someone can help me.

 

 

This is from the Ressouces Main C#:

 [ServerEvent(Event.PlayerConnected)]
        public void Event_PlayerConnected(Client player)
        {
            
                player.SendChatMessage("Welcome to server");
            NAPI.Player.FreezePlayer(player, true);
            NAPI.ClientEvent.TriggerClientEvent(player, "LoginScreen");
                Console.WriteLine($"Player Connected:{player.Name}");
            
            
      
            
        }

this is the Client C#

public class html : Events.Script
    {

        RAGE.Ui.HtmlWindow CEF = null;
        public html()
        {
            Events.Add("LoginScreen", LoginScreen);// ANMELDUNG EVENT ZUM LEITEN VOM SERVER ZUM CLIENTEN (DURCHLEITUNG)
            RAGE.Events.Add("login", TryLogin); //ANMELDUNG DES SCRITPS VOM JAVASCRIPT (DURCHLEITUNG)
            RAGE.Chat.Activate(false);
        }
        public void LoginScreen(object[] args)
        {
            CEF = new RAGE.Ui.HtmlWindow("package://html/index.html")
            {
                Active = true //LEITET UND AKTIVIERT CEF LOGINSEITE
            };
            RAGE.Ui.Cursor.Visible = true;
        }
        public void TryLogin(object[] args)
        {
            
            RAGE.Events.CallRemote("CMD_Login2", args); // LEITET AN DAS CMD_LOGIN2 im SERVER WEITER
            CEF.Destroy();
            RAGE.Chat.Activate(true);
            RAGE.Ui.Cursor.Visible = false;
        }

       
        
    }

and this is the html and js file:

<!DOCTYPE html>
<html>

<head>
  <link rel="stylesheet" href="./assets/css/style.css">
  <script src="./assets/js/jquery.js"></script>
</head>

<body>

<div class="form loginForm hidden">
  <div class="header">
      <div class="title">Authentication</div>
      <svg class="close" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" version="1.1">
	<g id="surface1">
	<path style d="M 7.71875 6.28125 L 6.28125 7.71875 L 23.5625 25 L 6.28125 42.28125 L 7.71875 43.71875 L 25 26.4375 L 42.28125 43.71875 L 43.71875 42.28125 L 26.4375 25 L 43.71875 7.71875 L 42.28125 6.28125 L 25 23.5625 Z "></path>
	</g>
	</svg>
  </div>
  <div class="content">
      <label>Username</label>
      <input type="text" autofocus></input>
      <label>Password</label>
      <input type="password"></input>
      <button class="button-login">Login</button>
  </div>
</div>
<script src="./assets/js/script.js"></script>
<script src="index.js"></script>
</body>

</html>
$(() => {
	$('.loginForm').removeClass('hidden')
	
	$('.loginForm button').click(() => {
		let username = $('.loginForm input[type=text]').val()
		let password = $('.loginForm input[type=password]').val()
		mp.trigger("login", username, password);
		
		$('.loginForm').addClass('hidden');
	});
	
	$('.loginForm .close').click(() => $('.loginForm').addClass('hidden')); // this close button is currently hidden you can edit that inside the css
})

 

Share this post


Link to post
Share on other sites

It can be deleted. Problematisch was that the other clients dont have the textfile for enable clientside c#. 

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.