Lucario Posted May 27, 2013 Share Posted May 27, 2013 I have a little problem with the help panel wich i will upload to the community, it start when the resource start, i need the panel start when a player log in, everything work good, but i cant make it start when a player log in. Client side: GUIEditor = { button = {}, window = {}, label = {}, memo = {} } GUIEditor.window[1] = guiCreateWindow(352, 104, 578, 546, "Panel de Ayuda Juramento", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF0000") xml = xmlLoadFile( "principal.xml" ) contents = xmlNodeGetValue( xml ) GUIEditor.memo[1] = guiCreateMemo(9, 21, 559, 346, contents, false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[1], true) GUIEditor.button[1] = guiCreateButton(168, 495, 247, 41, "Cerrar", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF0000FF") GUIEditor.label[1] = guiCreateLabel(10, 398, 558, 97, "Info Importante y Basica Que Debes Leer: Somos un Clan de Mta San Andreas Que Posee 2 \nServidores, Juramento Freeroam y Zombie Roleplay. \nHistoria: El Clan Juramento Fue Creado a Traves de un Juego Llamado Metin2, Que Posee un Grupo \nde Personas (Chicas en Este Caso) Que Eran Mas Valientes Que los Propios Guerreros Masculinos, En \nEste Caso, el Grupo Se Llamaba Juramento Blanco.", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 0, 255, 0) showCursor(true) function cerrarPanel () bindKey ( "F4", "down", abrirPanel ) guiSetVisible(GUIEditor.window[1],false) showCursor(false) end addEventHandler("onClientGUIClick",GUIEditor.button[1],cerrarPanel) function abrirPanel () bindKey ( "F4", "down", cerrarPanel ) guiSetVisible(GUIEditor.window[1],true) end addEventHandler("onPlayerLogin",getRootElement(),abrirPanel) function dxCloseMessage () dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 205, 246, 1091, 296, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 205, 244, 1091, 294, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 203, 246, 1089, 296, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 203, 244, 1089, 294, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 204, 245, 1090, 295, tocolor(0, 0, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) end function dxFunction () addEventHandler("onClientRender",root,dxCloseMessage) setTimer ( function ( ) removeEventHandler("onClientRender",root,dxCloseMessage) end,9000,1 ) end addEventHandler ("onClientGUIClick", GUIEditor.button[1], dxFunction) function dxCloseMessage2 () dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 88, 531, 1236, 570, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 88, 529, 1236, 568, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 86, 531, 1234, 570, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 86, 529, 1234, 568, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 87, 530, 1235, 569, tocolor(0, 255, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) end function dxFunction2 () addEventHandler("onClientRender",root,dxCloseMessage2) setTimer ( function ( ) removeEventHandler("onClientRender",root,dxCloseMessage2) end,9000,1 ) end addEventHandler ("onClientGUIClick", GUIEditor.button[1], dxFunction2) Link to comment
iPrestege Posted May 27, 2013 Share Posted May 27, 2013 onPlayerLogin triggerClientEvent Link to comment
Lucario Posted May 27, 2013 Author Share Posted May 27, 2013 In server side? Edit: a it server side function sorry Link to comment
Lucario Posted May 27, 2013 Author Share Posted May 27, 2013 Error: Client triggeres server side event onLoadedAtClient, but event is not added to serverside Client: GUIEditor = { button = {}, window = {}, label = {}, memo = {} } GUIEditor.window[1] = guiCreateWindow(352, 104, 578, 546, "Panel de Ayuda Juramento", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF0000") xml = xmlLoadFile( "principal.xml" ) contents = xmlNodeGetValue( xml ) GUIEditor.memo[1] = guiCreateMemo(9, 21, 559, 346, contents, false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[1], true) GUIEditor.button[1] = guiCreateButton(168, 495, 247, 41, "Cerrar", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF0000FF") GUIEditor.label[1] = guiCreateLabel(10, 398, 558, 97, "Info Importante y Basica Que Debes Leer: Somos un Clan de Mta San Andreas Que Posee 2 \nServidores, Juramento Freeroam y Zombie Roleplay. \nHistoria: El Clan Juramento Fue Creado a Traves de un Juego Llamado Metin2, Que Posee un Grupo \nde Personas (Chicas en Este Caso) Que Eran Mas Valientes Que los Propios Guerreros Masculinos, En \nEste Caso, el Grupo Se Llamaba Juramento Blanco.", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 0, 255, 0) showCursor(true) function cerrarPanel () bindKey ( "F4", "down", abrirPanel ) guiSetVisible(GUIEditor.window[1],false) showCursor(false) end addEventHandler("onClientGUIClick",GUIEditor.button[1],cerrarPanel) function abrirPanel () bindKey ( "F4", "down", cerrarPanel ) guiSetVisible(GUIEditor.window[1],true) end addEvent("PlayerLogin", true) addEventHandler("PlayerLogin",getRootElement(),abrirPanel) function dxCloseMessage () dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 205, 246, 1091, 296, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 205, 244, 1091, 294, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 203, 246, 1089, 296, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 203, 244, 1089, 294, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Esperamos que Te Hayas Leido Bien la Info y la Ayuda", 204, 245, 1090, 295, tocolor(0, 0, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) end function dxFunction () addEventHandler("onClientRender",root,dxCloseMessage) setTimer ( function ( ) removeEventHandler("onClientRender",root,dxCloseMessage) end,9000,1 ) end addEventHandler ("onClientGUIClick", GUIEditor.button[1], dxFunction) function dxCloseMessage2 () dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 88, 531, 1236, 570, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 88, 529, 1236, 568, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 86, 531, 1234, 570, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 86, 529, 1234, 568, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) dxDrawText("Cualquier Otra Duda en General No Olviden de Publicarla en el Foro", 87, 530, 1235, 569, tocolor(0, 255, 0, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) end function dxFunction2 () addEventHandler("onClientRender",root,dxCloseMessage2) setTimer ( function ( ) removeEventHandler("onClientRender",root,dxCloseMessage2) end,9000,1 ) end addEventHandler ("onClientGUIClick", GUIEditor.button[1], dxFunction2) Server side. function helpHandler () triggerClientEvent ("PlayerLogin", getRootElement()) end addEventHandler ("onPlayerLogin", getRootElement(), helpHandler) Link to comment
iPrestege Posted May 27, 2013 Share Posted May 27, 2013 triggerClientEvent (source,"PlayerLogin",source) Where's the event at client side? It's not a magic u have to add the event . Link to comment
Lucario Posted May 27, 2013 Author Share Posted May 27, 2013 addEvent("PlayerLogin", true) addEventHandler("PlayerLogin",getRootElement(),abrirPanel) Alredy added Link to comment
iPrestege Posted May 27, 2013 Share Posted May 27, 2013 What's the error ? Debugscript 3 ? Link to comment
Lucario Posted May 27, 2013 Author Share Posted May 27, 2013 Client triggeres server side event onLoadedAtClient, but event is not added to serverside Link to comment
Dealman Posted May 28, 2013 Share Posted May 28, 2013 addEvent("PlayerLogin", true) addEventHandler("PlayerLogin",getRootElement(),abrirPanel) Client triggeres server side event onLoadedAtClient, but event is not added to serverside See the problem? Client tries to trigger onLoadedAtClient, but this event does obviously not exist server-side. Though this might be because you didn't post the entire script. You have also bound F4 twice. Example(I have not tested it. Not guaranteed to work.): Client-Side: function onPlayerLoggedInShowGUI_Client_Handler() if(guiGetVisible((GUIEditor.window[1]) == false) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) else guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end addEvent("onPlayerLoggedInShowGUI_Client", true) addEventHandler("onPlayerLoggedInShowGUI_Client", getRootElement(), onPlayerLoggedInShowGUI_Client_Handler) bindKey("f4", down, onPlayerLoggedInShowGUI_Client_Handler) Server-Side: function onPlayerLoginShowGUI_Server_Handler() triggerClientEvent("onPlayerLoggedInShowGUI_Client", source) end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLoginShowGUI_Server_Handler) Link to comment
Lucario Posted May 28, 2013 Author Share Posted May 28, 2013 dont work the windows doesnt disappear when i click and when i reconnect the gui continue starting Link to comment
iPrestege Posted May 28, 2013 Share Posted May 28, 2013 That's because you never hide the gui : guiSetVisible Please use this function . Link to comment
Lucario Posted May 28, 2013 Author Share Posted May 28, 2013 Alredy have this function, please read the full topic after reply, can anyone help? Link to comment
iPrestege Posted May 28, 2013 Share Posted May 28, 2013 Already read the topic .. script but you didn't use this function to hide the gui put this code under the window : guiSetVisible(GUIEditor.window[1],false) Link to comment
iMr.Dawix~# Posted May 28, 2013 Share Posted May 28, 2013 try this.. *Client Side* function onPlayerLoggedInShowGUI_Client_Handler() if(guiGetVisible((GUIEditor.window[1]) == false) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) else guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end addEvent("onPlayerLoggedInShowGUI_Client", true) addEventHandler("onPlayerLoggedInShowGUI_Client", getRootElement(), onPlayerLoggedInShowGUI_Client_Handler) bindKey("f4","down", onPlayerLoggedInShowGUI_Client_Handler) *Server Side* function onPlayerLoginShowGUI_Server_Handler() triggerClientEvent(source,"onPlayerLoggedInShowGUI_Client", source) end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLoginShowGUI_Server_Handler) 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