Alix2015 Posted October 19, 2015 Share Posted October 19, 2015 السلام عليكم شباب محتاج كود الكتابه فوق المااركر ضوروري Link to comment
a7zan Posted October 19, 2015 Share Posted October 19, 2015 Event # 'onClientRender' function # getElementPosition getScreenFromWorldPosition getDistanceBetweenPoints3D dxDrawText Link to comment
Rockyz Posted October 19, 2015 Share Posted October 19, 2015 برضو مو فاهم اطرح الي سويته ؟ ! Link to comment
momar5700 Posted October 19, 2015 Share Posted October 19, 2015 سيرفر veh = {} marker = {} Data = { {-3275.2436523438,-3007.7487792969,5, "corona", 4, 255, 0, 0, 155 }, } setElementData(marker,'text3D','لـ أخذ موتر #') كلنت local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.2; local gAlphaDistance = 80; local gMaxDistance = 80; -- Max Distance local gTextAlpha = 150; local gTextSize = 2.5; local gAlphaDiff = gMaxDistance - gAlphaDistance; gScale = 1 / gScale * 800 / g_screenY; local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } }; local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } }; local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } }; local Marker = createMarker( -3275.2436523438,-3007.7487792969,5, 'corona', 1.0, 0, 0, 0, 0 ); addEventHandler ( 'onClientRender', root, function ( ) local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( Marker ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); if distance_1 <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ); if x1_ and y1_ then local scale = 1 / ( gScale * ( distance_1 / gMaxDistance ) ); local alpha = ( ( distance_1 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); dxDrawText( "لـ أخذ موتر #", x1_, y1_, x1_, y1_, tocolor ( 0, 0, 255, textalpha ), textscale * gTextSize, "default-bold", "center", "bottom", false, true ) end end end ); function math.evalCurve( curve, input ) if input < curve[ 1 ][ 1 ] then return curve[ 1 ][ 2 ]; end for idx = 2, #curve do if input < curve[ idx ][ 1 ] then local x1 = curve[ idx - 1 ][ 1 ]; local y1 = curve[ idx - 1 ][ 2 ]; local x2 = curve[ idx ][ 1 ]; local y2 = curve[ idx ][ 2 ]; local alpha = ( input - x1 ) / ( x2 - x1 ); return math.lerp( y1, y2, alpha ); end end return curve[ #curve ][ 2 ]; end function math.lerp( from, to, alpha ) return from + ( to-from ) * alpha; end Link to comment
[DONE]* Posted October 19, 2015 Share Posted October 19, 2015 اتوقع الموضوع هذه رح يفيدكـ viewtopic.php?f=160&t=89929 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