#STZ Posted February 21, 2018 Share Posted February 21, 2018 السلام عليكم عندي مشكلة في كود فكرة الكود انه جريد ليست كل رو فيه اسم كل اسم يروح مكان والاماكن و الاحداثيات xml الاكواد for k, v in ipairs ( xmlNodeGetChildren ( getResourceConfig ( "XML.xml" ) ) ) do local Name = xmlNodeGetAttribute(v, "name") local Row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], Row, 1, Name, false, false ) guiGridListSetItemColor ( GUIEditor.gridlist[1], Row, 1, 0, 191, 253 ) end xml = xmlLoadFile ( "XML.xml" ) addEventHandler ( "onClientGUIDoubleClick", root, function ( ) local Selected = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) GetText = guiGridListGetItemText( GUIEditor.gridlist[1], Selected, 1 ) if source == GUIEditor.gridlist[1] then for Index, v in ipairs ( xmlNodeGetChildren ( xml ) ) do if GetText == xmlNodeGetAttribute ( v, "name" ) then guiGridListClear ( GUIEditor.gridlist[1] ) for Index, v in ipairs ( xmlNodeGetChildren ( v ) ) do local Row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], Row, 1, xmlNodeGetAttribute ( v, "name" ), false, false ) -- local Data = xmlNodeGetAttribute ( v, "x" ),xmlNodeGetAttribute ( v, "y" ),xmlNodeGetAttribute ( v, "z" ) guiGridListSetItemData ( GUIEditor.gridlist[1], Row, 1, Data) -- guiGridListSetItemColor ( GUIEditor.gridlist[1], Row, 1, 0, 191, 253 ) end elseif GetText == "..." then guiGridListClear ( GUIEditor.gridlist[1] ) for Index, v in ipairs ( xmlNodeGetChildren ( xml ) ) do local Row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], Row, 1, xmlNodeGetAttribute ( v, "name" ), false, false ) -- local Data = xmlNodeGetAttribute ( v, "x" ),xmlNodeGetAttribute ( v, "y" ),xmlNodeGetAttribute ( v, "z" ) guiGridListSetItemData ( GUIEditor.gridlist[1], Row, 1, Data) -- guiGridListSetItemColor ( GUIEditor.gridlist[1], Row, 1, 0, 191, 253 ) end end end end end ) addEventHandler ( "onClientGUIDoubleClick", root, function () local Selected = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) if source == GUIEditor.gridlist[1] then if guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1) then local x,y,z = guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1) setElementPosition(localPlayer,x,y,z) end end end ) <Places> <group name="الاماكن"> <PlaceName name="..." /> <PlaceName name="مكان 1" x="1477.75586" y="-1739.54712" z="13.54688" /> <PlaceName name="مكان 2" x="1477.75586" y="-1739.54712" z="13.54688" /> <PlaceName name="مكان 3" x="1477.75586" y="-1739.54712" z="13.54688"/> </group> Just now, #STZ said: السلام عليكم عندي مشكلة في كود فكرة الكود انه جريد ليست كل رو فيه اسم كل اسم يروح مكان والاماكن و الاحداثيات xml الاكواد for k, v in ipairs ( xmlNodeGetChildren ( getResourceConfig ( "XML.xml" ) ) ) do local Name = xmlNodeGetAttribute(v, "name") local Row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], Row, 1, Name, false, false ) guiGridListSetItemColor ( GUIEditor.gridlist[1], Row, 1, 0, 191, 253 ) end xml = xmlLoadFile ( "XML.xml" ) addEventHandler ( "onClientGUIDoubleClick", root, function ( ) local Selected = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) GetText = guiGridListGetItemText( GUIEditor.gridlist[1], Selected, 1 ) if source == GUIEditor.gridlist[1] then for Index, v in ipairs ( xmlNodeGetChildren ( xml ) ) do if GetText == xmlNodeGetAttribute ( v, "name" ) then guiGridListClear ( GUIEditor.gridlist[1] ) for Index, v in ipairs ( xmlNodeGetChildren ( v ) ) do local Row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], Row, 1, xmlNodeGetAttribute ( v, "name" ), false, false ) -- local Data = xmlNodeGetAttribute ( v, "x" ),xmlNodeGetAttribute ( v, "y" ),xmlNodeGetAttribute ( v, "z" ) guiGridListSetItemData ( GUIEditor.gridlist[1], Row, 1, Data) -- guiGridListSetItemColor ( GUIEditor.gridlist[1], Row, 1, 0, 191, 253 ) end elseif GetText == "..." then guiGridListClear ( GUIEditor.gridlist[1] ) for Index, v in ipairs ( xmlNodeGetChildren ( xml ) ) do local Row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], Row, 1, xmlNodeGetAttribute ( v, "name" ), false, false ) -- local Data = xmlNodeGetAttribute ( v, "x" ),xmlNodeGetAttribute ( v, "y" ),xmlNodeGetAttribute ( v, "z" ) guiGridListSetItemData ( GUIEditor.gridlist[1], Row, 1, Data) -- guiGridListSetItemColor ( GUIEditor.gridlist[1], Row, 1, 0, 191, 253 ) end end end end end ) addEventHandler ( "onClientGUIDoubleClick", root, function () local Selected = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) if source == GUIEditor.gridlist[1] then if guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1) then local x,y,z = guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1) setElementPosition(localPlayer,x,y,z) end end end ) <Places> <group name="الاماكن"> <PlaceName name="..." /> <PlaceName name="مكان 1" x="1477.75586" y="-1739.54712" z="13.54688" /> <PlaceName name="مكان 2" x="1477.75586" y="-1739.54712" z="13.54688" /> <PlaceName name="مكان 3" x="1477.75586" y="-1739.54712" z="13.54688"/> </group> المشكلة انه مش بينتقل المشكلة هنا setElementPosition(localPlayer,x,y,z) Link to comment
Doffy Posted February 21, 2018 Share Posted February 21, 2018 ليش ما تسوي بالجداول اسهل ؟ Link to comment
#STZ Posted February 21, 2018 Author Share Posted February 21, 2018 لانه مجموعات كل رو يجيب مجموعة من الاماكن Link to comment
Doffy Posted February 21, 2018 Share Posted February 21, 2018 برضو تقدر تستخدم الجداول افضل واسهل .. شكلك مب فاهمني + ليش ما جربت تسوي ترايقر وترسل فيه ال x,y,z وتسوي setElementPostion(source, x,y,z) جرب وشوف . Link to comment
^iiEcoo'x_) Posted February 21, 2018 Share Posted February 21, 2018 local xPos , yPos , zPos = xmlNodeGetAttribute ( v, "x" ),xmlNodeGetAttribute ( v, "y" ),xmlNodeGetAttribute ( v, "z" ) guiGridListSetItemData ( GUIEditor.gridlist[1], Row, 1, { x = xPos , y = yPos , z = zPos } ) addEventHandler ( "onClientGUIDoubleClick", root, function () local Selected = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) if source == GUIEditor.gridlist[1] then if guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1) then local x = guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1).x local y = guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1).y local xz = guiGridListGetItemData(GUIEditor.gridlist[1], Selected, 1).z setElementPosition(localPlayer,x,y,z) end end end ) 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