Tomas Posted January 30, 2014 Posted January 30, 2014 Holis, otra vez yo molestando e,e Estaba creando un panel que hace que al presionar un botón segun cual presiones se crea una Puerta o Gate del Map. Quiero agregar un botón que haga que se eliminen todas, pues podría hacerlo con una tabla, pero me da paja meter todo dentro .-. Así que es mejor que al presionar "Eliminar todos los objetos" se reinicie el resource del panel. Y nose que poner en la function de ese botón :v Si quieren me explican lo de las tablas o me dan el código directo Currently developing for International Gaming Community - Join us!
BorderLine Posted January 30, 2014 Posted January 30, 2014 https://wiki.multitheftauto.com/wiki/RestartResource y triggers, porq esto es solo serverside aah y no olvides darle derechos de admin Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
Cocodrilo Posted January 30, 2014 Posted January 30, 2014 (edited) client GUIEditor = { button = {}, window = {}, memo = {}, } PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) guiWindowSetSizable(PanelObjetosMapa, false) guiSetVisible(PanelObjetosMapa,false) Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) guiSetFont(Close, "sa-header") guiSetProperty(Close, "NormalTextColour", "C8E70000") BORRAR = guiCreateButton(352, 309, 99, 35, "borrar", false, PanelObjetosMapa) guiSetFont(BORRAR, "sa-header") guiSetProperty(BORRAR, "NormalTextColour", "C8E70000") --GUIEditor.button[1] = guiCreateButton(-451, -44, 51, 15, "", false, Close) Gate1V = guiCreateButton(10, 50, 70, 27, "Gate1", false, PanelObjetosMapa) Gate8V = guiCreateButton(10, 271, 70, 27, "Gate7", false, PanelObjetosMapa) Gate2V = guiCreateButton(10, 98, 70, 27, "Gate2", false, PanelObjetosMapa) Gate9V = guiCreateButton(10, 317, 70, 27, "Gate8", false, PanelObjetosMapa) Gate3V = guiCreateButton(10, 141, 70, 27, "Gate4", false, PanelObjetosMapa) Gate6V = guiCreateButton(10, 225, 70, 27, "Gate6", false, PanelObjetosMapa) Gate4V = guiCreateButton(10, 184, 70, 27, "Gate5", false, PanelObjetosMapa) Memo = guiCreateMemo(9, 23, 560, 27, "Al hacer click en cada boton aparecera un objeto diferente. ", false, PanelObjetosMapa) guiMemoSetReadOnly(Memo, true) addCommandHandler ( "panel", function () local value = guiGetVisible(PanelObjetosMapa) guiSetVisible(PanelObjetosMapa,not value) showCursor (not value) end) addEventHandler("onClientGUIClick", Gate1V , function () triggerServerEvent ( "crearGate1V", getLocalPlayer() ) end) addEventHandler("onClientGUIClick", Close , function () guiSetVisible (PanelObjetosMapa,false) showCursor(false) end) addEventHandler("onClientGUIClick", BORRAR , function() triggerServerEvent ( "borrarTodo", getLocalPlayer() ) guiSetVisible (PanelObjetosMapa,false) showCursor(false) end) server todoslosobjetos = {} addEvent( "crearGate1V", true ) addEventHandler( "crearGate1V", getRootElement(), function () local x, y, z = getElementPosition (source) objeto = createObject (976, x + 0.1, y + 0.1, z, 0, 0, 0) if (objeto) then outputChatBox ( "Objeto creado", source, 0, 255, 0) table.insert(todoslosobjetos, objeto) end end) addEvent( "borrarTodo", true ) addEventHandler( "borrarTodo", getRootElement(), function() for i, v in ipairs ( todoslosobjetos ) do if ( isElement(v) ) then destroyElement(v) outputChatBox ( "Todos los objetos han sido borrados", source, 0, 255, 0) end end end) Edited January 30, 2014 by Guest
Tomas Posted January 30, 2014 Author Posted January 30, 2014 https://wiki.multitheftauto.com/wiki/RestartResourcey triggers, porq esto es solo serverside aah y no olvides darle derechos de admin No me funcionaba eso D: Currently developing for International Gaming Community - Join us!
Tomas Posted January 30, 2014 Author Posted January 30, 2014 client GUIEditor = { button = {}, window = {}, memo = {}, } PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) guiWindowSetSizable(PanelObjetosMapa, false) guiSetVisible(PanelObjetosMapa,false) Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) guiSetFont(Close, "sa-header") guiSetProperty(Close, "NormalTextColour", "C8E70000") BORRAR = guiCreateButton(352, 309, 99, 35, "borrar", false, PanelObjetosMapa) guiSetFont(BORRAR, "sa-header") guiSetProperty(BORRAR, "NormalTextColour", "C8E70000") --GUIEditor.button[1] = guiCreateButton(-451, -44, 51, 15, "", false, Close) Gate1V = guiCreateButton(10, 50, 70, 27, "Gate1", false, PanelObjetosMapa) Gate8V = guiCreateButton(10, 271, 70, 27, "Gate7", false, PanelObjetosMapa) Gate2V = guiCreateButton(10, 98, 70, 27, "Gate2", false, PanelObjetosMapa) Gate9V = guiCreateButton(10, 317, 70, 27, "Gate8", false, PanelObjetosMapa) Gate3V = guiCreateButton(10, 141, 70, 27, "Gate4", false, PanelObjetosMapa) Gate6V = guiCreateButton(10, 225, 70, 27, "Gate6", false, PanelObjetosMapa) Gate4V = guiCreateButton(10, 184, 70, 27, "Gate5", false, PanelObjetosMapa) Memo = guiCreateMemo(9, 23, 560, 27, "Al hacer click en cada boton aparecera un objeto diferente. ", false, PanelObjetosMapa) guiMemoSetReadOnly(Memo, true) function abrir () if not guiGetVisible( PanelObjetosMapa ) then showCursor ( true ) guiSetVisible( PanelObjetosMapa, true ) else showCursor ( false ) guiSetVisible( PanelObjetosMapa, false ) end end addEvent("showPanel", true) addEventHandler("showPanel", getRootElement(),abrir) function funGate1V( ) triggerServerEvent ( "crearGate1V", getLocalPlayer() ) end addEventHandler("onClientGUIClick", Gate1V , funGate1V, false) function closee( ) guiSetVisible (PanelObjetosMapa,false) showCursor(false) end addEventHandler("onClientGUIClick", Close , closee, false) function delall( ) triggerServerEvent ( "borrarTodo", getLocalPlayer() ) guiSetVisible (PanelObjetosMapa,false) showCursor(false) end addEventHandler("onClientGUIClick", BORRAR , delall, false) server objetos = {} function showGUI ( playerSource) triggerClientEvent ( playerSource, "showPanel", playerSource ) end addCommandHandler ( "panel", showGUI ) function crearG1 () local x, y, z = getElementPosition ( source ) theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) if ( theObject ) then outputChatBox ( "Object created successfully", source, 0, 255, 0 ) table.insert( objetos, theObject ) else outputChatBox ( "Failed to create Object", source, 255, 0, 0) end end addEvent( "crearGate1V", true ) addEventHandler( "crearGate1V", getRootElement(), crearG1 ) function borrarT () for i, v in ipairs ( objetos ) do if ( isElement(v) ) then destroyElement(v) end end end addEvent( "borrarTodo", true ) addEventHandler( "borrarTodo", getRootElement(), borrarT ) Que capo Gracias genio Currently developing for International Gaming Community - Join us!
Cocodrilo Posted January 30, 2014 Posted January 30, 2014 Pd. Edité un poco el código para reducir lineas. De nada
Tomas Posted January 30, 2014 Author Posted January 30, 2014 (edited) client GUIEditor = { button = {}, window = {}, memo = {}, } PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) guiWindowSetSizable(PanelObjetosMapa, false) guiSetVisible(PanelObjetosMapa,false) Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) guiSetFont(Close, "sa-header") guiSetProperty(Close, "NormalTextColour", "C8E70000") BORRAR = guiCreateButton(352, 309, 99, 35, "borrar", false, PanelObjetosMapa) guiSetFont(BORRAR, "sa-header") guiSetProperty(BORRAR, "NormalTextColour", "C8E70000") --GUIEditor.button[1] = guiCreateButton(-451, -44, 51, 15, "", false, Close) Gate1V = guiCreateButton(10, 50, 70, 27, "Gate1", false, PanelObjetosMapa) Gate8V = guiCreateButton(10, 271, 70, 27, "Gate7", false, PanelObjetosMapa) Gate2V = guiCreateButton(10, 98, 70, 27, "Gate2", false, PanelObjetosMapa) Gate9V = guiCreateButton(10, 317, 70, 27, "Gate8", false, PanelObjetosMapa) Gate3V = guiCreateButton(10, 141, 70, 27, "Gate4", false, PanelObjetosMapa) Gate6V = guiCreateButton(10, 225, 70, 27, "Gate6", false, PanelObjetosMapa) Gate4V = guiCreateButton(10, 184, 70, 27, "Gate5", false, PanelObjetosMapa) Memo = guiCreateMemo(9, 23, 560, 27, "Al hacer click en cada boton aparecera un objeto diferente. ", false, PanelObjetosMapa) guiMemoSetReadOnly(Memo, true) function abrir () if not guiGetVisible( PanelObjetosMapa ) then showCursor ( true ) guiSetVisible( PanelObjetosMapa, true ) else showCursor ( false ) guiSetVisible( PanelObjetosMapa, false ) end end addEvent("showPanel", true) addEventHandler("showPanel", getRootElement(),abrir) function funGate1V( ) triggerServerEvent ( "crearGate1V", getLocalPlayer() ) end addEventHandler("onClientGUIClick", Gate1V , funGate1V, false) function closee( ) guiSetVisible (PanelObjetosMapa,false) showCursor(false) end addEventHandler("onClientGUIClick", Close , closee, false) function delall( ) triggerServerEvent ( "borrarTodo", getLocalPlayer() ) guiSetVisible (PanelObjetosMapa,false) showCursor(false) end addEventHandler("onClientGUIClick", BORRAR , delall, false) server objetos = {} function showGUI ( playerSource) triggerClientEvent ( playerSource, "showPanel", playerSource ) end addCommandHandler ( "panel", showGUI ) function crearG1 () local x, y, z = getElementPosition ( source ) theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) if ( theObject ) then outputChatBox ( "Object created successfully", source, 0, 255, 0 ) table.insert( objetos, theObject ) else outputChatBox ( "Failed to create Object", source, 255, 0, 0) end end addEvent( "crearGate1V", true ) addEventHandler( "crearGate1V", getRootElement(), crearG1 ) function borrarT () for i, v in ipairs ( objetos ) do if ( isElement(v) ) then destroyElement(v) end end end addEvent( "borrarTodo", true ) addEventHandler( "borrarTodo", getRootElement(), borrarT ) Que capo Gracias genio Vi que estaba el boton y olvide testearlo... Al apretar Borrar el panel se cierra pero no desaparece el ítem EDIT: Tu script si funciona ._. Yo copié las partes que agregaste y lo adherí al mio, porque ya había editado varias cosas Pero ahora copiaré mis cosas al tuyo e,e Gracias :* Edited January 30, 2014 by Guest Currently developing for International Gaming Community - Join us!
Tomas Posted January 30, 2014 Author Posted January 30, 2014 Joder ._. Puedes decirme osea pasarme los script pero aparte, sin el codigo entero, sino te paso mi codigo y tu los agregas, porque si pongo tus codes en mi script no funciona el boton, solo cierra el panel Currently developing for International Gaming Community - Join us!
Cocodrilo Posted January 30, 2014 Posted January 30, 2014 Joder ._.Puedes decirme osea pasarme los script pero aparte, sin el codigo entero, sino te paso mi codigo y tu los agregas, porque si pongo tus codes en mi script no funciona el boton, solo cierra el panel Revisa pm.
Tomas Posted January 30, 2014 Author Posted January 30, 2014 Post: Revisa pm. PM: Checa el post wat ._. EDIT: Ya encontre el mensaje que decía que te agregue a Facebook Tema solucionado, cuando lo termine los posteo Gracias a todos C: Currently developing for International Gaming Community - Join us!
Tomas Posted January 30, 2014 Author Posted January 30, 2014 Fin! Resource terminado Si lo quieren ver: https://community.multitheftauto.com/in ... ls&id=8636 PD: Todos los que ayudaron fueron agregados al meta y al clikear el Botón "Crédito" aparecen sus nombres, gracias Mod /lock please. Currently developing for International Gaming Community - Join us!
MTA Team 0xCiBeR Posted January 31, 2014 MTA Team Posted January 31, 2014 Topic Locked. DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp
Recommended Posts