Laysiks Posted February 24, 2015 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 ?
Castillo Posted February 24, 2015 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Laysiks Posted February 24, 2015 Author 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)
Castillo Posted February 24, 2015 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Laysiks Posted February 24, 2015 Author Posted February 24, 2015 Oh, i forgot about that. Thank you its working good now
Castillo Posted February 24, 2015 Posted February 24, 2015 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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