./BlackBird# Posted August 31, 2012 Share Posted August 31, 2012 السلام عليكم ورحمة الله و بركاته انا بغيت كود مثلا -- this function is called whenever someone types 'createmarker' in the console: function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) -- get the player's position -- create a cylindrical marker next to the player: local theMarker = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 ) if ( theMarker ) then -- check if the marker was created successfully outputConsole ( "Marker created successfully", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end addCommandHandler ( "createmarker", consoleCreateMarker ) هذا المثال من الويكي جايبه يسوي ماركر بس المشكلة انه يقدر يسوي ماركر كثير ابي يقدر يسوي 1 اذا سوا قبل و بيسوي ثاني يختفي الاول Link to comment
3NAD Posted August 31, 2012 Share Posted August 31, 2012 setElementData getElementData destroyElement Link to comment
./BlackBird# Posted August 31, 2012 Author Share Posted August 31, 2012 ما عرفت كيف اسويه لان ما اعرف وش Element تسوي Link to comment
Tete omar Posted August 31, 2012 Share Posted August 31, 2012 ما عرفت كيف اسويه لان ما اعرف وش Element تسوي https://wiki.multitheftauto.com/wiki/Element Link to comment
./BlackBird# Posted August 31, 2012 Author Share Posted August 31, 2012 مشكور ان شاء الله اقدر اسوي الكود Link to comment
abu5lf Posted August 31, 2012 Share Posted August 31, 2012 hatMarker = {} function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) if isElement( hatMarker[thePlayer] ) then destroyElement( hatMarker[thePlayer] ) end hatMarker[thePlayer] = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 ) if ( hatMarker[thePlayer] ) then outputConsole ( "Marker created successfully", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end addCommandHandler ( "createmarker", consoleCreateMarker ) Link to comment
./BlackBird# Posted August 31, 2012 Author Share Posted August 31, 2012 ابي تصحيح هذا الكود addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local marker = createMarker(x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) createBlipAttachedTo(marker, 15) function changeLocation(person) setElementPosition(person, x2, y2, z2) end end end addEventHandler("onMarkerHit", marker, changeLocation) addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) الماركر الاول احداثاته في x1 y1 z1 و المكان الثاني x2 y2 z2 Link to comment
abu5lf Posted August 31, 2012 Share Posted August 31, 2012 (edited) ابي تصحيح هذا الكود addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local marker = createMarker(x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) createBlipAttachedTo(marker, 15) function changeLocation(person) setElementPosition(person, x2, y2, z2) end end end addEventHandler("onMarkerHit", marker, changeLocation) addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) الماركر الاول احداثاته في x1 y1 z1 و المكان الثاني x2 y2 z2 addEventHandler( 'onClientGUIClick', getRootElement(), function( ) if ( source == GUIEditor_Button[3] ) then local x, y, z = getElementPosition ( getLocalPlayer() ) local marker = createMarker( x, y, z ) createBlipAttachedTo( marker, 15 ) addEventHandler( 'onClientMarkerHit', marker, function ( hitPlayer ) if ( getElementType ( hitPlayer ) == 'player' ) then setElementPosition ( hitPlayer, 10, 11, 11 ) end end ) end end ) Edited August 31, 2012 by Guest Link to comment
./BlackBird# Posted August 31, 2012 Author Share Posted August 31, 2012 ابي تصحيح هذا الكود addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local marker = createMarker(x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) createBlipAttachedTo(marker, 15) function changeLocation(person) setElementPosition(person, x2, y2, z2) end end end addEventHandler("onMarkerHit", marker, changeLocation) addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) الماركر الاول احداثاته في x1 y1 z1 و المكان الثاني x2 y2 z2 ,وضح لي وش تبي من الكود انا مسوي 3 ازرار و 6 edit سويت 6 عشان ياخذ احداثيات مكانين زر ياخذ المكان الاول و الزر الثاني ياخذ احداثيات الثاني و الزر الثالث يسوي هذا addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local marker = createMarker(x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) createBlipAttachedTo(marker, 15) function changeLocation(person) setElementPosition(person, x2, y2, z2) end end end addEventHandler("onMarkerHit", marker, changeLocation) addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) بس فيه خطأ ما اعرف وش هو Link to comment
abu5lf Posted August 31, 2012 Share Posted August 31, 2012 شف ردي مرة ثانية واذا تبي تجيب الاحداثيات من الاديت guiGetText Link to comment
./BlackBird# Posted August 31, 2012 Author Share Posted August 31, 2012 شف ردي مرة ثانية واذا تبي تجيب الاحداثيات من الاديت guiGetText انت ما فهمتني انا المود كله شغال الا زر 1 هذا الكود addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local marker = createMarker(x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) createBlipAttachedTo(marker, 15) function changeLocation(person) setElementPosition(person, x2, y2, z2) end end end addEventHandler("onMarkerHit", marker, changeLocation) addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) Link to comment
abu5lf Posted August 31, 2012 Share Posted August 31, 2012 شف ردي مرة ثانية واذا تبي تجيب الاحداثيات من الاديت guiGetText انت ما فهمتني انا المود كله شغال الا زر 1 هذا الكود addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local marker = createMarker(x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) createBlipAttachedTo(marker, 15) function changeLocation(person) setElementPosition(person, x2, y2, z2) end end end addEventHandler("onMarkerHit", marker, changeLocation) addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) الكود مخربط كيف ابعرف وش الي تبي واصلحه Link to comment
abu5lf Posted August 31, 2012 Share Posted August 31, 2012 جرب كذا addEventHandler( 'onClientGUIClick', getRootElement(), function( ) if ( source == GUIEditor_Button[3] ) then local marker = createMarker( x1, y1, z1 ) createBlipAttachedTo( marker, 15 ) addEventHandler( 'onClientMarkerHit', marker, function ( hitPlayer ) if ( getElementType ( hitPlayer ) == 'player' ) then setElementPosition ( hitPlayer, x2, y2, z2 ) end end ) end end ) Link to comment
abu5lf Posted August 31, 2012 Share Posted August 31, 2012 جب لي فائدة الكود عشان افهم وش تبي بالضبط Link to comment
./BlackBird# Posted August 31, 2012 Author Share Posted August 31, 2012 الزر الي بنص ما يشتغل Link to comment
3NAD Posted August 31, 2012 Share Posted August 31, 2012 ججرب ذا addEventHandler ("onClientGUIClick", root function (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local x1 = guiGetText( Edit1 ) local y1 = guiGetText( Edit2 ) local z1 = guiGetText( Edit3 ) createMarker( x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) end end ) Edit1 , Edit2 , Edit3 = أسم الخانة اللي تجي فيها الأحداثيات Link to comment
./BlackBird# Posted September 1, 2012 Author Share Posted September 1, 2012 ججرب ذا addEventHandler ("onClientGUIClick", root function (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[3]) then local x1 = guiGetText( Edit1 ) local y1 = guiGetText( Edit2 ) local z1 = guiGetText( Edit3 ) createMarker( x1, y1, z1, "checkpoint", 2, 255, 255, 0, 0) end end ) Edit1 , Edit2 , Edit3 = أسم الخانة اللي تجي فيها الأحداثيات ي عناد الكود هذا شغال بس انت ما فهمتني ابي يصمم 2 ماركر الماركر الاول ينقلك للثاني و بس Link to comment
hassan.k.s.a Posted September 1, 2012 Share Posted September 1, 2012 (edited) جرب هذا function onGuiClick1(button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then guiSetProperty( GUIEditor_Button[2], "Disabled", "False" ) local x1, y2, z3 = getElementPosition ( localPlayer ) local x1 = guiGetText( Edit1 ) local y2 = guiGetText( Edit2 ) local z3 = guiGetText( Edit3 ) createMarker( x1, y2, z3, "checkpoint", 2, 255, 255, 0, 0) elseif (source == GUIEditor_Button[2]) then local x, y, z = getElementPosition ( localPlayer ) local x = guiGetText( Edit4 ) local y = guiGetText( Edit5 ) local z = guiGetText( Edit6 )--اسم الفراغ Edit6 local Marker = createMarker ( x, y, z, "cylinder", 2, 255, 255, 0, 150 ) end end addEventHandler("onClientGUIClick", root, onGuiClick1) addEventHandler('onClientMarkerHit', Marker, function ( hitPlayer ) if ( hitPlayer == localPlayer ) then setElementPosition(localPlayer,x1,y2,z3) end end ) او function onGuiClick2(button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then guiSetProperty( GUIEditor_Button[2], "Disabled", "False" ) local x1, y2, z3 = getElementPosition ( localPlayer ) local x1 = guiGetText( Edit1 ) local y2 = guiGetText( Edit2 ) local z3 = guiGetText( Edit3 ) local Marker1 = createMarker( x1, y2, z3, "checkpoint", 2, 255, 255, 0, 0) elseif (source == GUIEditor_Button[2]) then local x, y, z = getElementPosition ( localPlayer ) local x = guiGetText( Edit4 ) local y = guiGetText( Edit5 ) local z = guiGetText( Edit6 )--اسم الفراغ Edit6 local Marker1 = createMarker ( x, y, z, "cylinder", 2, 255, 255, 0, 150 ) end end addEventHandler("onClientGUIClick", root, onGuiClick2) addEventHandler('onClientMarkerHit', Marker1, function ( hitPlayer ) if ( hitPlayer == localPlayer ) then setElementPosition(localPlayer,x1,y2,z3) end end ) والزر الثاني خليه ماينضغط علشان يكون بترتيب الماركر والنقل ضيف تحت الزر الثاني guiSetProperty( GUIEditor_Button[2], "Disabled", "True" ) علشان مايقدر العضو يضغطه الا لما يسوي الماركر ألأول Edited September 1, 2012 by Guest Link to comment
./BlackBird# Posted September 1, 2012 Author Share Posted September 1, 2012 ما انفتحت النافذة Link to comment
hassan.k.s.a Posted September 1, 2012 Share Posted September 1, 2012 عدلت مشاركتي انا الحين جرب Link to comment
hassan.k.s.a Posted September 1, 2012 Share Posted September 1, 2012 آسف عدلته مرا ثانيه جرب الحين Link to comment
Recommended Posts