xX|KeMo|Xx Posted January 30, 2013 Share Posted January 30, 2013 السلام عليكم ابي مساعده في كود ما عرفت اسويه الحين عندي صورة (DX نوع الصوره) ابي تظهر فوق كل لاعبين السيرفر وشكرا Link to comment
jafar Posted January 30, 2013 Share Posted January 30, 2013 تقدر تستفيد من مود يكتب بس عليك تعدل الكود Link to comment
xX|KeMo|Xx Posted January 30, 2013 Author Share Posted January 30, 2013 تقدر تستفيد من مود يكتببس عليك تعدل الكود حاولت ما قدرت Link to comment
xX|KeMo|Xx Posted January 30, 2013 Author Share Posted January 30, 2013 سوري لني حطيته بالقسم الخطأ ( ما اعرف النظام الجديد ) Link to comment
3NAD Posted January 30, 2013 Share Posted January 30, 2013 ماجربت بس يمكن يفيدكـ https://wiki.multitheftauto.com/wiki/GetElementPosition https://wiki.multitheftauto.com/wiki/DxDrawImage3D يعني تاخذ احداثيات اللاعب و تستخدمها في الصورة Link to comment
|Mr|-Talal07-| Posted January 31, 2013 Share Posted January 31, 2013 ماجربت بس يمكن يفيدكـhttps://wiki.multitheftauto.com/wiki/GetElementPosition https://wiki.multitheftauto.com/wiki/DxDrawImage3D يعني تاخذ احداثيات اللاعب و تستخدمها في الصورة + Event : "onClientRender" Link to comment
xX|KeMo|Xx Posted January 31, 2013 Author Share Posted January 31, 2013 اوك بجرب (ابيه يظل ثابت وهو يتحرك) يعني ما احتاج لاحدائيات الاعب اكيد Link to comment
hassan.k.s.a Posted January 31, 2013 Share Posted January 31, 2013 ماني مجربه - جربه local screenWidth, screenHeight = guiGetScreenSize() local x,y,z = getElementPosition(localPlayer) addEventHandler("onClientRender",getRootElement(),function() local screenX, screenY = getScreenFromWorldPosition(x,y,z) local xx,yy,zz = getCameraMatrix() local distance = getDistanceBetweenPoints2D(xx,yy,z,y) local scale = 1000 / screenWidth local width = 80 / scale dxDrawImage(screenX - width / 2, screenY - screenHeight / 10, width, 80, "imageName.png") end) Link to comment
3NAD Posted January 31, 2013 Share Posted January 31, 2013 ^ الإحداثيات جلبتها مرة وحدة يعني الصورة بتثبت في مكان واحد : ) Link to comment
hassan.k.s.a Posted January 31, 2013 Share Posted January 31, 2013 addEventHandler("onClientRender",getRootElement(),function() local screenWidth, screenHeight = guiGetScreenSize() local x,y,z = getElementPosition(localPlayer) local screenX, screenY = getScreenFromWorldPosition(x,y,z) local xx,yy,zz = getCameraMatrix() local distance = getDistanceBetweenPoints2D(xx,yy,z,y) local scale = 1000 / screenWidth local width = 80 / scale dxDrawImage(screenX - width / 2, screenY - screenHeight / 10, width, 80, "imageName.png") end) Link to comment
Blaawee Posted February 1, 2013 Share Posted February 1, 2013 (edited) ^ خطأ . استخدم ذي بس : getPedBonePosition -- اسهل لكك عشآن تحطه فوق رآسه getScreenFromWorldPosition getCameraMatrix isLineOfSightClear getDistanceBetweenPoints3D Edited February 1, 2013 by Guest Link to comment
|Mr|-Talal07-| Posted February 1, 2013 Share Posted February 1, 2013 جرب ذا addEventHandler("onClientRender",root, function () local cx,cy,cz = getCameraMatrix() for i,player in ipairs(getElementsByType("player")) do if ( player == localPlayer ) then return end local px,py,pz = getElementPosition(player) local bx,by,bz = getPedBonePosition(player,6) local dis = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz) local x,y = getScreenFromWorldPosition(bx,by,bz + 0.2) if x and dis < 30 and isLineOfSightClear(cx,cy,cz,px,py,pz,true,false,false,true,false,false,false,localPlayer) then dxDrawImage(x,y,x/2,y/2,"img.png") end end end ) لازم يكون في واحد في السيرفر عشان تجربه Link to comment
hassan.k.s.a Posted February 1, 2013 Share Posted February 1, 2013 وش الخطأ في الكود حقي؟ Link to comment
Blaawee Posted February 1, 2013 Share Posted February 1, 2013 اول شيء انت مستخدم في بعدين getDistanceBetweenPoints2D( xx, yy, z, y ) و بعدين ترتيبك للارقمنت غلط getDistanceBetweenPoints2D ( x1, y1, x2, y2 ) -- x1: The X position of the first point -- y1: The Y position of the first point -- x2: The X position of the second point -- y2: The Y position of the second point Link to comment
hassan.k.s.a Posted February 1, 2013 Share Posted February 1, 2013 طيب حلو توني مجربه شغال ! Link to comment
Blaawee Posted February 1, 2013 Share Posted February 1, 2013 جرب ذآ احسن local gScreenSize = { guiGetScreenSize( ) }; local gOffest = 0.4; local gIconWidth = 0.35 * gScreenSize[ 1 ]; local gHconHalfWidth = gIconWidth / 2; addEventHandler ( 'onClientRender', root, function( ) for _, players in ipairs( getElementsByType( 'player' ) ) do while true do if not isElementOnScreen( players ) then break end local headX, headY, headZ = getPedBonePosition( players, 8 ); headZ = headZ + gOffest; local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); if not absX or not absY then break end local camX, camY, camZ = getCameraMatrix( ); if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then break end dxDrawImages( absX, absY, 'img.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); break end end end ) function dxDrawImages ( posX, posY, iconPath, color, distance ) distance = 1 / distance; dxDrawImage ( posX - gHconHalfWidth * distance, posY - gHconHalfWidth * distance, gIconWidth * distance, gIconWidth * distance, iconPath, 0, 0, 0, color, false ); end Link to comment
xX|KeMo|Xx Posted February 2, 2013 Author Share Posted February 2, 2013 جزاكم الله خيرآ جربته واشتغل بس واجهتني مشكله انا قاعد اسوي المود سويت له زر اذا ظغط عليه يفتح لما اضغط عليه تيجي بسرعه وتروح ابي حل :"( Link to comment
hassan.k.s.a Posted February 2, 2013 Share Posted February 2, 2013 اي كود استخدمت؟ . علشآن اعطيك الحل Link to comment
xX|KeMo|Xx Posted February 3, 2013 Author Share Posted February 3, 2013 addEventHandler ( 'onClientGUIClick', getRootElement(), function(button, state, absoluteX, absoluteY) if ( source == B1 ) then for _, players in ipairs( getElementsByType( 'player' ) ) do while true do if not isElementOnScreen( players ) then break end local headX, headY, headZ = getPedBonePosition( players, 8 ); headZ = headZ + gOffest; local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); if not absX or not absY then break end local camX, camY, camZ = getCameraMatrix( ); if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then break end dxDrawImages( absX, absY, 'img/1.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); break end end end end ) Link to comment
3NAD Posted February 3, 2013 Share Posted February 3, 2013 Event : "onClientRender " -- مهم Link to comment
Blaawee Posted February 3, 2013 Share Posted February 3, 2013 local gScreenSize = { guiGetScreenSize( ) }; local gOffest = 0.4; local gIconWidth = 0.35 * gScreenSize[ 1 ]; local gHconHalfWidth = gIconWidth / 2; function renderTheHeadImg( ) for _, players in ipairs( getElementsByType( 'player' ) ) do while true do if not isElementOnScreen( players ) then break end local headX, headY, headZ = getPedBonePosition( players, 8 ); headZ = headZ + gOffest; local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); if not absX or not absY then break end local camX, camY, camZ = getCameraMatrix( ); if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then break end dxDrawImages( absX, absY, 'img/1.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); break end end end function dxDrawImages ( posX, posY, iconPath, color, distance ) distance = 1 / distance; dxDrawImage ( posX - gHconHalfWidth * distance, posY - gHconHalfWidth * distance, gIconWidth * distance, gIconWidth * distance, iconPath, 0, 0, 0, color, false ); end addEventHandler ( 'onClientGUIClick', guiRoot, function( button, state, absoluteX, absoluteY ) if ( source == B1 ) then addEventHandler( 'onClientRender', root, renderTheHeadImg ); end end ) اذا تبي تلغيهآ استخدم removeEventHandler( 'onClientRender', root, renderTheHeadImg ); Link to comment
|Mr|-Talal07-| Posted February 3, 2013 Share Posted February 3, 2013 سويت تعديل بسيط اذا يبي يظهرها و يوخرها من نفس الزر local gScreenSize = { guiGetScreenSize( ) }; local gOffest = 0.4; local gIconWidth = 0.35 * gScreenSize[ 1 ]; local gHconHalfWidth = gIconWidth / 2; function renderTheHeadImg( ) for _, players in ipairs( getElementsByType( 'player' ) ) do while true do if not isElementOnScreen( players ) then break end local headX, headY, headZ = getPedBonePosition( players, 8 ); headZ = headZ + gOffest; local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); if not absX or not absY then break end local camX, camY, camZ = getCameraMatrix( ); if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then break end dxDrawImages( absX, absY, 'img/1.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); break end end end function dxDrawImages ( posX, posY, iconPath, color, distance ) distance = 1 / distance; dxDrawImage ( posX - gHconHalfWidth * distance, posY - gHconHalfWidth * distance, gIconWidth * distance, gIconWidth * distance, iconPath, 0, 0, 0, color, false ); end isShow = false addEventHandler ( 'onClientGUIClick', guiRoot, function( button, state, absoluteX, absoluteY ) if ( source == B1 ) then if isShow then removeEventHandler( 'onClientRender', root, renderTheHeadImg ); isShow = false else addEventHandler( 'onClientRender', root, renderTheHeadImg ); isShow = true end end end ) Link to comment
xX|KeMo|Xx Posted February 4, 2013 Author Share Posted February 4, 2013 سويت تعديل بسيط اذا يبي يظهرها و يوخرها من نفس الزر local gScreenSize = { guiGetScreenSize( ) }; local gOffest = 0.4; local gIconWidth = 0.35 * gScreenSize[ 1 ]; local gHconHalfWidth = gIconWidth / 2; function renderTheHeadImg( ) for _, players in ipairs( getElementsByType( 'player' ) ) do while true do if not isElementOnScreen( players ) then break end local headX, headY, headZ = getPedBonePosition( players, 8 ); headZ = headZ + gOffest; local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); if not absX or not absY then break end local camX, camY, camZ = getCameraMatrix( ); if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then break end dxDrawImages( absX, absY, 'img/1.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); break end end end function dxDrawImages ( posX, posY, iconPath, color, distance ) distance = 1 / distance; dxDrawImage ( posX - gHconHalfWidth * distance, posY - gHconHalfWidth * distance, gIconWidth * distance, gIconWidth * distance, iconPath, 0, 0, 0, color, false ); end isShow = false addEventHandler ( 'onClientGUIClick', guiRoot, function( button, state, absoluteX, absoluteY ) if ( source == B1 ) then if isShow then removeEventHandler( 'onClientRender', root, renderTheHeadImg ); isShow = false else addEventHandler( 'onClientRender', root, renderTheHeadImg ); isShow = true 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