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) Commander of the CIT SWAT Team.
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) Retired
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()) ) Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
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... - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
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 Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
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? Commander of the CIT SWAT Team.
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.. Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Hunter567T Posted September 4, 2010 Author Posted September 4, 2010 Thanks guys its working now. Commander of the CIT SWAT Team.
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