кιηg-αвα∂у Posted November 17, 2012 Share Posted November 17, 2012 السلام عليكم انا سويت لوحة فيها Gridlist قائمة Button وبايتون فيه قائمة سيارات xml وسويت ملف xml كيف اخلي السيرات الي في ملف يطلعون في القائمة واخلي البايتون لما نضغط عليه يعطي الاعب السيارة مثل الوحة الي في الفري روم هاذه ملف كلينت GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(471,269,150,208,"vehicles",false) GUIEditor_Grid[1] = guiCreateGridList(9,23,132,150,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) GUIEditor_Button[1] = guiCreateButton(14,177,61,22,"أغلاق",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(79,177,59,22,"أختيار",false,GUIEditor_Window[1]) addEvent("onShow",true) addEventHandler("onShow",root, function() guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end) addEventHandler ("onClientGUIClick", getRootElement(), function(button, state, absoluteX, absoluteY) if ( source == GUIEditor_Button[1] ) then setTimer(guiSetVisible,100,1,GUIEditor_Window[1],false) showCursor(false)-- end end) ملف vehicles.xml <catalog type="vehicle"> <vehicle id="562" name="Elegy" /> <vehicle id="560" name="Sultan" /> <vehicle id="559" name="Jester" /> <vehicle id="565" name="Flash" /> <vehicle id="477" name="ZR-350" /> </catalog> Link to comment
Micro Posted November 18, 2012 Share Posted November 18, 2012 https://wiki.multitheftauto.com/wiki/XmlNodeGetValue Link to comment
==>ҭᾄlᾄl Posted November 18, 2012 Share Posted November 18, 2012 https://wiki.multitheftauto.com/wiki/Scr ... Tutorial_1 Link to comment
TD[M]ER Posted November 18, 2012 Share Posted November 18, 2012 السلام عليكمانا سويت لوحة فيها Gridlist قائمة Button وبايتون فيه قائمة سيارات xml وسويت ملف xml كيف اخلي السيرات الي في ملف يطلعون في القائمة واخلي البايتون لما نضغط عليه يعطي الاعب السيارة مثل الوحة الي في الفري روم هاذه ملف كلينت GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(471,269,150,208,"vehicles",false) GUIEditor_Grid[1] = guiCreateGridList(9,23,132,150,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) GUIEditor_Button[1] = guiCreateButton(14,177,61,22,"أغلاق",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(79,177,59,22,"أختيار",false,GUIEditor_Window[1]) addEvent("onShow",true) addEventHandler("onShow",root, function() guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end) addEventHandler ("onClientGUIClick", getRootElement(), function(button, state, absoluteX, absoluteY) if ( source == GUIEditor_Button[1] ) then setTimer(guiSetVisible,100,1,GUIEditor_Window[1],false) showCursor(false)-- end end) ملف vehicles.xml <catalog type="vehicle"> <vehicle id="562" name="Elegy" /> <vehicle id="560" name="Sultan" /> <vehicle id="559" name="Jester" /> <vehicle id="565" name="Flash" /> <vehicle id="477" name="ZR-350" /> </catalog> عند طرح الأكواد أستخدم Link to comment
кιηg-αвα∂у Posted November 18, 2012 Author Share Posted November 18, 2012 ممكن تشوفون وش الخطأ المود مايشتغل كلينت GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} windowVehicleSelection = guiCreateWindow(471,269,150,208,"vehicles by king-abady",false) gridlistVehicleSelection = guiCreateGridList(9,23,132,150,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) close = guiCreateButton(14,177,61,22,"أغلاق",false,GUIEditor_Window[1]) buttonCreate = guiCreateButton(79,177,59,22,"أختيار",false,GUIEditor_Window[1]) addEvent("onShow",true) addEventHandler("onShow",root, function() guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end) function populateGridlist() local rootnode = xmlLoadFile("vehicles.xml") if rootnode then for _,group in ipairs(xmlNodeGetChildren(rootnode)) do local row = guiGridListAddRow(gridlistVehicleSelection) local name = xmlNodeGetAttribute(group,"type") guiGridListSetItemText(gridlistVehicleSelection,row,1,name,true,false) for _,vehicle in ipairs(xmlNodeGetChildren(group)) do row = guiGridListAddRow(gridlistVehicleSelection) name = xmlNodeGetAttribute(vehicle,"name") local id = xmlNodeGetAttribute(vehicle,"id") guiGridListSetItemText(gridlistVehicleSelection,row,1,name,false,false) guiGridListSetItemText(gridlistVehicleSelection,row,2,getVehicleType(tonumber(id)),false,false) guiGridListSetItemData(gridlistVehicleSelection,row,1,tostring(id)) end end xmlUnloadFile(rootnode) end end addEventHandler ("onClientGUIClick", getRootElement(), function(button, state, absoluteX, absoluteY) if ( source == close ) then setTimer(guiSetVisible,100,1,windowVehicleSelection,false) showCursor(false)-- end end) function createVehicleHandler(button,state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(gridlistVehicleSelection) if row and col and row ~= -1 and col ~= -1 then local selected = guiGridListGetItemData(gridlistVehicleSelection,row,col) selected = tonumber(selected) local rotz = getPedRotation(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) x = x + ( math.cos ( math.rad ( rotz+90 ) ) * 3) y = y + ( math.sin ( math.rad ( rotz+90 ) ) * 3) if selected and x and y and z then triggerServerEvent("createVehicleFromGUI",getRootElement(),selected,x,y,z) guiSetVisible(windowVehicleSelection,false) showCursor(false,false) else outputChatBox("Invalid arguments.") end else -- otherwise, output a message to the player outputChatBox("Please select a vehicle.") end end end سيرفر local mark = createMarker (1472.6,2754.0,10.6, "cylinder", 0.5, 0, 255, 0, 0 ) addEventHandler("onMarkerHit",root, function (plr) if source == mark then triggerClientEvent(plr,"onShow",plr) end end ) فيشلي اكس ام ال <root> <group type="Emergency"> <vehicle id="416" name="Ambulance"/> <vehicle id="599" name="Police ranger"/> </group> <group type="Sports"> <vehicle id="562" name="Elegy" /> <vehicle id="560" name="Sultan" /> <vehicle id="559" name="Jester" /> <vehicle id="565" name="Flash" /> <vehicle id="477" name="ZR-350" /> </group> </root> Link to comment
|Mr|-Talal07-| Posted November 18, 2012 Share Posted November 18, 2012 xml شوف في ذا الموضوع في واحد سواها بال viewtopic.php?f=119&t=47731&p=480303&hilit=%D8%B7%D8%B1%D9%8A%D9%82%D8%A9+%D8%B3%D9%87%D9%84%D8%A9#p480303 Link to comment
TAPL Posted November 18, 2012 Share Posted November 18, 2012 -- Client Side -- windowVehicleSelection = guiCreateWindow(471, 269, 150, 208, "vehicles by king-abady", false) gridlistVehicleSelection = guiCreateGridList(9,23, 132, 150, false, windowVehicleSelection) guiGridListAddColumn(gridlistVehicleSelection, "Name", 0.5) guiGridListAddColumn(gridlistVehicleSelection, "Type", 0.5) guiGridListSetSelectionMode(gridlistVehicleSelection, 1) close = guiCreateButton(14, 177, 61, 22, "أغلاق", false, windowVehicleSelection) buttonCreate = guiCreateButton(79, 177, 59, 22, "أختيار", false, windowVehicleSelection) guiSetVisible(windowVehicleSelection, false) addEvent("onShow", true) addEventHandler("onShow", root, function() guiSetVisible(windowVehicleSelection, true) showCursor(true) end) function populateGridlist() local rootnode = xmlLoadFile("vehicles.xml") if rootnode then for _,group in ipairs(xmlNodeGetChildren(rootnode)) do local row = guiGridListAddRow(gridlistVehicleSelection) local name = xmlNodeGetAttribute(group,"type") guiGridListSetItemText(gridlistVehicleSelection, row, 1, name, true, false) for _,vehicle in ipairs(xmlNodeGetChildren(group)) do row = guiGridListAddRow(gridlistVehicleSelection) name = xmlNodeGetAttribute(vehicle, "name") local id = xmlNodeGetAttribute(vehicle, "id") guiGridListSetItemText(gridlistVehicleSelection, row, 1, name, false, false) guiGridListSetItemData(gridlistVehicleSelection, row, 1, tostring(id)) guiGridListSetItemText(gridlistVehicleSelection, row, 2, getVehicleType(tonumber(id)), false, false) end end xmlUnloadFile(rootnode) end end addEventHandler("onClientResourceStart", resourceRoot, populateGridlist) addEventHandler ("onClientGUIClick", root, function() if (source == close) then setTimer(guiSetVisible, 100, 1, windowVehicleSelection, false) showCursor(false) end end) function createVehicleHandler(button, state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(gridlistVehicleSelection) if row and col and row ~= -1 and col ~= -1 then local selected = guiGridListGetItemData(gridlistVehicleSelection,row,col) selected = tonumber(selected) local rotz = getPedRotation(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) x = x + ( math.cos ( math.rad ( rotz+90 ) ) * 3) y = y + ( math.sin ( math.rad ( rotz+90 ) ) * 3) if selected and x and y and z then triggerServerEvent("createVehicleFromGUI", localPlayer,selected,x,y,z) guiSetVisible(windowVehicleSelection,false) showCursor(false) else outputChatBox("Invalid arguments.") end else outputChatBox("Please select a vehicle.") end end end addEventHandler ("onClientGUIClick", buttonCreate, createVehicleHandler, false) -- Server Side -- local mark = createMarker (1472.6, 2754.0, 9.7, "cylinder", 1, 0, 255, 0) addEventHandler("onMarkerHit", root, function (plr) if source == mark then triggerClientEvent(plr, "onShow", plr) end end) addEvent("createVehicleFromGUI", true) addEventHandler("createVehicleFromGUI", root, function(id, x, y, z) createVehicle(id, x, y, z) 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