MR:SADIQ Posted May 13, 2013 Posted May 13, 2013 انا سويت gridlist احين ابي اذا اخترت كلمة من لقريد لست تصير الكلمة الي اختارها فوق الاعب وشكراً
فاّرس Posted May 13, 2013 Posted May 13, 2013 مم , يمكن تقدر تستخدم guiGridListGetSelectedItem -- تجيب الشيء المحدد عليه من الجريد ليست dxDrawText -- يجي على اللاعب getElementPosition -- تجيب احداثيات اللاعب عشان التكست ^
MR:SADIQ Posted May 13, 2013 Author Posted May 13, 2013 addEventHandler ( "onClientGUIClick", playerList, click ) end end addEventHandler ( "onClientResourceStart", getRootElement(), createPlayerList function click ( button, state, sx, sy, x, y, z, elem, gui ) end end function createText ( ) dxDrawText ( playerZoneName, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end
jafar Posted May 13, 2013 Posted May 13, 2013 https://forum.multitheftauto.com/viewtopic.php?f=160&t=59096
iMr.Dawix~# Posted May 13, 2013 Posted May 13, 2013 addEventHandler ( "onClientGUIClick", playerList, click ) end end addEventHandler ( "onClientResourceStart", getRootElement(), createPlayerList function click ( button, state, sx, sy, x, y, z, elem, gui ) end end function createText ( ) dxDrawText ( playerZoneName, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end لآ تنسخ وتلصق افهم وش هو معنى الكود الي تقراه بعدين حطه
فاّرس Posted May 13, 2013 Posted May 13, 2013 تقدر تستفيد من كود بلآوي, --\\\\\\\\\\\\\\\\\\\\\\\\\\ --// Setting local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.3; local gAlphaDistance = 25; local gMaxDistance = 50; -- Max Distance local gTextAlpha = 120; local gTextSize = 1; 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( 1552.4996337891, -1677.3264160156, 15.1953125, 'Cylinder', 1.5, 0, 0, 255, 150 ); local marker1 = createMarker( -1604.5458984375, 712.25848388672, 12.8671875, 'Cylinder', 1.5, 0, 0, 255, 150 ); local marker2 = createMarker( 2340.9245605469, 2456.0463867188, 13.96875, 'Cylinder', 1.5, 0, 0, 255, 150 ); addEventHandler ( 'onClientRender', root, function ( ) -- local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( marker ); local x2, y2, z2 = getElementPosition ( marker1 ); local x3, y3, z3 = getElementPosition ( marker2 ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); local distance_2 = getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ); local distance_3 = getDistanceBetweenPoints3D( x, y, z, x3, y3, z3 ); -- -- Marker #1 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( "police job", x1_, y1_, x1_, y1_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end -- Marker #2 elseif distance_2 <= gMaxDistance then local x2_, y2_ = getScreenFromWorldPosition( x2, y2, z2 + 0.95, 0.06 ); if x2_ and y2_ then -- local scale = 1 / ( gScale * ( distance_2 / gMaxDistance ) ); local alpha = ( ( distance_2 - 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( "police job", x2_, y2_, x2_, y2_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end -- Marker #3 elseif distance_3 <= gMaxDistance then local x3_, y3_ = getScreenFromWorldPosition( x3, y3, z3 + 0.95, 0.06 ); if x3_ and y3_ then -- local scale = 1 / ( gScale * ( distance_3 / gMaxDistance ) ); local alpha = ( ( distance_3 - 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( "police job", x3_, y3_, x3_, y3_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end end ); -- ////////////////////////////////// -- // MATH FUNCTIONS // -- ////////////////////////////////// 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 هو على ماركر عدله على اللاعب واربطه بالجريد ليست. guiGridListGetSelectedItem
MR:SADIQ Posted May 14, 2013 Author Posted May 14, 2013 سيرفر local x,y,z = getElementPosition( Text ) Text = createText ( 562, 1591.596680, -2495.323242, 18.098244 ) s كلنت guiGridListGetSelectedItem ( playerList ), 1 ) addEventHandler ( "onClientGUIClick", playerList, click ) dxDrawText ( playerZoneName, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender. end
فاّرس Posted May 14, 2013 Posted May 14, 2013 ^ ماله اي معنى كودك ! شوف الي عطيتك فوق خذ الاكواد منه,
iPrestege Posted May 14, 2013 Posted May 14, 2013 -- # Client Side -- # Text Settings local Text = "" -- Don't change it local r,g,b = 255,0,0 -- You can change the below ... local alpha = 255 local FontSize = 2 local TextFont = "arial" local Max3DText = 30 addEventHandler("onClientGUIClick",Grid, function ( ) if ( guiGridListGetSelectedItem( Grid ) ~= -1 ) then local PlayerText = guiGridListGetItemText ( Grid, guiGridListGetSelectedItem ( Grid ), 1 ) Text = PlayerText end end,false ) addEventHandler("onClientRender",getRootElement(), function ( ) local x,y,z = getElementPosition( localPlayer ) local MatrixX, MatrixY, MatrixZ = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( MatrixX, MatrixY,MatrixZ,x,y,z ) <= Max3DText ) then local WorldX,WorldY = getScreenFromWorldPosition( x,y,z +1,0.05 ) if ( WorldX and WorldY ) then dxDrawText ( tostring ( Text ) ,WorldX,WorldY,WorldX,WorldY,tocolor(r,g,b,alpha),FontSize,TextFont ) end end end ) Grid = القريد حقكـ #
MR:SADIQ Posted May 14, 2013 Author Posted May 14, 2013 --\\\\\\\\\\\\\\\\\\\\\\\\\\ --// Setting local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.3; local gAlphaDistance = 25; local gMaxDistance = 50; -- Max Distance local gTextAlpha = 120; local gTextSize = 1; 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 } }; addEventHandler ( 'onClientRender', root, function ( ) -- local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( Player ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); local distance_2 = getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ); local distance_3 = getDistanceBetweenPoints3D( x, y, z, x3, y3, z3 ); -- -- Player 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( "police job", x1_, y1_, x1_, y1_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end end ); -- ////////////////////////////////// -- // MATH FUNCTIONS // -- ////////////////////////////////// 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 كدا يصير؟
iPrestege Posted May 14, 2013 Posted May 14, 2013 لا شوف ردي بالصفحة 1 اخر رد ذذ ذا لـ ذاكـ ماغيرت شيء
MR:SADIQ Posted May 14, 2013 Author Posted May 14, 2013 -- # Client Side -- # Text Settings local Text = "" -- Don't change it local r,g,b = 255,0,0 -- You can change the below ... local alpha = 255 local FontSize = 2 local TextFont = "arial" local Max3DText = 30 addEventHandler("onClientGUIClick",Grid, function ( ) if ( guiGridListGetSelectedItem( Grid ) ~= -1 ) then local PlayerText = guiGridListGetItemText ( Grid, guiGridListGetSelectedItem ( Grid ), 1 ) Text = PlayerText end end,false ) addEventHandler("onClientRender",getRootElement(), function ( ) local x,y,z = getElementPosition( localPlayer ) local MatrixX, MatrixY, MatrixZ = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( MatrixX, MatrixY,MatrixZ,x,y,z ) <= Max3DText ) then local WorldX,WorldY = getScreenFromWorldPosition( x,y,z +1,0.05 ) if ( WorldX and WorldY ) then dxDrawText ( tostring ( Text ) ,WorldX,WorldY,WorldX,WorldY,tocolor(r,g,b,alpha),FontSize,TextFont ) end end end ) Grid = القريد حقكـ # مشكور خوك
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