[Release] pNotify - In-game JS Notifications Using NOTY

Can anyone help me? I can do the client side just fine, But when i try on the Server side i make this change, and when i try restart the script via the server console it says error restarting resource… What am i doing wrong?

		randomMsg = RandomMsg()
		--TriggerClientEvent("ls:sendNotification", source, notificationParam, randomMsg, 0.5)
		TriggerClientEvent("pNotify:SendNotification", source,{
            text = "Notification: <br /> You found the keys on the floor.",
            type = "success",
            timeout = (1000),
            layout = "centerRight",
            queue = "global"
        })
		table.insert(vehStorage, {plate=plate, owner=playerIdentifier, lockStatus=0, id=vehicleId})

	end
end

[EDIT] Never mind im an idiot! xD

Any plans on updating this to work with FXServer? The events appear to fire as normal but nothing is shown on-screen. Not sure if there’s been some underlying changes to FXS that restrict certain js features or what the problem might be.

Haven’t tried it on fxs yet, will look into it tonight.

1 Like

Seems to be working fine for me

RegisterNetEvent("chatMessage")
AddEventHandler("chatMessage", function(author, color, text)
    print("TEST")
    TriggerEvent("pNotify:SendNotification", {text = "TEST TEST TEST"})
end)

Update

* Moved to GitHub * Progress bar can now be disabled, couldn't before and no one ever said anything?? * Moved border from the bottom of notifications to the top * Added a few more effects / animations

open:

  • gta_effects_open_left
  • gta_effects_fade_in

close:

  • gta_effects_close_left
  • gta_effects_fade_out

I’ll be trying the update out today Nick. I never knew the progress bar couldn’t be disabled because I never tried. I actually liked to see when the bar would disappear.

I’ll let you know if I run into any issues.

What about if we wanted to replace the es_freeroam notify?

TriggerClientEvent("es_freeroam:notify", source, "CHAR_BANK_MAZE", 1, "Chase Bank", false, "Deposit: ~g~$".. rounded .." ~n~~s~New Balance: ~g~$" .. new_balance)

How could we get the new_balance inside the text ?

TriggerEvent("pNotify:SendNotification",{
            text = "Deposit: ~g~$".. rounded .." ~n~~s~New Balance: ~g~$" .. new_balance.",
            type = "success",
            timeout = (1000),
            layout = "centerRight",
            queue = "global"
        })

Not sure how I can redo the es_freeroam notify

I have never used es_freeroam but if it triggers an event to display a notification, then just edit the event handler and trigger the pNotify event in it.

It works, but the message (notif.) is spammed… Any reason why?

Don’t think I quite understand what your problem is, you need to give me more information.

It sends the message, but instead of it saying it once, theres like 5 or more of the same notification

Do you have it in a loop?

Here is what i did and you can do this with anything that creates a message.

Replace this:

TriggerClientEvent("es_freeroam:notify", source, "CHAR_SIMEON", 1, "Simeon", false, "Great choice, Now go register your vehicle at the big red P!\n")

With this:

exports.pNotify:SendNotification({text = "Great choice, Now go register your vehicle at the big red P!", type = "success", queue = "left", timeout = 4000, layout = "centerRight"})

Super simple :slight_smile:

1 Like

anything needed server side?

You don’t need anything server side.
Thanks for the sharing again, this is editable, so :sunglasses:

Uhm. For those who want make notification server side :
– In essentialMode (version 4.x) : in the server/classes/player.lua add this methode :

rTable.notify = function(ntext, ntype, nlayout, nprogress, ntimeout)
	TriggerClientEvent("pNotify:notifyFromServer", self.source , ntext, ntype, nlayout, nprogress, ntimeout)
end

– In pNotify/cl_notify.lua add this at the end for example :

RegisterNetEvent("pNotify:notifyFromServer")
AddEventHandler("pNotify:notifyFromServer", function(ntext, ntype, nlayout, nprogress, ntimeout)
    TriggerEvent("pNotify:SendNotification", {text = ntext,
        layout = nlayout,
        timeout = ntimeout,
        progressBar = nprogress,
        type = ntype,
        animation = {
            open = "gta_effects_open",
            close = "gta_effects_close"
        }})
end)

And now you are able to do user.notify(ntext, ntype, nlayout, nprogress, ntimeout) from anywhere on the server since you get the user object :wink:

How could you send a notification to all connected characters?

you just take the pNotify case and put into the resources case and add that on the server.cfg or do you need to create the server.lua and the client.lua with those codes that you left?

I can’t seem to get this to work with Essentials 4, any ideas what I may possibly be doing wrong?

You seem like you know what you are doing, do you think you can help me bwah?

I have absolutely no issues using this resource in any of my scripts. It’s most likely user error on your part. EM is now on version 5.0 so it’s advisable to use that with the latest version.