Jump to content

Pregunta GUI


iFoReX

Recommended Posts

Solid me dirias porque me dice GUIEditor_Button( a nil value ) :/

en la linea 123

cl-side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0,0.0017,0.3575,0.8917,"",true) 
GUIEditor_Grid[1] = guiCreateGridList(10,28,108,193,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
column1 = guiGridListAddColumn(GUIEditor_Grid[1],"Ciudades",0.-- s8) -->
  
row1 = guiGridListAddRow(GUIEditor_Grid[1]) 
row2 = guiGridListAddRow(GUIEditor_Grid[1]) 
row3 = guiGridListAddRow(GUIEditor_Grid[1]) 
row4 = guiGridListAddRow(GUIEditor_Grid[1]) 
  
GUIEditor_Grid[2] = guiCreateGridList(11,242,125,193,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[2],2) 
  
column2 = guiGridListAddColumn(GUIEditor_Grid[2],"Categorias",0.-- s8) -->
  
row5 = guiGridListAddRow(GUIEditor_Grid[2]) 
row6 = guiGridListAddRow(GUIEditor_Grid[2]) 
row7 = guiGridListAddRow(GUIEditor_Grid[2]) 
row8 = guiGridListAddRow(GUIEditor_Grid[2]) 
row9 = guiGridListAddRow(GUIEditor_Grid[2]) 
row10 = guiGridListAddRow(GUIEditor_Grid[2]) 
row11 = guiGridListAddRow(GUIEditor_Grid[2]) 
  
GUIEditor_Grid[3] = guiCreateGridList(146,241,131,195,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[3],2) 
  
guiGridListAddColumn(GUIEditor_Grid[3],"Personajes",0.-- s8) -->
GUIEditor_Memo[1] = guiCreateMemo(123,52,157,168,"",false,GUIEditor_Window[1]) 
guiMemoSetReadOnly(GUIEditor_Memo[1],true) 
GUIEditor_Label[1] = guiCreateLabel(160,29,72,15,"Informacion",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Button[1] = guiCreateButton(146,482,131,44,"Spawn",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(11,504,127,17,"GUI Creada por ElMota",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(17,445,35,22,"<",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(77,445,35,22,">",false,GUIEditor_Window[1]) 
GUIEditor_Edit[1] = guiCreateEdit(54,444,22,22,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
  
  
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
  
addEvent("onVisibleGUI", true) 
addEventHandler("onVisibleGUI", getLocalPlayer(),  
function() 
guiSetVisible(GUIEditor_Window[1],true) 
showCursor(true) 
triggerServerEvent("onRadarHud", getLocalPlayer()) 
end 
) 
  
addEventHandler("onClientGUIClick", root,  
function() 
if source == GUIEditor_Button[1] then 
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
setCameraTarget( localPlayer ) 
triggerServerEvent("offRadarHud", getLocalPlayer()) 
end 
end 
) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),  
function() 
guiGridListSetItemText(GUIEditor_Grid[2],row5,column2,"Policia", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[2],row6,column2,"Militar", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[2],row7,column2,"Taxista", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[2],row8,column2,"Medico", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[2],row9,column2,"Ladron", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[2],row11,column2,"Motosiclista", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[1],row1,column1,"LS", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[1],row2,column1,"LV", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[1],row3,column1,"SF", false, false) 
  
guiGridListSetItemText(GUIEditor_Grid[1],row4,column1,"Clanes Privados", false, false) 
end 
) 
  
addEventHandler( 'onClientGUIClick', guiRoot, 
    function( ) 
        if source == GUIEditor_Grid[1] then 
            nRow = guiGridListGetSelectedItem( GUIEditor_Grid[1] ) 
            if nRow ~= -1 then 
                if nRow == 0 then 
                guiSetText(GUIEditor_Memo[1], "Escoge el Spawn que quieras de LS disfrutaloo") 
                    triggerServerEvent( 'onCameraM1', localPlayer ) 
                elseif nRow == 1 then 
                guiSetText(GUIEditor_Memo[1], "Escoge el Spawn que quieras de LV disfrutaloo") 
                    triggerServerEvent( 'onCameraM2', localPlayer ) 
                elseif nRow == 2 then 
                guiSetText(GUIEditor_Memo[1], "Escoge el Spawn que quieras de SF disfrutaloo") 
                    triggerServerEvent( 'onCameraM3', localPlayer ) 
                elseif nRow == 3 then 
                guiSetText(GUIEditor_Memo[1], "Estos son Clanes Privados No entrar Si no quieres morir") 
                    triggerServerEvent( 'onCameraM4', localPlayer ) 
                end 
            end 
        end 
    end 
) 
  
addEventHandler( 'onClientGUIClick', guiRoot, 
    function( ) 
        if source == GUIEditor_Grid[1] then 
            nRow = guiGridListGetSelectedItem( GUIEditor_Grid[1] ) 
            if nRow ~= -1 then 
                if nRow == 0 and source == GUEditor_Button[1] then 
                guiSetText(GUIEditor_Memo[1], "Debes elegir algun Personaje") 
                end 
            end 
        end 
    end 
) 
  
addEventHandler( 'onClientGUIClick', guiRoot, 
    function( ) 
        if source == GUIEditor_Grid[2] then 
            nRow2 = guiGridListGetSelectedItem( GUIEditor_Grid[2] ) 
            if nRow ~= -1 and nRow2 ~= -1 then 
                if nRow == 0 and nRow2 == 0 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es defender a la Gente honesta matando a Delincuentes") 
                    triggerServerEvent( 'onCameraM5', localPlayer ) 
                elseif nRow == 0 and nRow2 == 1 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ayudar a los polis por si no puede con algo...") 
                    triggerServerEvent( 'onCameraM6', localPlayer ) 
                elseif nRow == 0 and nRow2 == 2 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ir a recoger y buscar personas que te llamen") 
                    triggerServerEvent( 'onCameraM7', localPlayer ) 
                elseif nRow == 0 and nRow2 == 3 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ir en la ambulancia y ayudar a los mas necesitados") 
                    triggerServerEvent( 'onCameraM8', localPlayer ) 
                elseif nRow == 0 and nRow2 == 4 then 
                guiSetText(GUIEditor_Memo[1], "Tienes que matar y robar a la gente cuidado con los polis") 
                    triggerServerEvent( 'onCameraM9', localPlayer ) 
                elseif nRow == 0 and nRow2 == 5 then 
                guiSetText(GUIEditor_Memo[1], "Tienes que matar y robar a la gente cuidado con los polis") 
                    triggerServerEvent( 'onCameraM10', localPlayer ) 
                elseif nRow == 1 and nRow2 == 0 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es defender a la Gente honesta matando a Delincuentes") 
                    triggerServerEvent( 'onCameraM12', localPlayer ) 
                elseif nRow == 1 and nRow2 == 1 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ayudar a los polis por si no puede con algo...") 
                    triggerServerEvent( 'onCameraM13', localPlayer ) 
                elseif nRow == 1 and nRow2 == 2 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ir a recoger y buscar personas que te llamen") 
                    triggerServerEvent( 'onCameraM14', localPlayer ) 
                elseif nRow == 1 and nRow2 == 3 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ir en la ambulancia y ayudar a los mas necesitados") 
                    triggerServerEvent( 'onCameraM15', localPlayer ) 
                elseif nRow == 1 and nRow2 == 4 then 
                guiSetText(GUIEditor_Memo[1], "Tienes que matar y robar a la gente cuidado con los polis") 
                    triggerServerEvent( 'onCameraM16', localPlayer ) 
                elseif nRow == 1 and nRow2 == 6 then 
                guiSetText(GUIEditor_Memo[1], "No ai mision solo conocer todo GTA") 
                    triggerServerEvent( 'onCameraM17', localPlayer ) 
                elseif nRow == 2 and nRow2 == 0 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es defender a la Gente honesta matando a Delincuentes") 
                    triggerServerEvent( 'onCameraM18', localPlayer ) 
                elseif nRow == 2 and nRow2 == 1 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ayudar a los polis por si no puede con algo...") 
                    triggerServerEvent( 'onCameraM19', localPlayer ) 
                elseif nRow == 2 and nRow2 == 2 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ir a recoger y buscar personas que te llamen") 
                    triggerServerEvent( 'onCameraM20', localPlayer ) 
                elseif nRow == 2 and nRow2 == 3 then 
                guiSetText(GUIEditor_Memo[1], "Tu mision es ir en la ambulancia y ayudar a los mas necesitados") 
                    triggerServerEvent( 'onCameraM21', localPlayer ) 
                elseif nRow == 2 and nRow2 == 4 then 
                guiSetText(GUIEditor_Memo[1], "Tienes que matar y robar a la gente cuidado con los polis") 
                    triggerServerEvent( 'onCameraM22', localPlayer ) 
                elseif nRow == 2 and nRow2 == 6 then 
                guiSetText(GUIEditor_Memo[1], "No ai mision solo conocer todo GTA") 
                    triggerServerEvent( 'onCameraM23', localPlayer ) 
                end 
            end 
        end 
    end 
) 
  
addEventHandler("onClientPlayerWasted", getLocalPlayer(),  
function() 
setElementHealth( localPlayer, 1607.3630371094, 1816.3391113281, 10.8203125 ) 
guiSetVisible(GUIEditor_Window[1],true) 
showCursor(true) 
end 
) 

sv-side

addEventHandler("onPlayerLogin", getRootElement(),  
function() 
triggerClientEvent(source,"onVisibleGUI", source) 
setCameraMatrix( source, 1819.5910644531, -1151.7647705078, 319.04830932617, 1640.6226806641, -1260.4881591797, 309.66555786133 ) 
end 
) 
  
addEvent("onRadarHud", true) 
addEventHandler("onRadarHud", getRootElement(),  
function() 
showPlayerHudComponent( source, "all", false ) 
showPlayerHudComponent( source, "radar", false ) 
end 
) 
  
addEvent("offRadarHud", true) 
addEventHandler("offRadarHud", getRootElement(),  
function() 
showPlayerHudComponent( source, "all", true ) 
showPlayerHudComponent( source, "radar", true ) 
end 
) 
  
addEvent("onCameraM1", true) 
addEventHandler("onCameraM1", getRootElement(),  
function() 
setCameraMatrix( source, 1819.5910644531, -1151.7647705078, 319.04830932617, 1640.6226806641, -1260.4881591797, 309.66555786133 ) 
end 
) 
  
addEvent("onCameraM2", true) 
addEventHandler("onCameraM2", getRootElement(),  
function() 
setCameraMatrix( source, 2197.7358398438, 1907.6943359375, 116.85298919678, 2033.5368652344, 1914.2219238281, 95.694976806641 ) 
end 
) 
  
addEvent("onCameraM3", true) 
addEventHandler("onCameraM3", getRootElement(),  
function() 
setCameraMatrix( source, -1723.8972167969, 645.45178222656, 106.71087646484, -1574.6323242188, 678.49249267578, 89.234420776367 ) 
end 
) 
  
addEvent("onCameraM4", true) 
addEventHandler("onCameraM4", getRootElement(),  
function() 
setCameraMatrix( source, 1307.2275390625, -1956.1489257813, 106.69087982178, 1244.3569335938, -2006.0531005859, 100.77044677734 ) 
end 
) 
  
addEvent("onCameraM5", true) 
addEventHandler("onCameraM5", getRootElement(),  
function() 
setCameraMatrix( source, 1489.2700195313, -1674.7631835938, 48.818866729736, 1534.4147949219, -1676.6840820313, 38.409862518311 ) 
end 
) 
  
addEvent("onCameraM6", true) 
addEventHandler("onCameraM6", getRootElement(),  
function() 
setCameraMatrix( source, 2269.4831542969, -2602.0422363281, 31.346845626831, 2216.7492675781, -2642.9645996094, 26.383996963501 ) 
end 
) 
  
addEvent("onCameraM7", true) 
addEventHandler("onCameraM7", getRootElement(),  
function() 
setCameraMatrix( source, 1833.7449951172, -1863.3933105469, 36.449573516846, 1803.8836669922, -1895.8463134766, 19.819082260132 ) 
end 
) 
  
addEvent("onCameraM8", true) 
addEventHandler("onCameraM8", getRootElement(),  
function() 
setCameraMatrix( source, 1989.2310791016, -1461.5875244141, 57.156158447266, 2022.7757568359, -1425.3278808594, 35.417316436768 ) 
end 
) 
  
addEvent("onCameraM9", true) 
addEventHandler("onCameraM9", getRootElement(),  
function() 
setCameraMatrix( source, 725.28448486328, -1567.3818359375, 20.134044647217, 724.00994873047, -1484.9359130859, 7.0045838356018 ) 
end 
) 
  
addEvent("onCameraM11", true) 
addEventHandler("onCameraM11", getRootElement(),  
function() 
setCameraMatrix( source, 2139.3610839844, -1143.7338867188, 53.043365478516, 2163.5920410156, -1085.1544189453, 35.222747802734 ) 
end 
) 
  
addEvent("onCameraM12", true) 
addEventHandler("onCameraM12", getRootElement(),  
function() 
setCameraMatrix( source, 2282.337890625, 2359.2702636719, 41.430618286133, 2285.5568847656, 2429.0581054688, 20.678840637207 ) 
end 
) 
  
addEvent("onCameraM13", true) 
addEventHandler("onCameraM13", getRootElement(),  
function() 
setCameraMatrix( source, 382.85028076172, 1909.0347900391, 48.472858428955, 312.72418212891, 1984.2657470703, 23.121196746826 ) 
end 
) 
  
addEvent("onCameraM14", true) 
addEventHandler("onCameraM14", getRootElement(),  
function() 
setCameraMatrix( source, 1188.3369140625, 1380.7084960938, 35.763481140137, 1135.7219238281, 1441.7491455078, 14.152088165283 ) 
end 
) 
  
addEvent("onCameraM15", true) 
addEventHandler("onCameraM15", getRootElement(),  
function() 
setCameraMatrix( source, 1684.0206298828, 1806.0145263672, 28.832441329956, 1635.9561767578, 1776.2038574219, 14.066258430481 ) 
end 
) 
  
addEvent("onCameraM16", true) 
addEventHandler("onCameraM16", getRootElement(),  
function() 
setCameraMatrix( source, 1760.5601806641, 2044.1082763672, 27.85701751709, 1760.9200439453, 2080.140625, 10.8203125 ) 
end 
) 
  
addEvent("onCameraM17", true) 
addEventHandler("onCameraM17", getRootElement(),  
function() 
setCameraMatrix( source, 2531.3706054688, 1552.0240478516, 29.986101150513, 2484.0744628906, 1527.3374023438, 19.304033279419 ) 
end 
) 
  
addEvent("onCameraM18", true) 
addEventHandler("onCameraM18", getRootElement(),  
function() 
setCameraMatrix( source, -1709.2209472656, 636.32165527344, 77.548973083496, -1663.7857666016, 681.59393310547, 52.308490753174 ) 
end 
) 
  
addEvent("onCameraM19", true) 
addEventHandler("onCameraM19", getRootElement(),  
function() 
setCameraMatrix( source, -1347.9555664063, 540.86584472656, 27.452272415161, -1347.794921875, 499.85559082031, 27.3509349823 ) 
end 
) 
  
addEvent("onCameraM20", true) 
addEventHandler("onCameraM20", getRootElement(),  
function() 
setCameraMatrix( source, -2144.5844726563, 315.23474121094, 51.089172363281, -2178.0725097656, 300.94561767578, 37.589839935303 ) 
end 
) 
  
addEvent("onCameraM21", true) 
addEventHandler("onCameraM21", getRootElement(),  
function() 
setCameraMatrix( source, -2552.1813964844, 560.20257568359, 39.71276473999, -2613.404296875, 602.13745117188, 34.302700042725 ) 
end 
) 
  
addEvent("onCameraM22", true) 
addEventHandler("onCameraM22", getRootElement(),  
function() 
setCameraMatrix( source, -2630.6501464844, -121.92417144775, 26.313898086548, -2670.5146484375, -121.52639770508, 10.799653053284 ) 
end 
) 
  
addEvent("onCameraM23", true) 
addEventHandler("onCameraM23", getRootElement(),  
function() 
setCameraMatrix( source, -2154.9206542969, -191.89019775391, 50.07958984375, -2126.4035644531, -153.1941986084, 35.3203125 ) 
end 
) 

Link to comment

ahora no me funciona esto

addEventHandler( 'onClientGUIClick', guiRoot, 
    function( ) 
        if source == GUIEditor_Grid[1] then 
            nRow = guiGridListGetSelectedItem( GUIEditor_Grid[1] ) 
            if nRow ~= -1 then 
                if nRow == 0 and source == GUIEditor_Button[1] then 
                guiSetText(GUIEditor_Memo[1], "Debes elegir algun Personaje") 
                guiSetVisible(GUIEditor_Window[1],true) 
                showCursor(true) 
                end 
            end 
        end 
    end 
) 

:/ la GUI se me desaparece al precionar el boton :/

Link to comment

Eso no tiene sentido.

addEventHandler ( 'onClientGUIClick', guiRoot, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            local row, col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
                guiSetText ( GUIEditor_Memo[1], "Debes elegir algun Personaje" ) 
                guiSetVisible ( GUIEditor_Window[1], true ) 
                showCursor ( true ) 
            end 
        end 
    end 
) 

Link to comment
  • Recently Browsing   0 members

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