Jump to content

[C#] CEF not showing


Kopra

Recommended Posts

If someone can tell me why this isn't working, all the other CEFs work, just this one doesn't. It all compiles withour error and when i use /testnotif it sends me a message but does not show CEF. 

Im using this resource:

 

Clientside:

class Notification : Events.Script
    {
        RAGE.Ui.HtmlWindow NotificationCEF = null;
        
        public Notification()
        {
            NotificationCEF = new RAGE.Ui.HtmlWindow("package://cs_packages/CEF/popup/popup.html");

            Events.Add("Show_Notif_CEF", ShowNotificationPopup);
            ShowCEF(false);
        }

        public void ShowNotificationPopup(object[] args)
        {
            ShowCEF((bool)args[0], (string)args[1]);
        }

        public void ShowCEF(bool show, string text = "")
        {
             if(show)
			{
				NotificationCEF.ExecuteJs($"ProvideInfo({text})");
			}
            NotificationCEF.Active = show;
        }
    }

Test command:

[Command("testnotif")]
        public void CMD_testnotif(Player player)
        {
            NAPI.ClientEvent.TriggerClientEvent(player, "Show_Notif_CEF", true, "Test");
            player.SendChatMessage("Notification test");
        }

 

Edited by Kopra
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...