Jump to content

[HELP] CEF (html file) shows up in the game for no reason, and the mouse cursor doesn't show at all. Please help me


Recommended Posts

Posted (edited)

So I followed this tutorial:

Now I am NOT calling the login.html to be shown in the game, and it still GETS SHOWN, idk how. Also I created a function where I do /login to make this pop up, so I added this line of code in the /login function:

NAPI.ClientEvent.TriggerClientEvent(player, "ShowLoginCEF", true);

public void ShowLoginPage(object [] args)
        {
            bool flag = (bool)args[0];
            //This shows the Login.html page
            LoginCEF.Active = flag;
            RAGE.Ui.Cursor.Visible = flag;
            Chat.Show(!flag);
            RAGE.Elements.Player.LocalPlayer.FreezePosition(flag);
        }

and it does not show the mouse cursor.

Shortly said I have 5 problems.

1st one is, that the login.html gets shown automatically without my will.

2nd problem is when I want to show it over this code

[ServerEvent(Event.PlayerConnected)]
        public void OnPlayerConnected(Player player)
        {
            //Loading the CEF on the clients pc
            //Launching the Login event
            NAPI.ClientEvent.TriggerClientEvent(player, "ShowLoginCEF", true);
        }

 

it does not freeze the player and it does not show the mouse.

3rd problem is when i try to use /login , it freezes the player, but it does not show the mouse cursor.

[Command("login")]
        public void CMD_Login(Player player)
        {
            NAPI.ClientEvent.TriggerClientEvent(player, "ShowLoginCEF", true);
        }

 

4th problem when is on player connect, the chat doesn't hide. But when i do /login, it does hide

 

5th problem: I managed to type in the password field by using the tab button, and nothing happens. The functions don't get executed.

EDIT:

 

If you're using RAGEMP 1.1 version  you must add rage-sharpN.dll and NOT rage-sharp.dll as a dependency.

I did it and still I have the page shown without my will and the mouse does not appear

Edited by NetRaider
added a reference, added extra problems
  • NetRaider changed the title to [HELP] CEF (html file) shows up in the game for no reason, and the mouse cursor doesn't show at all. Please help me
Posted (edited)
13 hours ago, WarstekHUN said:

Hi! Does the chat disappear?

On player Connect it DOES NOT hide the chat,

[ServerEvent(Event.PlayerConnected)]

but when I use /login, it DOES hide the chat

Edited by NetRaider
Posted

Try this, @NetRaider:
 

using System;
using RAGE;

namespace ClientLoginNamespace
{
  public class Phone : Events.Script
    {
      RAGE.Ui.HtmlWindow LoginCEF = null;

      	public Phone()
        {
          Events.Add("ShowLoginCEF", ShowLoginPage);
        }
      
      public void ShowLoginPage(object[] args)
        {
            bool flag = (bool)args[0];
            if(flag == true)
            {
                RAGE.Ui.Cursor.Visible = true;
                Chat.Show(false);
                RAGE.Elements.Player.LocalPlayer.FreezePosition(true);
                LoginCEF = new RAGE.Ui.HtmlWindow("package://YOUR_HTML_FILE.HTML");
                LoginCEF.Active = true;
            }
            else
            {
                LoginCEF.Active = false;
                LoginCEF.Destroy();
                RAGE.Ui.Cursor.Visible = false;
                Chat.Show(true);
                RAGE.Elements.Player.LocalPlayer.FreezePosition(false);
            }
        }
    }
}

 

Posted (edited)

I erased my code, because I am transferring to client side javascript.

I can't check the code right now, if I fail with the client side javascript, I'll take a look at the code, but I doubt it works, I tried many things. I've ended up with the login function, it does not work.

Someone told me to transfer to client side javascript

Edited by NetRaider
Posted
2 hours ago, WarstekHUN said:

Try this, @NetRaider:
 


using System;
using RAGE;

namespace ClientLoginNamespace
{
  public class Phone : Events.Script
    {
      RAGE.Ui.HtmlWindow LoginCEF = null;

      	public Phone()
        {
          Events.Add("ShowLoginCEF", ShowLoginPage);
        }
      
      public void ShowLoginPage(object[] args)
        {
            bool flag = (bool)args[0];
            if(flag == true)
            {
                RAGE.Ui.Cursor.Visible = true;
                Chat.Show(false);
                RAGE.Elements.Player.LocalPlayer.FreezePosition(true);
                LoginCEF = new RAGE.Ui.HtmlWindow("package://YOUR_HTML_FILE.HTML");
                LoginCEF.Active = true;
            }
            else
            {
                LoginCEF.Active = false;
                LoginCEF.Destroy();
                RAGE.Ui.Cursor.Visible = false;
                Chat.Show(true);
                RAGE.Elements.Player.LocalPlayer.FreezePosition(false);
            }
        }
    }
}

 

I tried the code and it doesn't work....I am switching to javascript now.

C# client side CEF is bugged for sure

  • Confused 1
Posted

You had to declare this in Phone();

LoginCEF = new RAGE.Ui.HtmlWindow("package://YOUR_HTML_FILE.HTML");

If you don't want to see it instantly you just have to in Phone();

LoginCEF.Active = false;

Add the event in Phone();

Events.Add("ShowLoginCEF", ShowLoginPage);
public void ShowLoginPage(object[] args)
{
     bool flag = (bool)args[0];
     LoginCEF.Active = flag;
     RAGE.Ui.Cursor.Visible = flag;
     Chat.Show(!flag);
     RAGE.Elements.Player.LocalPlayer.FreezePosition(flag);
}

 

 

Posted (edited)
5 hours ago, iSeeYou. said:

You had to declare this in Phone();



LoginCEF = new RAGE.Ui.HtmlWindow("package://YOUR_HTML_FILE.HTML");

If you don't want to see it instantly you just have to in Phone();



LoginCEF.Active = false;

Add the event in Phone();



Events.Add("ShowLoginCEF", ShowLoginPage);


public void ShowLoginPage(object[] args)
{
     bool flag = (bool)args[0];
     LoginCEF.Active = flag;
     RAGE.Ui.Cursor.Visible = flag;
     Chat.Show(!flag);
     RAGE.Elements.Player.LocalPlayer.FreezePosition(flag);
}

 

 

it just doesn't work on 1.1 version for some reason

Edited by NetRaider

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