How to open a PM through a Notif click in BAE 2.0

Right, so my brain has gone blank and I am having difficulties getting a custom PM to open when you click on a BAE Notif.

So, I can see in the MainModule and Essentials Code, it has this code to open something through a click:

pendNotif(adminTitle,'Click for Commands',{'Cmds'})

But, when I take this and adapt it in a plugin, it doesn’t open anything. I have tried to reference the PM, but that failed to work as well. Here is my code as of now:

	-- Example Plugin Function --
	local function pluginFunction(Args) -- keep the name of the function as "pluginFunction"
		local Player = Args[1]
		if Args[3] then
			local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
			local combinedVictims = ''
			for a,b in pairs(Victims) do
				if combinedVictims == '' then
					combinedVictims = b.Name
				else
					combinedVictims = combinedVictims..', '..b.Name
				end
			end
			
			for a,b in next,Victims do
				remoteEvent:FireClient(Player,'Notif', 'New PM', 'Click to open.',{'PM', 'Title', 'Content',true})
			end
		end
	end
	

Honestly, I don’t know where my knowledge of Notif’s have gone so if you can, please help :pray: :slight_smile:

Thanks!

I’m not sure if I’m missing some parameters, but the PM shows up when I remove the notification feature.

I still need help with this! If you are willing to help, please do.

remoteEvent:FireClient(b,'Notif','Notif Title','Notif Desc',{'Message','Popup Title', 'Popup Content'})

This is how you would typically call the Notification function.

In your request, we can see your request is malformed. You should change your code to be a little like this:

remoteEvent:FireClient(Player,'Notif', 'New PM', 'Click to open.',{'Message', 'Title', 'Content',true})

I haven’t used the main module as part of this response (I just had a look at the example plugin) so I don’t know if you can pass that trueparameter at the end but if you can please let me know later in this thread what it’s for and if you need it.

In my code, I would like a PM to appear when the notif is clicked.

The true parameter at the end is to make it so it cannot be replied to, and I have tried doing it without the ending but it doesn’t work regardless.

As you can see in this photo:

image

I used the true parameter to make it so it cannot be replied to. If I don’t use the notif feature, it just pops up.

For MainModule, you can use:

essentialsEvent:FireClient(Player,'PM',"Title",'Text', false, false)

And for a Plugin, this should work:

remoteEvent:FireClient(Player,'PM',"Title",'Text', false, false)

I hope this answers the question.

Yep, thanks! This will be added to our game :eyes:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.