Syntrax# Posted December 24, 2015 Share Posted December 24, 2015 Hello Everyone, I've a problem with loading some spawn data into the custom DX gridlist.It's only showing one of the many cities it contains.I've tried alot but i can't get it working,do you guys maybe know how to fix this. --Client 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] 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 end local localPlayer = getLocalPlayer() local resX, resY = guiGetScreenSize() local startX = resX * (2 / 3) local startY = 50 local windowX = resX * (1 / 3) local windowY = resY * 50 local xml = xmlLoadFile("spawns.map") cityNodes = xmlNodeGetChildren(xml) cities = {} for i,node in ipairs(cityNodes) do cityname = xmlNodeGetAttribute(node, "name") cities[cityname] = {} cities[cityname]["camX"] = xmlNodeGetAttribute(node, "camX") or 0 cities[cityname]["camY"] = xmlNodeGetAttribute(node, "camY") or 0 cities[cityname]["camZ"] = xmlNodeGetAttribute(node, "camZ") or 0 cities[cityname]["X"] = xmlNodeGetAttribute(node, "X") or 0 cities[cityname]["Y"] = xmlNodeGetAttribute(node, "Y") or 0 cities[cityname]["Z"] = xmlNodeGetAttribute(node, "Z") or 0 local classnodes = xmlNodeGetChildren(node) for i2,node2 in ipairs(classnodes) do classname = xmlNodeGetAttribute(node2, "name") cities[cityname][classname] = {} cities[cityname][classname]["camX"] = xmlNodeGetAttribute(node2, "camX") or 0 cities[cityname][classname]["camY"] = xmlNodeGetAttribute(node2, "camY") or 0 cities[cityname][classname]["camZ"] = xmlNodeGetAttribute(node2, "camZ") or 0 cities[cityname][classname]["X"] = xmlNodeGetAttribute(node2, "X") or 0 cities[cityname][classname]["Y"] = xmlNodeGetAttribute(node2, "Y") or 0 cities[cityname][classname]["X"] = xmlNodeGetAttribute(node2, "Z") or 0 local spawnnodes = xmlNodeGetChildren(node2) 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]["x"] = xmlNodeGetAttribute(node3, "camX") cities[cityname][classname][skinName]["y"] = xmlNodeGetAttribute(node3, "camY") cities[cityname][classname][skinName]["z"] = xmlNodeGetAttribute(node3, "camZ") cities[cityname][classname][skinName]["rot"] = xmlNodeGetAttribute(node3, "rot") or 0 cities[cityname][classname][skinName]["r"] = xmlNodeGetAttribute(node3, "r") cities[cityname][classname][skinName]["g"] = xmlNodeGetAttribute(node3, "g") cities[cityname][classname][skinName]["b"] = xmlNodeGetAttribute(node3, "b") cities[cityname][classname][skinName]["wantedLock"] = xmlNodeGetAttribute(node3, "wantedLock") or "false" cities[cityname][classname][skinName]["skins"] = {} local skins = xmlNodeGetAttribute(node3, "skin") local skinNodes = split(skins, ",") for i4, node4 in ipairs(skinNodes) do table.insert(cities[cityname][classname][skinName]["skins"], node4) end cities[cityname][classname][skinName]["permission"] = xmlNodeGetAttribute(node3, "lock") cities[cityname][classname][skinName]["information"] = xmlNodeGetAttribute(node3, "information") cities[cityname][classname][skinName]["weapons"] = xmlNodeGetAttribute(node3, "weapons") cities[cityname][classname][skinName]["armor"] = xmlNodeGetAttribute(node3, "armor") or 0 cities[cityname][classname][skinName]["blip"] = xmlNodeGetAttribute(node3, "noblip") or false end end end xmlUnloadFile(xml) screenW, screenH = guiGetScreenSize() function drawGrid() local px, py = guiGetScreenSize() local iGridX, iGridY, iGridW, iGridH = 0.0309*px, 0.1771*py, 0.2184*px, 0.7721*py totalRows = 20 local iRows = totalRows local iVisibleRows = 10 local function isCursorOverRectangle(x,y,w,h) if isCursorShowing() then local mx,my = getCursorPosition() -- relative cursorx,cursory = mx*px,my*py if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true end end return false end local tblInput = { [1] = "ouhfdoj", [2] = "ouhfdoj", [3] = "ouhfdoj", [4] = "ouhfdoj", [5] = "ouhfdoj" } local bClicked = false local iCurrentCell = 0 addEventHandler("onClientRender", root, function() dxDrawRectangle(iGridX, iGridY, iGridW, iGridH, tocolor(0, 0, 0, 100)) local iCellHeight = 0.07721*py for ki = iCurrentCell, iVisibleRows+iCurrentCell-1 do visibleI = ki - iCurrentCell local textColor = tocolor(255,255,255,255) dxDrawRectangle(iGridX+iGridW, iGridY+iGridH/iRows*iCurrentCell, 5, iGridH/iRows*iVisibleRows) if isCursorOverRectangle(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight) then dxDrawRectangle(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight, tocolor(41,185,114,255)) textColor = tocolor(0,0,0,255) if getKeyState("mouse1") then dxDrawRectangle(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight, tocolor(255,255,100,255)) if bClicked == false then _debug(cityname) bClicked = cityname end else bClicked = false end end if visibleI ~= 0 then dxDrawLine(iGridX, iGridY+iCellHeight*visibleI, iGridX+iGridW, iGridY+iCellHeight*(visibleI), tocolor(0,0,0,100)) end dxDrawText(cityname.."", iGridX, iGridY+iCellHeight*visibleI, iGridX+iGridW, iGridY+iCellHeight*(visibleI+0.9), textColor, 1.3, "default", "center", "center") end end) bindKey("mouse_wheel_up", "down", function() if isCursorOverRectangle(iGridX, iGridY, iGridW, iGridH) then -- noch hinzugefügt, damit man ausserhalb der Gridlist nicht scrollen kann iCurrentCell = iCurrentCell - 1 if iCurrentCell < 0 then iCurrentCell = 0 end end end) bindKey("mouse_wheel_down", "down", function() if isCursorOverRectangle(iGridX, iGridY, iGridW, iGridH) then iCurrentCell = iCurrentCell + 1 if iCurrentCell > iRows-iVisibleRows then iCurrentCell = iRows-iVisibleRows end end end) end addEventHandler("onClientResourceStart", resourceRoot, drawGrid) screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() dxDrawRectangle(screenW * 0.0235, screenH * 0.0404, screenW * 0.9485, screenH * 0.0182, tocolor(41, 185, 114, 200), false) dxDrawRectangle(screenW * 0.0235, screenH * 0.0534, screenW * 0.9485, screenH * 0.0690, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.0309, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.2191, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.4074, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.5956, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.7838, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.0235, screenH * 0.1641, screenW * 0.9485, screenH * 0.7982, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.0309, screenH * 0.1771, screenW * 0.2184, screenH * 0.7721, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.2566, screenH * 0.1771, screenW * 0.7081, screenH * 0.7721, tocolor(0, 0, 0, 150), false) dxDrawText("City", screenW * 0.0309, screenH * 0.0768, screenW * 0.2118, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Team", screenW * 0.2191, screenH * 0.0768, screenW * 0.4000, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Class", screenW * 0.4074, screenH * 0.0768, screenW * 0.5882, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Property", screenW * 0.5956, screenH * 0.0768, screenW * 0.7765, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Spawn", screenW * 0.7838, screenH * 0.0768, screenW * 0.9647, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) end ) -- Spawn.map "Los Santos" camX="1461.2746582031" camY="-872.85791015625" camZ="79.707496643066"> "Community Management" r="180" g="180" b="180"> "HQ Staff" spawnX="1667.5695800781" spawnY="-1409.0225830078" spawnZ="13.546875" rot="90" r="180" g="180" b="180" lock="acl,staff" weapons="" information="HQ Staff spawn" skin="217,211"/> "Staff" spawnX="1667.5695800781" spawnY="-1409.0225830078" spawnZ="13.546875" rot="90" r="180" g="180" b="180" lock="acl,Probation-Staff" weapons="" information="Probation Staff spawn" skin="217,211"/> "Law Enforcements" r="70" g="130" b="180"> "Police Officer" spawnX="1525.8902587891" spawnY="-1677.8719482422" spawnZ="5.890625" rot="270" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="Police Officer. Todo." skin="280,281" wantedLock="true"/> "Traffic Officer" spawnX="1525.8902587891" spawnY="-1677.8719482422" spawnZ="5.890625" rot="270" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="Traffic Officer. Todo." skin="284" wantedLock="true"/> "Squads" r="0" g="154" b="255"> "Civilians" r="255" g="255" b="0"> "General" spawnX="1258.4375" spawnY="-1808.8450" spawnZ="13.4137" rot="270" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Pilot" spawnX="1900.3917" spawnY="-2330.2082" spawnZ="13.546" rot="270" lock="" weapons="" information="Pilots can earn money by doing cargo missions and carrying passengers around." skin="61"/> "Mechanic" spawnX="431.1358" spawnY="-1351.64550" spawnZ="15.0419" rot="270" lock="" weapons="" information=" A mechanic can earn money by repairing, towing and refueling cars." skin="50"/> "Taxi Driver" spawnX="202.53300476074" spawnY="-1427.0803222656" spawnZ="13.190382957458" rot="270" lock="" weapons="" information="Get Money by transporting players from one place to another." skin="185"/> "Trucker" spawnX="1019" spawnY="-1353" spawnZ="13.55" rot="270" lock="" weapons="" information="Get Money by transporting goods from one place to another." skin="24"/> "Bus Driver" spawnX="1630.3275146484" spawnY="-1128.2524414063" spawnZ="23.90625" rot="270" lock="" weapons="" information="Get Money by transporting players from one place to another." skin="253"/> "Gambler" spawnX="1022.7409057617" spawnY="-1127.8128662109" spawnZ="23.870729446411" rot="270" lock="" weapons="" information="" skin="82"/> "Electrician" spawnX="1514.1655273438" spawnY="-1460.8022460938" spawnZ="9.5" rot="270" lock="" weapons="" information="" skin="261"/> "Builder" spawnX="1249.75830" spawnY="-1237.92432" spawnZ="17.45263" rot="270" lock="" weapons="" information=""skin="16"/> "Emergency" r="46" g="139" b="87"> "Medic" spawnX="2040.5688476563" spawnY="-1411.7678222656" spawnZ="17.1640625" rot="90" r="46" g="139" b="87" lock="" weapons="14.1" information="Heal Player with flowers and earn money." skin="274,276"/> "Criminals" r="178" g="34" b="34"> "Robber" spawnX="960.30938720703" spawnY="-1181.12890625" spawnZ="16.950859069824" rot="180" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Robbers can earn money by robbing houses." skin="241"/> "Drugs Dealer" spawnX="1934.3376464844" spawnY="-1071.7403564453" spawnZ="24.416166305542" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Drugs Dealers can earn money by selling drugs to citizens." skin="28,44"/> "Arms Dealer" spawnX="2481.6916503906" spawnY="-1540.0113525391" spawnZ="24.142942428589" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Arms Dealers can earn money by buying arms from Regional Distribution Centers and selling them to citizens." skin="29,46"/> "Car Jacker" spawnX="1630.1785888672" spawnY="-1518.7348632813" spawnZ="13.604211807251" rot="180" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Carjackers can make money by jacking cars and delivering those cars to the buyer in East Los Santos" skin="7"/> "Prostitute" spawnX="2435.30493" spawnY="-1230.66382" spawnZ="25.13722" rot="180" r="255" g="105" b="180" lock="" weapons="10" information="" skin="63,87,85"/> "Pick Pocket" spawnX="1883.12268" spawnY="-2017.41687" spawnZ="13.54688" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="" skin="134"/> "Smugler" spawnX="2935.46973" spawnY="-2051.26367" spawnZ="3.54804" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="" skin="136"/> "Gangs" r="221" g="15" b="15"> "San Fierro" camX="-1351.6879882813" camY="555.94512939453" camZ="99.749000549316"> "Law Enforcements" r="70" g="130" b="180"> "Police Officer" spawnX="-1616.6091308594" spawnY="682.88330078125" spawnZ="7.1875" rot="170" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="Officers of the law can earn money by arresting wanted criminals." skin="280,281" wantedLock="true"/> "Traffic Officer" spawnX="-1616.6091308594" spawnY="682.88330078125" spawnZ="7.1875" rot="170" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="Traffic Officer" skin="284" wantedLock="true"/> "Squads" r="0" g="154" b="255"> "Civilians" r="255" g="255" b="0"> "General" spawnX="-2442.1293" spawnY="753.10" spawnZ="35.17" rot="200" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Pilot" spawnX="-1350.57" spawnY="-392.65" spawnZ="14.14" rot="270" lock="" weapons="" information="Pilots can earn money by doing cargo missions and carrying passengers around." skin="61"/> "Mechanic" spawnX="-2035.6676025391" spawnY="179.51351928711" spawnZ="28.842931747437" rot="270" lock="" weapons="" information=" A mechanic can earn money by repairing, towing and refueling cars." skin="50"/> "Taxi Driver" spawnX="-2265.8479003906" spawnY="158.19743347168" spawnZ="35.3125" rot="100" lock="" weapons="" information="Get Money by transporting players from one place to another." skin="185"/> "Trucker" spawnX="-1688.7406005859" spawnY="20.385383605957" spawnZ="3.5546875" rot="270" lock="" weapons="" information="Get Money by transporting goods from one place to another." skin="15"/> "Bus Driver" spawnX="-2392.5207519531" spawnY="-588.14697265625" spawnZ="132.72875976563" rot="270" lock="" weapons="" information="Get Money by transporting players from one place to another." skin="253"/> "Gambler" spawnX="-1755.4255371094" spawnY="959.35632324219" spawnZ="24.8828125" rot="180" lock="" weapons="" information="" skin="82"/> "Electrician" spawnX="-1834.11157" spawnY="-10.22164" spawnZ="15.11719" rot="200" lock="" weapons="" information="" skin="261"/> "Builder" spawnX="-2112.24121" spawnY="230.83537" spawnZ="35.04230" rot="270" lock="" weapons="" information=""skin="16"/> "Emergency" r="46" g="139" b="87"> "Medic" spawnX="1607.205078125" spawnY="1818.7908935547" spawnZ="10.8203125" rot="90" r="46" g="139" b="87" lock="" weapons="14.1" information="Heal Player with flowers and earn money." skin="274,276"/> "Fire Fighter" spawnX="1744.2584228516" spawnY="2073.4814453125" spawnZ="10.8203125" rot="90" r="46" g="139" b="87" lock="" weapons="14.1" information="Go, stop house fire, save player and get cash." skin="279"/> "Criminals" r="178" g="34" b="34"> "Robber" spawnX="-2136.1408691406" spawnY="-121.65950775146" spawnZ="36.519073486328" rot="200" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Robbers can earn money by robbing houses." skin="241"/> "Drugs Dealer" spawnX="-2074.9951171875" spawnY="1429.7368164063" spawnZ="7.1015625" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Drugs Dealers can earn money by selling drugs to citizens." skin="28,44"/> "Arms Dealer" spawnX="-2611.3115234375" spawnY="204.06631469727" spawnZ="5.1111831665039" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Arms Dealers can earn money by buying arms from Regional Distribution Centers and selling them to citizens." skin="29,46"/> "Car Jacker" spawnX="-2100.1923828125" spawnY="-24.662958145142" spawnZ="35.3203125" rot="-80" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Carjackers can make money by jacking cars and delivering those cars to the buyer in East San Fierro" skin="7"/> "Prostitute" spawnX="-2691.56812" spawnY="1391.50562" spawnZ="7.10156" rot="180" r="255" g="105" b="180" lock="" weapons="10" information="" skin="63,87,85"/> "Pick Pocket" spawnX="-2215.16162" spawnY="65.94137" spawnZ="35.32788" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="" skin="134"/> "Smugler" spawnX="-1453.61011" spawnY="1077.44189" spawnZ="7.18750" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="" skin="136"/> "Las Venturas" camX="2131.5031738281" camY="1187.1131591797" camZ="63.806499481201"> "Law Enforcements" r="70" g="130" b="180"> "Police Officer" spawnX="2295.0913085938" spawnY="2452.1926269531" spawnZ="10.8203125" rot="100" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="Officers of the law can earn money by arresting wanted criminals." skin="280,281" wantedLock="true"/> "Traffic Officer" spawnX="2295.0913085938" spawnY="2452.1926269531" spawnZ="10.8203125" rot="100" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="Traffic Officer" skin="284" wantedLock="true"/> "Civilians" r="255" g="255" b="0"> "General" spawnX="2193.8833007813" spawnY="1990.3492431641" spawnZ="12.296875" rot="100" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Pilot" spawnX="1318.98621" spawnY="1272.82410" spawnZ="10.97656" rot="270" lock="" weapons="" information="Pilots can earn money by doing cargo missions and carrying passengers around." skin="61"/> "Mechanic" spawnX="1955.9755859375" spawnY="2096.2124023438" spawnZ="11.060997009277" rot="270" lock="" weapons="" information=" A mechanic can earn money by repairing, towing and refueling cars." skin="50"/> "Taxi Driver" spawnX="1712.8791503906" spawnY="1303.1877441406" spawnZ="10.827939987183" rot="150" lock="" weapons="" information="Get Money by transporting players from one place to another." skin="185"/> "Trucker" spawnX="1097.8215332031" spawnY="1912.7602539063" spawnZ="10.81298633901" rot="270" lock="" weapons="" information="Get Money by transporting goods from one place to another." skin="15"/> "Bus Driver" spawnX="2814.82983" spawnY="971.98114" spawnZ="10.75000" rot="270" weapons="" lock="" information="Get Money by transporting players from one place to another." skin="253"/> "Gambler" spawnX="2026.75378" spawnY="1015.28912" spawnZ="10.82031" rot="270" lock="" information="" skin="82"/> "Electrician" spawnX="1693.97742" spawnY="2207.73511" spawnZ="11.06918" rot="270" lock="" weapons="" information="" skin="261"/> "Miner" spawnX="832.64893" spawnY="863.78143" spawnZ="12.67712" rot="270" lock="" weapons="" information="" skin="261"/> "Builder" spawnX="2442.21973" spawnY="1954.79785" spawnZ="10.79729" rot="270" lock="" weapons="" information=""skin="16"/> "Emergency" r="46" g="139" b="87"> "Medic" spawnX="1607.205078125" spawnY="1818.7908935547" spawnZ="10.8203125" rot="90" r="46" g="139" b="87" lock="" weapons="14.1" information="Heal Player with flowers and earn money." skin="274,276"/> "Fire Fighter" spawnX="1744.2584228516" spawnY="2073.4814453125" spawnZ="10.8203125" rot="90" r="46" g="139" b="87" lock="" weapons="14.1" information="Go, stop house fire, save player and get cash." skin="279"/> "Criminals" r="178" g="34" b="34"> "Robber" spawnX="1913.08081" spawnY="703.01556" spawnZ="11.13281" rot="100" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Robbers can earn money by robbing houses." skin="241"/> "Drugs Dealer" spawnX="1053.3702392578" spawnY="1981.7385253906" spawnZ="10.8203125" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Drugs Dealers can earn money by selling drugs to citizens." skin="28,44"/> "Arms Dealer" spawnX="952.63012695313" spawnY="1733.0300292969" spawnZ="8.6484375" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Arms Dealers can earn money by buying arms from Regional Distribution Centers and selling them to citizens." skin="29,46"/> "Car Jacker" spawnX="1678.1352539063" spawnY="994.13116455078" spawnZ="10.8203125" rot="180" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Carjackers can make money by jacking cars and delivering those cars to the buyer in East Las Venturas" skin="7"/> "Prostitute" spawnX="2511.51514" spawnY="2121.76172" spawnZ="10.84017" rot="180" r="255" g="105" b="180" lock="" weapons="10" information="" skin="63,87,85"/> "Pick Pocket" spawnX="2787.15869" spawnY="2018.71692" spawnZ="10.80213" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="" skin="134"/> "Smugler" spawnX="263.30231" spawnY="2896.07739" spawnZ="10.53906" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="" skin="136"/> "Bay Side" camX="-2503.34790" camY="2387.37622" camZ="80.79131"> "Law Enforcements" r="70" g="130" b="180"> "Police Marine" spawnX="-2238.99854" spawnY="2352.51660" spawnZ="4.97964" rot="150" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="Police Marine." skin="71" wantedLock="true"/> "Civilians" r="255" g="255" b="0"> "General" spawnX="-2614.90552" spawnY="2247.94946" spawnZ="8.18830" rot="270" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Builder" spawnX="-2363.05591" spawnY="2370.55151" spawnZ="5.12889" rot="150" lock="" weapons="" information=""skin="16"/> "Hobo" spawnX="-2479.6000976563" spawnY="2290.6999511719" spawnZ="5" rot="270.002746" lock="" weapons="15" information="This is a spawn without a specific job.Used to RP "skin="135"/> "Criminals" r="178" g="34" b="34"> "Punk" spawnX="-2485.60327" spawnY="2539.46777" spawnZ="18.05617" rot="180" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="" skin="181"/> "Whetstone" camX="-1804.51245" camY="-1702.08362" camZ="80.19198"> "Civilians" r="255" g="255" b="0"> "General" spawnX="-2045.60925" spawnY="-2522.88037" spawnZ="31.06681" rot="150" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Emergency" r="46" g="139" b="87"> "Medic" spawnX="-2203.48755" spawnY="-2309.88916" spawnZ="31.37500" rot="200" r="46" g="139" b="87" lock="" weapons="14.1" information="Heal Player with flowers and earn money." skin="274,276"/> "Criminals" r="178" g="34" b="34"> "Drugs Dealer" spawnX="-1895.72546" spawnY="-1679.12939" spawnZ="23.01563" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Drugs Dealers can earn money by selling drugs to citizens." skin="28,44"/> "Arms Dealer" spawnX="-1865.88477" spawnY="-1629.07056" spawnZ="21.84873" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Arms Dealers can earn money by buying arms from Regional Distribution Centers and selling them to citizens." skin="29,46"/> "Bone County" camX="-124.72729" camY="1147.94128" camZ="68.39144"> "Law Enforcements" r="70" g="130" b="180"> "Sheriff" spawnX="-216.62581" spawnY="984.77844" spawnZ="19.38723" rot="270" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="County Sheriff." skin="283" wantedLock="true"/> "Civilians" r="255" g="255" b="0"> "General" spawnX="14.07795" spawnY="1188.32629" spawnZ="19.46664" rot="-5" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Emergency" r="46" g="139" b="87"> "Medic" spawnX="-315.90979" spawnY="1053.23438" spawnZ="20.34026" rot="0" r="46" g="139" b="87" lock="" weapons="14.1" information="Heal Player with flowers and earn money." skin="274,276"/> "Criminals" r="178" g="34" b="34"> "Biker" spawnX="-96.19229" spawnY="1360.66870" spawnZ="10.27344" rot="270" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Bikers can earn money delivering weponds." skin="247"/> "Tierra Robada" camX="-1493.93738" camY="2629.88428" camZ="91.21724"> "Lew Enforcements" r="70" g="130" b="180"> "Sheriff" spawnX="-1394.67334" spawnY="2643.53442" spawnZ="55.88844" rot="150" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="County Sheriff." skin="283" wantedLock="true"/> "Civilians" r="255" g="255" b="0"> "General" spawnX="-1485.73169" spawnY="2687.61108" spawnZ="55.84028" rot="270" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Emergency" r="46" g="139" b="87"> "Medic" spawnX="-1514.83118" spawnY="2524.13599" spawnZ="55.80044" rot="8" r="46" g="139" b="87" lock="" weapons="14.1" information="Heal Player with flowers and earn money." skin="274,276"/> "Criminals" r="178" g="34" b="34"> "Biker" spawnX="-1527.30090" spawnY="2624.98853" spawnZ="55.83594" rot="100" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Bikers can earn money delivering weponds." skin="247"/> "Red County" camX="1350.29834" camY="362.77649" camZ="55.90912"> "Law Enforcements" r="70" g="130" b="180"> "Sheriff" spawnX="630.91370" spawnY="-571.58624" spawnZ="16.33594" rot="270" r="70" g="130" b="180" lock="" weapons="3.1,23.150" information="County Sheriff." skin="283" wantedLock="true"/> "Civilians" r="255" g="255" b="0"> "General" spawnX="854.62848" spawnY="-603.68445" spawnZ="18.42188" rot="20" lock="" weapons="" information="This is a spawn without a specific job. "skin="12,20,35,60,56,141,185"/> "Emergency" r="46" g="139" b="87"> "Medic" spawnX="1242.75854" spawnY="328.52814" spawnZ="19.75551" rot="-25" r="46" g="139" b="87" lock="" weapons="14.1" information="Heal Player with flowers and earn money." skin="274,276"/> "Criminals" r="178" g="34" b="34"> "Biker" spawnX="1320.39575" spawnY="393.120670" spawnZ="19.55469" rot="50" r="178" g="34" b="34" lock="" weapons="5.1,22.150" information="Bikers can earn money delivering weponds." skin="247"/> "Gangs" r="221" g="15" b="15"> I know this Spawn.map is used alot but i just want to use it as a base to start with but i'm creating the spawnpanel from scratch with it own functions Screen of the script Link to comment
Syntrax# Posted December 26, 2015 Author Share Posted December 26, 2015 **Bump** I've figured out a way to get the data in the columns,but it creates everything on one spot function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix (element) local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] 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 end local localPlayer = getLocalPlayer() local rectangleX, rectangleY = guiGetScreenSize() local screenW, screenH = guiGetScreenSize() local spawnPending = false function initializeEverything(resourceStarted) if getResourceName(resourceStarted) == "_Main" or getResourceName(resourceStarted) == "_SPAWN" then local xml = xmlLoadFile(":_SPAWN/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]["cameraX"] = xmlNodeGetAttribute(node3, "cameraX") cities[cityname][classname][skinName]["cameraY"] = xmlNodeGetAttribute(node3, "cameraY") cities[cityname][classname][skinName]["cameraZ"] = xmlNodeGetAttribute(node3, "cameraZ") cities[cityname][classname][skinName]["cameraRot"] = xmlNodeGetAttribute(node3, "cameraRot") cities[cityname][classname][skinName]["weapons"] = xmlNodeGetAttribute(node3, "weapons") end end end xmlUnloadFile(xml) if spawnPending then spawnPending = false drawSpawnScreen(spawnPending) end else outputDebugString("SPAWNMAP: A error has occured.") end end end addEventHandler("onClientResourceStart", root, initializeEverything) screenW, screenH = guiGetScreenSize() function drawGrid() local px, py = guiGetScreenSize() local iGridX, iGridY, iGridW, iGridH = 0.0309*px, 0.1771*py, 0.2184*px, 0.7721*py totalRows = 7 local iRows = totalRows local iVisibleRows = 7 local function isCursorOverRectangle(x,y,w,h) if isCursorShowing() then local mx,my = getCursorPosition() -- relative cursorx,cursory = mx*px,my*py if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true end end return false end local bClicked = false local iCurrentCell = 0 addEventHandler("onClientRender", root, function() if cities then dxDrawRectangle(iGridX, iGridY, iGridW, iGridH, tocolor(0, 0, 0, 100)) local iCellHeight = 0.07721*py for ki = iCurrentCell, iVisibleRows+iCurrentCell-1 do visibleI = ki - iCurrentCell local textColor = tocolor(255,255,255,255) dxDrawRectangle(iGridX+iGridW, iGridY+iGridH/iRows*iCurrentCell, 5, iGridH/iRows*iVisibleRows) if isCursorOverRectangle(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight) then dxDrawRectangle(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight, tocolor(41,185,114,255)) textColor = tocolor(0,0,0,255) if getKeyState("mouse1") then dxDrawRectangle(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight, tocolor(255,255,100,255)) if bClicked == false then _debug(cityname) bClicked = cityname end else bClicked = false end end if visibleI ~= 0 then dxDrawLine(iGridX, iGridY+iCellHeight*visibleI, iGridX+iGridW, iGridY+iCellHeight*(visibleI), tocolor(0,0,0,100)) end for n, v in pairs(cities) do dxDrawText(" - ".. n .." - ", iGridX, iGridY+iCellHeight*visibleI, iGridX+iGridW, iGridY+iCellHeight*(visibleI+0.9), textColor, 1.3, "default", "center", "center") end end end end) bindKey("mouse_wheel_up", "down", function() if isCursorOverRectangle(iGridX, iGridY, iGridW, iGridH) then -- noch hinzugefügt, damit man ausserhalb der Gridlist nicht scrollen kann iCurrentCell = iCurrentCell - 1 if iCurrentCell < 0 then iCurrentCell = 0 end end end) bindKey("mouse_wheel_down", "down", function() if isCursorOverRectangle(iGridX, iGridY, iGridW, iGridH) then iCurrentCell = iCurrentCell + 1 if iCurrentCell > iRows-iVisibleRows then iCurrentCell = iRows-iVisibleRows end end end) end addEventHandler("onClientResourceStart", resourceRoot, drawGrid) screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", root, function() dxDrawRectangle(screenW * 0.0228, screenH * 0.15, screenW * 0.9493, screenH * 0.0169, tocolor(41, 185, 114, 255), false) dxDrawRectangle(screenW * 0.0235, screenH * 0.0404, screenW * 0.9485, screenH * 0.0182, tocolor(41, 185, 114, 200), false) dxDrawRectangle(screenW * 0.0235, screenH * 0.0534, screenW * 0.9485, screenH * 0.0690, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.0309, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.2191, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.4074, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.5956, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.7838, screenH * 0.0794, screenW * 0.1809, screenH * 0.0430, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.0235, screenH * 0.1641, screenW * 0.9485, screenH * 0.7982, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.0309, screenH * 0.1771, screenW * 0.2184, screenH * 0.7721, tocolor(0, 0, 0, 150), false) dxDrawRectangle(screenW * 0.2566, screenH * 0.1771, screenW * 0.7081, screenH * 0.7721, tocolor(0, 0, 0, 150), false) dxDrawText("City", screenW * 0.0309, screenH * 0.0768, screenW * 0.2118, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Team", screenW * 0.2191, screenH * 0.0768, screenW * 0.4000, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Class", screenW * 0.4074, screenH * 0.0768, screenW * 0.5882, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Property", screenW * 0.5956, screenH * 0.0768, screenW * 0.7765, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Spawn", screenW * 0.7838, screenH * 0.0768, screenW * 0.9647, screenH * 0.1224, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.0360, screenH * 0.1107, screenW * 0.1691, screenH * 0.0052, tocolor(41, 185, 114, 255), true) dxDrawRectangle(screenW * 0.2250, screenH * 0.1107, screenW * 0.1691, screenH * 0.0052, tocolor(41, 185, 114, 255), true) dxDrawRectangle(screenW * 0.4132, screenH * 0.1107, screenW * 0.1691, screenH * 0.0052, tocolor(41, 185, 114, 255), true) dxDrawRectangle(screenW * 0.6007, screenH * 0.1107, screenW * 0.1691, screenH * 0.0052, tocolor(41, 185, 114, 255), true) dxDrawRectangle(screenW * 0.7890, screenH * 0.1107, screenW * 0.1691, screenH * 0.0052, tocolor(41, 185, 114, 255), true) dxDrawText("Dynasty Network", (screenW * 0.0000) + 1, (screenH * 0.0182) + 1, (screenW * 1.0000) + 1, (screenH * 0.0534) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Dynasty Network", screenW * 0.0000, screenH * 0.0182, screenW * 1.0000, screenH * 0.0534, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) end ) Link to comment
Tails Posted January 15, 2016 Share Posted January 15, 2016 You need to set the column width to a higher value, but at the same time make sure it's not wider than the gridlist. Also, take note that there's no horizontal scrolling so not many columns are going to fit. 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