DLmass Posted November 8, 2013 Share Posted November 8, 2013 Hey guys! local screenW, screenH = guiGetScreenSize() local marker = createMarker(1810.2548, -1293.1728, -3.0, "cylinder", 2.0, 250, 50,0, 150) window = guiCreateWindow((screenW - 243) / 2, (screenH - 467) / 2, 243, 467, "", false) guiWindowSetSizable(window, false) gridlist = guiCreateGridList(11, 21, 222, 436, false, window) guiGridListAddColumn(gridlist, "Elevator", 0.9) guiSetVisible (window, false) function open(hitPlayer) if hitPlayer == localPlayer and not isPedInVehicle(hitPlayer) then guiSetVisible (window, true) showCursor(true) local file = xmlLoadFile "Teleports.xml" end end addEventHandler("onClientMarkerHit", marker, open) function addTeleports() guiGridListClear( gridlist ) if guiGetVisible(window) == true then local file = xmlLoadFile "Teleports.xml" if file then for i,v in ipairs( xmlNodeGetChildren( file ) ) do local name = xmlNodeGetAttribute( v,"name") local row = guiGridListAddRow( gridlist ) guiGridListSetItemText ( gridlist, row, 1, tostring(name), false, true ) end end end end function teleport( ) local row,col = guiGridListGetSelectedItem( source ) if row and col and row ~= -1 and col ~= -1 then local name = guiGridListGetItemText( source, row, 1 ) local file = xmlLoadFile "Teleports.xml" if file then for i,v in ipairs( xmlNodeGetChildren( file ) ) do local teleportName = xmlNodeGetAttribute( v,"name" ) if teleportName == name then local poX = xmlNodeGetAttribute( v,"posX" ) local poY = xmlNodeGetAttribute( v,"posY" ) local poZ = xmlNodeGetAttribute( v,"posZ" ) setElementPosition( getPedOccupiedVehicle( localPlayer ) or localPlayer, tonumber( poX ), tonumber( poY ), tonumber( poZ + 2 ) ) end end end end end addEventHandler( "onClientGUIDoubleClick",gridlist, teleport, false) When the player enter the marker the GUI shows, but the xml with locations wont load. Can anyone help me? Link to comment
1B0Y Posted November 8, 2013 Share Posted November 8, 2013 (edited) change line 14: addTeleports() change line 22: local file = xmlLoadFile("Teleports.xml") change line 37: local file = xmlLoadFile("Teleports.xml") Edited November 8, 2013 by Guest Link to comment
-.Paradox.- Posted November 8, 2013 Share Posted November 8, 2013 (edited) change line 14: addTeleports() change line 22: local file = xmlLoadFile("Teleports.xml") change line 37: local file = xmlLoadFile("Teleports.xml") Remove line 14 Edited November 8, 2013 by Guest Link to comment
DLmass Posted November 8, 2013 Author Share Posted November 8, 2013 None of those are working, I've replaced everything you guys said. Still no success.. Link to comment
Anony# Posted November 8, 2013 Share Posted November 8, 2013 None of those are working, I've replaced everything you guys said. Still no success.. what's the problem? try this local screenW, screenH = guiGetScreenSize() local marker = createMarker(1810.1166992188, -1271.3551025391, 13.6328125, "cylinder", 2.0, 250, 50,0, 150) window = guiCreateWindow((screenW - 243) / 2, (screenH - 467) / 2, 243, 467, "", false) guiWindowSetSizable(window, false) gridlist = guiCreateGridList(11, 21, 222, 436, false, window) guiGridListAddColumn(gridlist, "Elevator", 0.9) guiSetVisible (window, false) function open(hitPlayer) if hitPlayer == localPlayer and not isPedInVehicle(hitPlayer) then guiSetVisible (window, true) showCursor(true) addTeleports() end end addEventHandler("onClientMarkerHit", marker, open) function addTeleports() guiGridListClear( gridlist ) if guiGetVisible(window) == true then local file = xmlLoadFile ("Teleports.xml") local meNodes = xmlNodeGetChildren(file) for i,v in ipairs( meNodes ) do local name = xmlNodeGetAttribute( v,"name") local row = guiGridListAddRow( gridlist ) guiGridListSetItemText ( gridlist, row, 1, tostring(name), false, true ) end end end function teleport( ) local row,col = guiGridListGetSelectedItem( source ) if row and col and row ~= -1 and col ~= -1 then local name = guiGridListGetItemText( source, row, 1 ) local file = xmlLoadFile ("Teleports.xml") if file then for i,v in ipairs( xmlNodeGetChildren( file ) ) do local teleportName = xmlNodeGetAttribute( v,"name" ) if teleportName == name then local poX = xmlNodeGetAttribute( v,"posX" ) local poY = xmlNodeGetAttribute( v,"posY" ) local poZ = xmlNodeGetAttribute( v,"posZ" ) setElementPosition( getPedOccupiedVehicle( localPlayer ) or localPlayer, tonumber( poX ), tonumber( poY ), tonumber( poZ + 2 ) ) end end end end end addEventHandler( "onClientGUIDoubleClick",gridlist, teleport, false) 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