..:D&G:.. Posted April 16, 2015 Share Posted April 16, 2015 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
TrapLord Studios™ Posted April 16, 2015 Share Posted April 16, 2015 Are you using exports? Link to comment
..:D&G:.. Posted April 16, 2015 Author Share Posted April 16, 2015 Yes as I mentioned here [quote name=..&G:..] exports.notif:showBarNoti("#ff0000This is a notification test") Link to comment
ALw7sH Posted April 16, 2015 Share Posted April 16, 2015 your function arguments is player,text but you are calling the function with just a text exports.notif:showBarNoti("#ff0000This is a notification test") should be exports.notif:showBarNoti(playerHere,"#ff0000This is a notification test") Link to comment
..:D&G:.. Posted April 16, 2015 Author Share Posted April 16, 2015 Lool, how the F didn't I notice that?! Thanks man Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now