Jump to content

[HELP] Client Trigger expected element got string...


..:D&G:..

Recommended Posts

Hello guys, I am making a script which will create some notification bars on the screen, and I want to use that script in server and in client side. I got this in server side:

function showBarNoti(thePlayer, message) --Server-side 
    triggerClientEvent("onClientNotiShow", thePlayer, message) 
end 

And here is the function with onClientNotiShow:

function showNotificationBar(message) 
    if not (message and type(message) == "string") then error("Bad argument @ 'showNotificationBar' [Expected player at argument 1, got "..type(message).."]") return false end 
    return table.insert(lisrMSG, {message, getTickCount()}) 
end 
addEvent("onClientNotiShow",true) 
addEventHandler("onClientNotiShow", root, showNotificationBar) 

I tried triggerClientEvent(thePlayer, "onClientNotiShow", thePlayer, message) but it still says that an element is expected at argument 2 but got a string. I use this in another script: exports.notif:showBarNoti("#ff0000This is a notification test") it still says: bad argument @ 'triggerClientEvent' [Expected element at argument 2, got string "#ff0000This is a notification test"].

Any ideas?

Link to comment

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