Mike269 Posted March 19, 2015 Share Posted March 19, 2015 Hello guys, when I try to start the gui ingame only windows shows up, help please! function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end local localPlayer = getLocalPlayer() local resX, resY = guiGetScreenSize() local startX = resX * (2 / 3) local startY = 0 local windowX = resX * (1 / 3) local windowY = resY --[[ TARGET VIEW CLEANER CODE local invisibles = {} function removeInvisibles() for i,v in ipairs(invisibles) do setElementAlpha(v[1], v[2]) table.remove(invisibles, i) end end--]] local spawnPending = false function initializeEverything(resourceStarted) if getResourceName(resourceStarted) == "BCGspawn" or getResourceName(resourceStarted) == "BCGspawnmap" then local xml = xmlLoadFile(":BCGspawnmap/spawns.xml") if xml then local cityNodes = xmlNodeGetChildren(xml) cities = {} for i,node in ipairs(cityNodes) do cityname = xmlNodeGetAttribute(node, "name") local classnodes = xmlNodeGetChildren(node) cities[cityname] = {} for i2,node2 in ipairs(classnodes) do classname = xmlNodeGetAttribute(node2, "name") local spawnnodes = xmlNodeGetChildren(node2) cities[cityname][classname] = {} for i3, node3 in ipairs(spawnnodes) do skinName = xmlNodeGetAttribute(node3, "name") cities[cityname][classname][skinName] = {} cities[cityname][classname][skinName]["spawnX"] = xmlNodeGetAttribute(node3, "spawnX") cities[cityname][classname][skinName]["spawnY"] = xmlNodeGetAttribute(node3, "spawnY") cities[cityname][classname][skinName]["spawnZ"] = xmlNodeGetAttribute(node3, "spawnZ") cities[cityname][classname][skinName]["rot"] = xmlNodeGetAttribute(node3, "rot") cities[cityname][classname][skinName]["r"] = xmlNodeGetAttribute(node3, "r") cities[cityname][classname][skinName]["g"] = xmlNodeGetAttribute(node3, "g") cities[cityname][classname][skinName]["b"] = xmlNodeGetAttribute(node3, "b") local skinNode = xmlNodeGetAttribute(node3, "skins") cities[cityname][classname][skinName]["skins"] = split(skinNode, ",") cities[cityname][classname][skinName]["dimension"] = xmlNodeGetAttribute(node3, "dimension") cities[cityname][classname][skinName]["interior"] = xmlNodeGetAttribute(node3, "interior") cities[cityname][classname][skinName]["permission"] = xmlNodeGetAttribute(node3, "lock") cities[cityname][classname][skinName]["information"] = xmlNodeGetAttribute(node3, "information") cities[cityname][classname][skinName]["weapons"] = xmlNodeGetAttribute(node3, "weapons") end end end xmlUnloadFile(xml) if spawnPending then spawnPending = false drawSpawnScreen(spawnPending) end else outputDebugString("Weird, you got an error.") end end end addEventHandler("onClientResourceStart", root, initializeEverything) function drawSpawnScreen(houses) if isElement(spawnWindow) then destroyElement(spawnWindow) end if cities then labels = {} spawnWindow = guiCreateWindow(0, 697, 1920, 357, "SAUS:RPG Spawn Selection", false) guiSetProperty(spawnWindow, "NormalTextColour", "FFD55B09") guiWindowSetMovable(spawnWindow, false) guiWindowSetSizable(spawnWindow, false) labels[1] = guiCreateLabel(10, 26, 356, 321,"City Selection:",true,spawnWindow) guiLabelSetVerticalAlign(labels[1],"center") cityGridList = guiCreateGridList(8, 9, 338, 302,true,spawnWindow) guiGridListSetSelectionMode(cityGridList,2) guiGridListAddColumn(cityGridList, "City", 0.9) labels[2] = guiCreateLabel(420, 26, 356, 321,"Class Selection:",true,spawnWindow) guiLabelSetVerticalAlign(labels[2],"center") classGridList = guiCreateGridList(7, 8, 339, 303,true,spawnWindow) guiGridListSetSelectionMode(classGridList,2) guiGridListAddColumn(classGridList, "Class", 0.9) labels[3] = guiCreateLabel(1147, 26, 356, 321,"Spawn Selection:",true,spawnWindow) guiLabelSetVerticalAlign(labels[3],"center") spawnGridList = guiCreateGridList(7, 8, 339, 303,true,spawnWindow) guiGridListSetSelectionMode(spawnGridList,2) guiGridListAddColumn(spawnGridList, "Spawn", 0.9) labels[4] = guiCreateLabel(1548, 26, 356, 321,"Location Selection:",true,spawnWindow) guiLabelSetVerticalAlign(labels[4],"center") locationGridList = guiCreateGridList(7, 10, 339, 301,true,spawnWindow) guiGridListSetSelectionMode(locationGridList,2) guiGridListAddColumn(locationGridList, "Location", 0.9) local noneRow = guiGridListAddRow(locationGridList) guiGridListSetItemText(locationGridList, noneRow, 1, "Default spawn location", false, false) guiGridListSetItemData(locationGridList, noneRow, 1, false) guiGridListSetSelectedItem(locationGridList, noneRow, 1) labels[5] = guiCreateLabel(823, 245, 277, 80,"Skin Selection:",true,spawnWindow) guiLabelSetVerticalAlign(labels[5],"center") skinPrevButton = guiCreateButton(10, 21, 99, 42,"<<<",true,spawnWindow) guiSetProperty(spawnWindow, "NormalTextColour", "FFF57900") skinNextButton = guiCreateButton(168, 21, 99, 42,">>>",true,spawnWindow) guiSetProperty(spawnWindow, "NormalTextColour", "FFF57900") guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") skinNumberLabel = guiCreateLabel(957, 330, 59, 17,"1",true,spawnWindow) guiLabelSetVerticalAlign(skinNumberLabel,"center") guiLabelSetHorizontalAlign(skinNumberLabel,"center",false) spawnScreenOKButton = guiCreateButton(841, 132, 237, 81,"spawn",true,spawnWindow) guiSetFont(spawnScreenOKButton,"sa-header") guiSetProperty(spawnWindow, "NormalTextColour", "FFD55B09") guiSetProperty(spawnScreenOKButton, "Disabled", "True") spawnWindow2 = guiCreateWindow(664, 341, 557, 276, "Spawn Information", false) guiSetProperty(spawnWindow2, "CaptionColour", "FFF57900") guiWindowSetMovable(spawnWindow2, false) guiWindowSetSizable(spawnWindow2, false) for n, v in pairs(cities) do local row = guiGridListAddRow(cityGridList) guiGridListSetItemText(cityGridList, row, 1, n, false, false) end if houses then for n, v in ipairs(houses) do local row = guiGridListAddRow(locationGridList) guiGridListSetItemText(locationGridList, row, 1, v[1], false, false) guiGridListSetItemData(locationGridList, row, 1, {v[2], v[3], v[4]}) end end addEventHandler("onClientGUIClick", cityGridList, onCityClick) addEventHandler("onClientGUIClick", classGridList, onClassClick) addEventHandler("onClientGUIClick", spawnGridList, onSkinClick) addEventHandler("onClientGUIClick", spawnScreenOKButton, onSpawnButtonClick) addEventHandler("onClientGUIClick", skinPrevButton, onPrevSkin) addEventHandler("onClientGUIClick", skinNextButton, onNextSkin) fadeCamera(true) guiSetVisible(spawnWindow, true) guiGridListSetSelectedItem(spawnGridList, -1, 0) showCursor(true) showPlayerHudComponent ("all",false) else spawnPending = houses end end function onCityClick(button) if source == cityGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 then guiGridListClear(classGridList) local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local cityClasses = cities[cityName] for x, y in pairs(cityClasses) do local row = guiGridListAddRow(classGridList) guiGridListSetItemText(classGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") guiSetText(skinNumberLabel, 1) end end end function onClassClick(button) if source == classGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 0 then guiGridListClear(spawnGridList) local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, selectedRow, selectedCol ) -- get its text local classSkins = cities[cityName][className] for x, y in pairs(classSkins) do local row = guiGridListAddRow(spawnGridList) guiGridListSetItemText(spawnGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") guiSetProperty(skinPrevButton, "Disabled", "True") guiSetProperty(skinNextButton, "Disabled", "True") guiSetText(skinNumberLabel, 1) end end end function onSkinClick(button) if source == spawnGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 0 and guiGridListGetSelectedCount( spawnGridList ) > 0 then local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( spawnGridList ); -- get double clicked item in the gridlist local skinName = guiGridListGetItemText( spawnGridList, selectedRow, selectedCol ) -- get its text guiSetProperty(spawnScreenOKButton, "Disabled", "False") guiSetProperty(skinPrevButton, "Disabled", "False") guiSetProperty(skinNextButton, "Disabled", "False") guiSetText(infoMemo, cities[cityName][className][skinName]["information"]) guiSetText(skinNumberLabel, 1) renderSkin() end end end function onSpawnButtonClick(button) if source == spawnScreenOKButton and button == "left" then if guiGridListGetSelectedCount( cityGridList ) > 0 and guiGridListGetSelectedCount( classGridList ) > 0 and guiGridListGetSelectedCount( spawnGridList ) > 0 then local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( spawnGridList ); -- get double clicked item in the gridlist local skinName = guiGridListGetItemText( spawnGridList, selectedRow, selectedCol ) -- get its text local spawninfo = cities[cityName][className][skinName] local skinID = spawninfo['skins'][tonumber(guiGetText(skinNumberLabel))] Link to comment
Castillo Posted March 19, 2015 Share Posted March 19, 2015 I don't understand the problem, can you explain it better? Link to comment
Mike269 Posted March 19, 2015 Author Share Posted March 19, 2015 I don't understand the problem, can you explain it better? That's the gui of the spawn panel, When I start the spawn panel only "Window and text" of the spawn panel show up. Link to comment
Mike269 Posted March 19, 2015 Author Share Posted March 19, 2015 It shows up like that: https://fbcdn-sphotos-h-a.akamaihd.net/ ... bcf053e25a and should be like: https://fbcdn-sphotos-h-a.akamaihd.net/ ... 9496a0a4a0 Link to comment
Castillo Posted March 19, 2015 Share Posted March 19, 2015 That's because you edited the code wrong, you put absolute positions, but you defined the argument as absolute. locationGridList = guiCreateGridList(7, 10, 339, 301,true,spawnWindow) See that 'true'? that means relative positions, but these are absolute, so just change 'true' to 'false', like this: locationGridList = guiCreateGridList(7, 10, 339, 301,false,spawnWindow) And do the same for all the others. Link to comment
Mike269 Posted March 19, 2015 Author Share Posted March 19, 2015 thanks man, you're so friendly, ill try it Link to comment
Mike269 Posted March 19, 2015 Author Share Posted March 19, 2015 Changed everything to false but there's still a problem: https://fbcdn-sphotos-h-a.akamaihd.net/ ... 57fa31f9f8 Link to comment
Enargy, Posted March 19, 2015 Share Posted March 19, 2015 make again the gui and make sure you look correctly in the final position. Link to comment
Ryancit2 Posted March 20, 2015 Share Posted March 20, 2015 What does /debugscript 3 days? I'm sure GUI issues are minor ones and sometimes hard to notice, you are (possibly) giving wrong parent names (which i couldn't find) or the data is not inserted in valid elements or there's been a confusion in both windows. Go ingame, login as admin then check t/debugscript 3 and tell us errors. Link to comment
Mike269 Posted March 20, 2015 Author Share Posted March 20, 2015 that's the problem, there's no errors in GUI if they would be , I could fix it.. Link to comment
Ryancit2 Posted March 28, 2015 Share Posted March 28, 2015 There are so many tables-in-tables which makes confusions for filling up the GUI elements which might be the issue. 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