Jump to content

Recommended Posts

Posted (edited)

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
Posted

The path is correct, as i stated in first post all the other CEFs work, it's just that one that does not. In the meantime i made new one myself so it's probably something about that resource.

Thanks anyway.

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