Laysiks Posted February 24, 2015 Share Posted February 24, 2015 Hello! I've problem. My gui when im logging in is visible for all players on server. I have added addEventHandler("onPlayerLogin".. on server side and i have in this function trigger to open gui in client side but all players see this gui. How to make it visible for one player ? Link to comment
Castillo Posted February 24, 2015 Share Posted February 24, 2015 I guess that your triggerClientEvent is being triggered to everyone, rather than the player who just logged. If you don't post the code, we can't help you. Link to comment
Laysiks Posted February 24, 2015 Author Share Posted February 24, 2015 addEventHandler("onPlayerLogin",getRootElement(), function () local pl = source local acc = pl:getAccount() local login = acc:getName() local q = dbQuery(polaczenie,"SELECT rowid,* FROM postacie WHERE login=?",login) local result = dbPoll(q,-1) if #result == 0 then triggerClientEvent("otworzgui",pl) That was bit s-side Client function open () if guiGetVisible(Postac.window[1]) == false then guiSetVisible(Postac.window[1],true) showCursor(true) else guiSetVisible(Postac.window[1],false) showCursor(false) end end addEvent("otworzgui",true) addEventHandler("otworzgui",getRootElement(),open) Link to comment
Castillo Posted February 24, 2015 Share Posted February 24, 2015 triggerClientEvent("otworzgui",pl) There's your problem, you need to specify the "sendTo" argument before the event name, like this: triggerClientEvent ( pl, "otworzgui", pl ) Link to comment
Laysiks Posted February 24, 2015 Author Share Posted February 24, 2015 Oh, i forgot about that. Thank you its working good now 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