Hunter567T Posted September 3, 2010 Posted September 3, 2010 I am trying to make a panel that appears when a player connects to a server. But when someone connects it is not appearing.. Code: Client local resX, resY = guiGetScreenSize() function createGUI(thePlayer) cWindow = guiCreateWindow((resX/2)-315,(resY/2)-100,629,200,"Welcome Panel By Hunter567T",false) message = guiCreateButton(0,0.1,2, 0.9,"............",true,cWindow) close = guiCreateButton(0.4,0.825,0.213,0.1,"Close",true,cWindow) addEventHandler("onClientGUIClick", close, closeCgui, false) guiSetVisible (cWindow, false) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),createGUI) function openGUI(thePlayer) if (cWindow ~= nil) then guiSetVisible(cWindow, true) showCursor(true) end end addEvent("makeGUI", true) addEventHandler("makeGUI", getLocalPlayer(), openGUI) function closeCgui() guiSetVisible (cWindow, false) showCursor(false) end Server function GUIness(source) triggerClientEvent(source, "makeGUI", root) end addEvent("onPlayerJoin", true ) addEventHandler("onPlayerJoin", GUIness)
Callum Posted September 3, 2010 Posted September 3, 2010 In the server-side instead of addEvent and then addEventHandler you should have; addEventHandler("onPlayerJoin",getRootElement(),GUIness)
dzek (varez) Posted September 3, 2010 Posted September 3, 2010 triggering client event from server side on onPlayerJoin event will fail - players join imediately, but need to download and start resources - which takes time. Why don't you just show gui from clientside? ( onClientResourceStart attached to getResourceRootElement(getThisResource()) )
50p Posted September 3, 2010 Posted September 3, 2010 triggering client event from server side on onPlayerJoin event will fail - players join imediately, but need to download and start resources - which takes time.Why don't you just show gui from clientside? ( onClientResourceStart attached to getResourceRootElement(getThisResource()) ) That's what he's doing but for some reason he hides it just after creating it...
dzek (varez) Posted September 3, 2010 Posted September 3, 2010 oh, tbh, i just checked his 2nd script (server side).. so well, im confused.. but at least 1st part of my previous post - its true ;p
Hunter567T Posted September 4, 2010 Author Posted September 4, 2010 triggering client event from server side on onPlayerJoin event will fail - players join imediately, but need to download and start resources - which takes time.Why don't you just show gui from clientside? ( onClientResourceStart attached to getResourceRootElement(getThisResource()) ) Everything fromt the client is there only thing i removed is the text in the message ( "..........." ) im confused as well now.. Also would onPlayerLogin instead of onPlayerJoin help?
dzek (varez) Posted September 4, 2010 Posted September 4, 2010 just remove guiSetVisible (cWindow, false) from client, and remove whole server-side - you dont need it! onPlayerLogin COULD help you, but afaik its possible to login before all resources are downloaded (via console) - so its not reliable..
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