Jump to content

Help :c Trigger en GUI


Tomas

Recommended Posts

Holis otra vez.

Tengo un problema, el trigger nose que le pasa no funciona :(

Mi idea es hacer un panel en el cual al clikear un botón se cree un "object" el cual sea una puerta :P

Osea es como mapear sin el map editor e_e (Se que al 'restart' u 'stop' se borra el map)

Client:

  
GUIEditor = { 
    button = {}, 
    window = {}, 
    memo = {}, 
} 
    function Aesede() 
        PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) 
        guiWindowSetSizable(PanelObjetosMapa, false) 
  
        Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) 
        guiSetFont(Close, "sa-header") 
        guiSetProperty(Close, "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)     
    end 
     
    showCursor (true) 
    addEventHandler ("onClientGUIClick",Gate1V,Gate1VV,false) 
addCommandHandler ( "panel", Aesede ) 
  
function Gate1VV () 
    showCursor (true) 
        triggerServerEvent ( "onGreeting", getLocalPlayer)  
end 
  

Server:

  
function greetingHandler () 
   if ( thePlayer ) then 
      local x, y, z = getElementPosition ( thePlayer ) 
      local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) 
      if ( theObject ) then 
         outputConsole ( "Object created successfully", thePlayer ) 
      else 
         outputConsole ( "Failed to create Object", thePlayer ) 
      end 
   end 
end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, greetingHandler ) 
  

Link to comment
  • Administrators

Client:

  
  
GUIEditor = { 
    button = {}, 
    window = {}, 
    memo = {}, 
} 
    function Aesede() 
        PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) 
        guiWindowSetSizable(PanelObjetosMapa, false) 
  
        Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) 
        guiSetFont(Close, "sa-header") 
        guiSetProperty(Close, "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)     
    end 
    
    showCursor (true) 
    addEventHandler ("onClientGUIClick",Gate1V,Gate1VV,false) 
addCommandHandler ( "panel", Aesede ) 
  
function Gate1VV () 
    showCursor (true) 
        triggerServerEvent ( "onGreeting", localPlayer) 
end 
  

Server:

  
  
function greetingHandler () 
   if ( source ) then 
      local x, y, z = getElementPosition ( source ) 
      local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) 
      if ( theObject ) then 
         outputConsole ( "Object created successfully", source ) 
      else 
         outputConsole ( "Failed to create Object", source ) 
      end 
   end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, greetingHandler ) 
  

Link to comment
Client:
  
  
GUIEditor = { 
    button = {}, 
    window = {}, 
    memo = {}, 
} 
    function Aesede() 
        PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) 
        guiWindowSetSizable(PanelObjetosMapa, false) 
  
        Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) 
        guiSetFont(Close, "sa-header") 
        guiSetProperty(Close, "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)     
    end 
    
    showCursor (true) 
    addEventHandler ("onClientGUIClick",Gate1V,Gate1VV,false) 
addCommandHandler ( "panel", Aesede ) 
  
function Gate1VV () 
    showCursor (true) 
        triggerServerEvent ( "onGreeting", localPlayer) 
end 
  

Server:

  
  
function greetingHandler () 
   if ( source ) then 
      local x, y, z = getElementPosition ( source ) 
      local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) 
      if ( theObject ) then 
         outputConsole ( "Object created successfully", source ) 
      else 
         outputConsole ( "Failed to create Object", source ) 
      end 
   end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, greetingHandler ) 
  

Sigue sin funcionar D:

Que puede ser? :C

Link to comment

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") 
  
        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) 

Server

  
 function showGUI ( playerSource) 
    triggerClientEvent ( playerSource, "showPanel", playerSource )   
end 
addCommandHandler ( "panel", showGUI ) 
  
function crearG1 () 
local x, y, z = getElementPosition ( source ) 
local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) 
    if ( theObject ) then 
        outputChatBox ( "Object created successfully", source, 0, 255, 0 ) 
      else 
         outputChatBox ( "Failed to create Object", source, 255, 0, 0) 
    end 
end 
addEvent( "crearGate1V", true ) 
addEventHandler( "crearGate1V", getRootElement(), crearG1 ) 

Edited by Guest
Link to comment

Prueba con esto, yo no lo probé.

Client

function Aesede() 
    if not PanelObjetosMapa then 
        PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) 
        guiWindowSetSizable(PanelObjetosMapa, false) 
        Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) 
        guiSetFont(Close, "sa-header") 
        guiSetProperty(Close, "NormalTextColour", "C8E70000") 
        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)     
        addEventHandler ("onClientGUIClick",Gate1V,Gate1VV,false) 
    else 
        guiSetVisible (PanelObjetosMapa,true) 
    end 
    showCursor (true) 
end 
addCommandHandler ( "panel", Aesede ) 
  
function Gate1VV () 
    showCursor (true) 
    triggerServerEvent ( "onGreeting", getLocalPlayer()) 
end 

Server

function greetingHandler () 
   if ( source ) then 
      local x, y, z = getElementPosition ( source ) 
      local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) 
      if ( theObject ) then 
         outputChatBox ( "Object created successfully", source, 0, 255,0 ) 
      else 
         outputChatBox ( "Failed to create Object", source, 255, 0, 03 ) 
      end 
   end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, greetingHandler ) 

PD: Seguimos hablando por Facebook ._.

Link to comment
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") 
  
        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) 

Server

  
 function showGUI ( playerSource) 
    triggerClientEvent ( playerSource, "showPanel", playerSource )   
end 
addCommandHandler ( "panel", showGUI ) 
  
function crearG1 () 
local x, y, z = getElementPosition ( source ) 
local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) 
    if ( theObject ) then 
        outputConsole ( "Object created successfully", source ) 
      else 
         outputConsole ( "Failed to create Object", source ) 
    end 
end 
addEvent( "crearGate1V", true ) 
addEventHandler( "crearGate1V", getRootElement(), crearG1 ) 

I love u :3

Me funcionó, le arreglaste el bug del mouse (Ya sabía como era igual e,e) y le agregaste la funcion a Close :3

Thanks <3

Link to comment
Prueba con esto, yo no lo probé.

Client

function Aesede() 
    if not PanelObjetosMapa then 
        PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) 
        guiWindowSetSizable(PanelObjetosMapa, false) 
        Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) 
        guiSetFont(Close, "sa-header") 
        guiSetProperty(Close, "NormalTextColour", "C8E70000") 
        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)     
        addEventHandler ("onClientGUIClick",Gate1V,Gate1VV,false) 
    else 
        guiSetVisible (PanelObjetosMapa,true) 
    end 
    showCursor (true) 
end 
addCommandHandler ( "panel", Aesede ) 
  
function Gate1VV () 
    showCursor (true) 
    triggerServerEvent ( "onGreeting", getLocalPlayer()) 
end 

Server

function greetingHandler () 
   if ( source ) then 
      local x, y, z = getElementPosition ( source ) 
      local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0 ) 
      if ( theObject ) then 
         outputChatBox ( "Object created successfully", source, 0, 255,0 ) 
      else 
         outputChatBox ( "Failed to create Object", source, 255, 0, 03 ) 
      end 
   end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, greetingHandler ) 

PD: Seguimos hablando por Facebook ._.

Sergiooo D:

No me banees :c

No me abrió el panel tan si quiera :(

Igual Coco ya me lo solucionó, Kiss para todos :3

Link to comment

Client:

    PanelObjetosMapa = guiCreateWindow(124, 50, 579, 354, "Panel de objetos de mapeo ~ By: Tomasito", false) 
    guiSetVisible(PanelObjetosMapa,false) 
    guiWindowSetSizable(PanelObjetosMapa, false) 
    Close = guiCreateButton(470, 309, 99, 35, "Cerrar", false, PanelObjetosMapa) 
    guiSetFont(Close, "sa-header") 
    guiSetProperty(Close, "NormalTextColour", "C8E70000") 
    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 () 
    if guiGetVisible(PanelObjetosMapa) then 
        guiSetVisible(PanelObjetosMapa,false) 
        showCursor (false) 
    else 
        showCursor (true) 
        guiSetVisible(PanelObjetosMapa,true) 
    end 
end ) 
    
addEventHandler ("onClientGUIClick",resourceRoot,function () 
    if source == Gate1V then 
        triggerServerEvent ( "onGreeting", localPlayer) 
    elseif source == Close then 
        guiSetVisible(PanelObjetosMapa,false) 
        showCursor (false) 
    end 
end ) 

Server:

function greetingHandler () 
    local x, y, z = getElementPosition ( source ) 
    local theObject = createObject ( 976, x + 0.1, y + 0.1, z, 0, 0, 0) 
    if theObject then 
        outputConsole ( "Object created successfully", source ) 
    else 
        outputConsole ( "Failed to create Object", source ) 
    end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, greetingHandler ) 

Link to comment

Para reducir lineas, en la parte del comando, puedes remplazarlo por esto:

addCommandHandler ( "panel", function () 
        local value = guiGetVisible(PanelObjetosMapa) 
        guiSetVisible(PanelObjetosMapa,not value) 
        showCursor (not value) 
    end 
end ) 

Link to comment
Para reducir lineas, en la parte del comando, puedes remplazarlo por esto:
addCommandHandler ( "panel", function () 
        local value = guiGetVisible(PanelObjetosMapa) 
        guiSetVisible(PanelObjetosMapa,not value) 
        showCursor (not value) 
    end 
end ) 

Hecho, gracias :)

PD: Lee FB ¬¬

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...