AlvareZ_ Posted October 31, 2014 Share Posted October 31, 2014 Hi Guys, i got this, But when i prees the button Spawn, Have a bug, ( Bad Argument @ 'guiGirdListGetSelectedItem' [Expected gui-grodlist at argument 1 got gui-button], I want to know how i can get gridlist selected and then press the botton and then spawn a player, Help me Please, Thanks Guys. Client: function monstarCamaras() row1, col1 = guiGridListGetSelectedItem ( GUIEditor.gridlist[2] ) skinName = guiGridListGetItemText ( GUIEditor.gridlist[2], row1, col1 ) triggerServerEvent ( "onPlayerChooseSkin", getLocalPlayer(), skinName ) row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= 1 and col ~= -1 ) then grid = guiGridListGetItemText ( source, row, 1 ) if ( grid == "Los Santos" ) then guiGridListClear ( GUIEditor.gridlist[2] ) rowGrupoPolice = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice, grupos, "Los Santos Down Town", false, false ) rowGrupoPolice1 = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice1, grupos, "Los Santos Aiport", false, false ) elseif ( grid == "San Fierro" ) then guiGridListClear ( GUIEditor.gridlist[2] ) rowGrupoPolice2 = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice2, grupos, "San Fierro Down Town", false, false ) rowGrupoPolice12 = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice12, grupos, "San Fierro Aiport", false, false ) elseif ( grid == "Las Venturas" ) then guiGridListClear ( GUIEditor.gridlist[2] ) rowGrupoPolice21 = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice21, grupos, "Las Venturas Down Town", false, false ) rowGrupoPolice121 = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice121, grupos, "Las Venturas Aiport", false, false ) elseif ( grid == "Other's Spawn" ) then guiGridListClear ( GUIEditor.gridlist[2] ) rowGrupoPolice223 = guiGridListAddRow ( GUIEditor.gridlist[2] ) guiGridListSetItemText ( GUIEditor.gridlist[2], rowGrupoPolice223, grupos, "Mount Chilliad", false, false ) end end end addEventHandler( "onClientGUIClick", resourceRoot, monstarCamaras) GUIEditor = { gridlist = {}, window = {}, boton = {}, button = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(0.77, 0.00, 0.23, 1.00, "Selecciona donde quieres Aparecer", true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(0.02, 0.03, 0.48, 0.06, "Ciudad:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "sa-header") GUIEditor.gridlist[1] = guiCreateGridList(0.03, 0.09, 0.94, 0.28, true, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Ciudad:", 0.9) for i = 1, 4 do guiGridListAddRow(GUIEditor.gridlist[1]) end guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Los Santos", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Las Venturas", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "San Fierro", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "Other's Spawn", false, false) GUIEditor.label[2] = guiCreateLabel(0.03, 0.39, 0.48, 0.06, "Lugar:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "sa-header") GUIEditor.gridlist[2] = guiCreateGridList(0.03, 0.46, 0.94, 0.29, true, GUIEditor.window[1]) grupos = guiGridListAddColumn(GUIEditor.gridlist[2], "Lugar:", 0.9) boton = guiCreateButton(0.12, 0.79, 0.77, 0.11, "Spawn", true, GUIEditor.window[1]) guiSetFont(boton, "sa-header") GUIEditor.label[3] = guiCreateLabel(0.33, 0.91, 0.89, 0.07, "iSG//", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[3], "sa-header") Server: function Spawn(skinName) if skinName == "Los Santos Down Town" then setCameraMatrix(source, 1483.1064453125, -1760.2861328125, 25.795755386353, 1481.1064453125, -1769.2861328125, 18.795755386353) elseif skinName == "Los Santos Aiport" then setCameraMatrix(source, 2075.6181640625, -2565.09765625, 20.546875, 2080.6181640625, -2570.09765625, 13.546875) elseif skinName == "San Fierro Down Town" then setCameraMatrix(source, -1818.595703125, 540.4033203125, 40.1640625, -1821.595703125, 554.4033203125, 35.1640625) elseif skinName == "San Fierro Aiport" then setCameraMatrix(source, -1260.654296875, -280.7490234375, 10.1484375, -1271.654296875, -291.7490234375, 14.1484375) elseif skinName == "Las Venturas Down Town" then setCameraMatrix(source, 2075.6181640625, 1940.806640625, 1330.91015625, 20.374607086182, 1953.806640625, 1342.91015625, 15.374607086182) elseif skinName == "Las Venturas Aiport" then setCameraMatrix(source, 1310.646484375, 1240.892578125, 18.8203125, 1319.646484375, 1251.892578125, 10.8203125) elseif skinName == "Mount Chilliad" then setCameraMatrix(source, -2360.1025390625, -1620.6142578125, 500.63662719727, -2349.1025390625, -1613.6142578125, 483.63662719727) end end addEvent("onPlayerChooseSkin", true) addEventHandler("onPlayerChooseSkin", root, Spawn) Link to comment
Enargy, Posted October 31, 2014 Share Posted October 31, 2014 Change 'source' for gui-element. row, col = guiGridListGetSelectedItem ( example.gridlist ) --- line 72 Link to comment
AlvareZ_ Posted October 31, 2014 Author Share Posted October 31, 2014 Like this? row, col = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) if ( row and col and row ~= 1 and col ~= -1 ) then grid = guiGridListGetItemText (GUIEditor.gridlist[1], row, 1 ) Link to comment
Enargy, Posted October 31, 2014 Share Posted October 31, 2014 Like this? row, col = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) if ( row and col and row ~= 1 and col ~= -1 ) then grid = guiGridListGetItemText (GUIEditor.gridlist[1], row, 1 ) perhaps... Link to comment
AlvareZ_ Posted October 31, 2014 Author Share Posted October 31, 2014 Now i cant select any row in the 2 gridlist, Thanks for answer guy. 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