Jump to content

[SOLVED] Cannot see html screen when ingame


WaspNetwork

Recommended Posts

Hello,

 

I've been experimenting with RAGE and following a tutorial that I've found on YT. All things aside I've created everything step by step for CEF to work. The clientside script works, I get the cursor and freeze the user but cannot see the html window with my simple sample.

I've tried two html files. A simple one and one with React. Can anyone tell me why am I not seeing the HTML screen?

Also does anyone have an example on how to use react generated build files? I assume I cannot use a index.html file + .js chunks react generates on npm run build. I've seen a forum post about react but that's a bit outdated.

 

update: I have found that my LoginCEF.Active though is set to true still is false. Any suggestions would be nice!

52 minutes ago, WaspNetwork said:

Solved it.

Had referenced the wrong rage-sharp.dll on the ClientSide project.

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

Client side code:

using System;
using System.Collections.Generic;
using System.Text;
using RAGE;

namespace WaspNetwork_Client
{
    class Main: Events.Script
    {
        RAGE.Ui.HtmlWindow LoginCEF = null;
        public Main()
        {
            LoginCEF = new RAGE.Ui.HtmlWindow("packages://a.html"); // a simple html file.

            Events.Add("Login",SendLoginInfoToServer);
            Events.Add("ShowCEF", ShowLoginPage);
        }

        public void SendLoginInfoToServer(object [] args)
        {
            RAGE.Events.CallRemote("Login",(string)args[0],(string)args[1]);
        }
        public void ShowLoginPage(object [] args)
        {
            
            var a = (bool)args[0];
            LoginCEF.Active = true;
            RAGE.Ui.Cursor.Visible = a;
            Chat.Show(!a);
            RAGE.Elements.Player.LocalPlayer.FreezePosition(a);
        }
    }
}

Server side:

using GTANetworkAPI;
using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace WaspNetwork
{
    public class Main : Script
    {

        [ServerEvent(Event.PlayerConnected)]
        public void OnPlayerConnected(Player player)
        {
            NAPI.ClientEvent.TriggerClientEvent(player,"ShowCEF",true);
        }
        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStart()
        {
            // Disable server chat
            NAPI.Server.SetGlobalServerChat(false);
        }


        [RemoteEvent("Login")]
        public void Login(Player player, string username,string password)
        {
            Console.WriteLine(username,password);
        }

    }

}

 

Edited by WaspNetwork
Link to comment
Share on other sites

Did you check for clientside and CEF logs for errors? They can be found in your RAGE installation folder > clientdata, if path to CEF is not correct when you are in game it should show you Error 404: Not found in top right corner. Also, CEF's are shown by default when created, so unless you want it to be shown whole game you need to hide it on creation.

	public Main()
        {
            LoginCEF = new RAGE.Ui.HtmlWindow("packages://a.html"); // a simple html file.
	    LoginCEF.Active = false;

            Events.Add("Login",SendLoginInfoToServer);
            Events.Add("ShowCEF", ShowLoginPage);
        }

 

Edited by Kopra
Link to comment
Share on other sites

3 hours ago, Kopra said:

Did you check for clientside and CEF logs for errors? They can be found in your RAGE installation folder > clientdata, if path to CEF is not correct when you are in game it should show you Error 404: Not found in top right corner. Also, CEF's are shown by default when created, so unless you want it to be shown whole game you need to hide it on creation.




	public Main()
        {
            LoginCEF = new RAGE.Ui.HtmlWindow("packages://a.html"); // a simple html file.
	    LoginCEF.Active = false;

            Events.Add("Login",SendLoginInfoToServer);
            Events.Add("ShowCEF", ShowLoginPage);
        }

 

Thanks for the response. The code fix helped me to set the LoginCEF.Active to true but I still cannot see any html screen. Also I've checked the logs:
I'm getting errors for the lines that I've deleted long time ago.
Can it be that the client has cached my old scripts and I need to delete them somehow/somewhere? If yes, where and how?

clientside_cs.txt  logs:

C#: compiling scripts..
Unable to cast object of type 'System.Boolean' to type 'System.String'.
ServerPackage
   at WaspNetwork_Client.Main.SendLoginInfoToServer(Object[] args) in cs_packages/WaspNetwork_Client/Main.cs:line 21
C#: compiling scripts..
Unable to cast object of type 'System.Boolean' to type 'System.String'.
ServerPackage
   at WaspNetwork_Client.Main.SendLoginInfoToServer(Object[] args) in cs_packages/WaspNetwork_Client/Main.cs:line 21
Unable to cast object of type 'System.Boolean' to type 'System.String'.
ServerPackage
   at WaspNetwork_Client.Main.SendLoginInfoToServer(Object[] args) in cs_packages/WaspNetwork_Client/Main.cs:line 21
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..
C#: compiling scripts..

cef_launcher_logs.txt:

"Refreshing servers", source: rui://main/js/app.1950bf4f.js (1)

cef_game_logs.txt:

ERROR:gpu_process_transport_factory.cc(990)] Lost UI shared context.

Also,  here's what I see ingame: https://imgur.com/a/RFWZLZ2   .

Edited by WaspNetwork
Link to comment
Share on other sites

That actually happened to me too, they should have named it rage-sharp1.1.dll it would be much easier to notice since documentation is not very helpful for C#, glad you fixed it.

Also, when I work with client-side, I always delete my cache before joining back to the server, it happened to me more than once that it loads from cache and not from server, your cache is located in RAGE-MP installation folder > client_resources.

Edited by Kopra
  • Like 1
Link to comment
Share on other sites

  • WaspNetwork changed the title to [SOLVED] Cannot see html screen when ingame

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