Jump to content

Ayuda con diferentes "GUI"


JesusAliso

Recommended Posts

Posted

Buenas. Estoy creando un "Spawn" para mi servidor... y necesito una ayuda con esto :/

Gridlist:

gridlist1 = guiCreateGridList(9, 23, 176, 157, false, ventana1) 
guiGridListAddColumn(gridlist1, "Ciudad:", 0.9) 
for i = 1, 3 do 
    guiGridListAddRow(gridlist1) 
end 
gui1 = guiGridListSetItemText(gridlist1, 0, 1, "San Fierro", false, false) 
gui2 = guiGridListSetItemText(gridlist1, 1, 1, "Las Venturas", false, false) 
gui3 = guiGridListSetItemText(gridlist1, 2, 1, "Los Santos", false, false) 
  
gridlist2 = guiCreateGridList(205, 23, 176, 157, false, ventana1) 
guiGridListAddColumn(gridlist2, "Clases:", 0.9) 

Bueno, me explico. como podría hacer para que cuando seleccione que si "San Fierro" en la (gridlist1) se creen los "row" en la segunda (gridlist2).

Intente así:

addEventHandler ("onClientGUIClick", gui1, sanfierro, false) 
  
function sanfierro () 
    guiGridListSetItemText(gridlist2, 0, 1, "Civiles", false, false) 
    guiGridListSetItemText(gridlist2, 1, 1, "Agentes Especiales", false, false) 
    guiGridListSetItemText(gridlist2, 2, 1, "Criminales", false, false) 
end 

PD: Todo lo hice con el recurso "guieditor".

Posted
function sanfierro ( ) 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) 
end 
addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Gracias solid, pero me sale "Bad argument" @ 'addEventHandler' [Expected element at argument 2, got bolean] - En el addEventHandler que me pusiste arriba.

PD: Me podrias explicar por que sale ese error? - Es para aprender :fadein:

Posted

Quiere decir que "gui1" no existe, postea el codigo entero.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Solo tengo todo el spawn, creado por "guieditor" pero no tienen ninguna funcion por los momentos.

Aquí todo:

addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
GUIEditor = { 
    gridlist = {}, 
    label = {} 
} 
ventana1 = guiCreateWindow(623, 278, 391, 486, "RPG:Server | Seleccion de Clases |", false) 
guiWindowSetMovable(ventana1, false) 
guiWindowSetSizable(ventana1, false) 
guiSetAlpha(ventana1, 0.73) 
  
gridlist1 = guiCreateGridList(9, 23, 176, 157, false, ventana1) 
guiGridListAddColumn(gridlist1, "Ciudad:", 0.9) 
for i = 1, 3 do 
    guiGridListAddRow(gridlist1) 
end 
gui1 = guiGridListSetItemText(gridlist1, 0, 1, "San Fierro", false, false) 
gui2 = guiGridListSetItemText(gridlist1, 1, 1, "Las Venturas", false, false) 
gui3 = guiGridListSetItemText(gridlist1, 2, 1, "Los Santos", false, false) 
  
gridlist2 = guiCreateGridList(205, 23, 176, 157, false, ventana1) 
guiGridListAddColumn(gridlist2, "Clases:", 0.9) 
for i = 1, 3 do 
    guiGridListAddRow(gridlist2) 
end 
  
gridlist3 = guiCreateGridList(205, 190, 176, 214, false, ventana1) 
guiGridListAddColumn(gridlist3, "Personas:", 0.9) 
for i = 1, 3 do 
    guiGridListAddRow(gridlist3) 
end 
skins = guiCreateGridList(9, 190, 176, 214, false, ventana1) 
boton1 = guiCreateButton(9, 409, 35, 18, "<", false, ventana1) 
guiSetProperty(boton1, "NormalTextColour", "FFAAAAAA") 
boton2 = guiCreateButton(150, 409, 35, 18, ">", false, ventana1) 
guiSetProperty(boton2, "NormalTextColour", "FFAAAAAA") 
imagen1 = guiCreateStaticImage(204, 420, 177, 56, ":guieditor/images/examples/mtalogo.png", false, ventana1) 
  
ventana2 = guiCreateWindow(623, 176, 391, 102, "RPG:Server | Clase Informacion |", false) 
guiWindowSetSizable(ventana2, false) 
guiSetAlpha(ventana2, 0.70) 
  
memo1 = guiCreateMemo(9, 21, 372, 71, "", false, ventana2) 
guiMemoSetReadOnly(memo1, true) 
  
        showCursor (true) 
    end 
) 
  
function sanfierro () 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) 
end 
addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) 
  

Posted
addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) 

Move eso dentro de la funcion donde creas el GUI.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Mostrame donde lo pusiste.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Postea el script completo.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
GUIEditor = { 
    gridlist = {}, 
    label = {} 
} 
ventana1 = guiCreateWindow(623, 278, 391, 486, "RPG:Server | Seleccion de Clases |", false) 
guiWindowSetMovable(ventana1, false) 
guiWindowSetSizable(ventana1, false) 
guiSetAlpha(ventana1, 0.73) 
  
gridlist1 = guiCreateGridList(9, 23, 176, 157, false, ventana1) 
guiGridListAddColumn(gridlist1, "Ciudad:", 0.9) 
for i = 1, 3 do 
    guiGridListAddRow(gridlist1) 
end 
gui1 = guiGridListSetItemText(gridlist1, 0, 1, "San Fierro", false, false) 
gui2 = guiGridListSetItemText(gridlist1, 1, 1, "Las Venturas", false, false) 
gui3 = guiGridListSetItemText(gridlist1, 2, 1, "Los Santos", false, false) 
  
gridlist2 = guiCreateGridList(205, 23, 176, 157, false, ventana1) 
guiGridListAddColumn(gridlist2, "Clases:", 0.9) 
  
gridlist3 = guiCreateGridList(205, 190, 176, 214, false, ventana1) 
guiGridListAddColumn(gridlist3, "Personas:", 0.9) 
for i = 1, 3 do 
    guiGridListAddRow(gridlist3) 
end 
skins = guiCreateGridList(9, 190, 176, 214, false, ventana1) 
boton1 = guiCreateButton(9, 409, 35, 18, "<", false, ventana1) 
guiSetProperty(boton1, "NormalTextColour", "FFAAAAAA") 
boton2 = guiCreateButton(150, 409, 35, 18, ">", false, ventana1) 
guiSetProperty(boton2, "NormalTextColour", "FFAAAAAA") 
imagen1 = guiCreateStaticImage(204, 420, 177, 56, ":guieditor/images/examples/mtalogo.png", false, ventana1) 
  
ventana2 = guiCreateWindow(623, 176, 391, 102, "RPG:Server | Clase Informacion |", false) 
guiWindowSetSizable(ventana2, false) 
guiSetAlpha(ventana2, 0.70) 
  
memo1 = guiCreateMemo(9, 21, 372, 71, "", false, ventana2) 
guiMemoSetReadOnly(memo1, true) 
  
        showCursor (true) 
        --------------------------- 
    addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) 
    end 
) 
  
function sanfierro () 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) 
    guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) 
end 

Posted
Quiere decir que "gui1" no existe, postea el codigo entero.

guiGridListSetItemText devuelve un boolean, no un elemento.

State: Inactive

Posted

Sabes que al mirar el script la primera vez vi que decia "guiCreateGridList" y no "guiGridListSetItemText".

@Jesus: Cambia "gui1" en addEventHandler por "gridlist1", y luego tendras que verificar que item clickeo el jugador.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
guiGridListGetSelectedItem 
guiGridListGetItemText 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

:| ya sabia!, si no que pregunte por si no eran esas 2, por que la otravez intente utilizar esas funciones pero no logre nada. xD

EDIT: si no es de mucha molestia, me podrías enseñar?, es que te aseguro que intente y nada.

Posted
function sanfierro ( ) 
    local row, col = guiGridListGetSelectedItem ( gridlist1 ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local cityName = guiGridListGetItemText ( gridlist1, row, col ) 
        if ( cityName == "San Fierro" ) then 
            guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) 
            guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) 
            guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) 
        end 
    end 
end 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Muchas gracias castillo, pero no se crean en la otra gridlist. dice el mismo error en el "addEventHandler".

addEventHandler ( "onClientGUIClick", guiGridListSetItemText, sanfierro, false ) 

Hay lo cambie como tu dijiste.

Posted

Oh, me equivoque al escribir, perdon.

addEventHandler ( "onClientGUIClick", gridlist1, sanfierro, false ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

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